Tweak base line of key top letter

Bug: 3285380
Change-Id: Idf6b9b7e000d87df924742634188d193f948130f
main
Tadashi G. Takaoka 2010-12-15 17:11:37 +09:00
parent 68b6932024
commit 98935836f0
4 changed files with 20 additions and 5 deletions

View File

@ -19,6 +19,18 @@
-->
<resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
<dimen name="keyboardHeight">58.0mm</dimen>
<!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">14.5mm</dimen> -->
<dimen name="key_bottom_gap">0.0mm</dimen>
<dimen name="key_horizontal_gap">0.0mm</dimen>
<dimen name="popup_key_height">13.0mm</dimen>
<dimen name="keyboard_top_padding">0.0mm</dimen>
<dimen name="keyboard_bottom_padding">0.0mm</dimen>
<!-- key_height x 1.0 -->
<dimen name="key_preview_height">13.0mm</dimen>
<dimen name="key_letter_size">28dip</dimen>
<dimen name="key_label_text_size">20dip</dimen>
<!-- left or right padding of label alignment -->

View File

@ -20,12 +20,12 @@
<resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3 -->
<dimen name="keyboardHeight">58.0mm</dimen>
<dimen name="keyboardHeight">48.0mm</dimen>
<!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">14.5mm</dimen> -->
<dimen name="key_bottom_gap">0.0mm</dimen>
<dimen name="key_horizontal_gap">0.0mm</dimen>
<dimen name="popup_key_height">13.0mm</dimen>
<dimen name="popup_key_height">10.0mm</dimen>
<dimen name="keyboard_top_padding">0.0mm</dimen>
<dimen name="keyboard_bottom_padding">0.0mm</dimen>
<!-- key_height x 1.0 -->

View File

@ -174,7 +174,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
// This map caches key label text height in pixel as value and key label text size as map key.
private final HashMap<Integer, Integer> mTextHeightCache = new HashMap<Integer, Integer>();
// Distance from horizontal center of the key, proportional to key label text height and width.
private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.55f;
private final float KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER = 0.45f;
private final float KEY_LABEL_VERTICAL_PADDING_FACTOR = 1.60f;
private final String KEY_LABEL_REFERENCE_CHAR = "H";
private final int KEY_LABEL_OPTION_ALIGN_LEFT = 1;
@ -727,6 +727,9 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
final float centerY = (key.mHeight + padding.top - padding.bottom) / 2;
baseline = centerY
+ labelCharHeight * KEY_LABEL_VERTICAL_ADJUSTMENT_FACTOR_CENTER;
if (DEBUG_SHOW_ALIGN)
drawHorizontalLine(canvas, (int)baseline, key.mWidth, 0xc0008000,
new Paint());
}
// Horizontal label text alignment
final int positionX;