Address a couple more issues in Khmer layout
bug: 6910993 Change-Id: If866629268040cf7696d9667dbca66fac6a60374main
parent
2e3c1106f7
commit
814acafaea
|
@ -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,8 +468,12 @@ 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)
|
||||
- Math.max(keyNumericHintLabelReferenceCharWidth, keyHintLabelStringWidth)
|
||||
/ 2.0f;
|
||||
hintY = -paint.ascent();
|
||||
paint.setTextAlign(Align.CENTER);
|
||||
|
|
|
@ -66,6 +66,11 @@ public final class TypefaceUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static float getStringWidth(final String string, final Paint paint) {
|
||||
paint.getTextBounds(string, 0, string.length(), sTextWidthBounds);
|
||||
return sTextWidthBounds.width();
|
||||
}
|
||||
|
||||
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
|
||||
final int labelSize = (int)paint.getTextSize();
|
||||
final Typeface face = paint.getTypeface();
|
||||
|
|
Loading…
Reference in New Issue