diff options
| author | Ken Wakasa <kwakasa@google.com> | 2013-09-20 07:32:48 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-20 07:32:48 +0000 |
| commit | 280990bcb19dde8b5d8298fa0b8313e8167802b2 (patch) | |
| tree | 9c020e50a8c24cb4989a86652ecb4445e37044fd /java/src/com/android/inputmethod/keyboard | |
| parent | 1d1a3d52b8f12766c7d2c1f2033217fce502f49a (diff) | |
| parent | 814acafaeaf138a1c742b6549789f86e65910ce1 (diff) | |
Merge "Address a couple more issues in Khmer layout"
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/KeyboardView.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index 0ef6802ca..aeb9e67b2 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -26,6 +26,7 @@ import android.graphics.Paint.Align; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.Region; +import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; @@ -445,6 +446,8 @@ public class KeyboardView extends View { if (hintLabel != null) { paint.setTextSize(key.selectHintTextSize(params)); paint.setColor(key.selectHintTextColor(params)); + // TODO: Should add a way to specify type face for hint letters + paint.setTypeface(Typeface.DEFAULT_BOLD); blendAlpha(paint, params.mAnimAlpha); final float hintX, hintY; if (key.hasHintLabel()) { @@ -465,9 +468,13 @@ public class KeyboardView extends View { paint.setTextAlign(Align.CENTER); } else { // key.hasHintLetter() // The hint letter is placed at top-right corner of the key. Used mainly on phone. + final float keyNumericHintLabelReferenceCharWidth = + TypefaceUtils.getCharWidth(KEY_NUMERIC_HINT_LABEL_REFERENCE_CHAR, paint); + final float keyHintLabelStringWidth = + TypefaceUtils.getStringWidth(hintLabel, paint); hintX = keyWidth - mKeyHintLetterPadding - - TypefaceUtils.getCharWidth(KEY_NUMERIC_HINT_LABEL_REFERENCE_CHAR, paint) - / 2.0f; + - Math.max(keyNumericHintLabelReferenceCharWidth, keyHintLabelStringWidth) + / 2.0f; hintY = -paint.ascent(); paint.setTextAlign(Align.CENTER); } |
