Loading api/current.txt +16 −19 Original line number Original line Diff line number Diff line Loading @@ -14431,6 +14431,7 @@ package android.graphics { method @ColorInt public int getColor(); method @ColorInt public int getColor(); method public android.graphics.ColorFilter getColorFilter(); method public android.graphics.ColorFilter getColorFilter(); method @ColorLong public long getColorLong(); method @ColorLong public long getColorLong(); method public int getEndHyphenEdit(); method public boolean getFillPath(android.graphics.Path, android.graphics.Path); method public boolean getFillPath(android.graphics.Path, android.graphics.Path); method public int getFlags(); method public int getFlags(); method public String getFontFeatureSettings(); method public String getFontFeatureSettings(); Loading @@ -14441,7 +14442,6 @@ package android.graphics { method public float getFontSpacing(); method public float getFontSpacing(); method public String getFontVariationSettings(); method public String getFontVariationSettings(); method public int getHinting(); method public int getHinting(); method public int getHyphenEdit(); method public float getLetterSpacing(); method public float getLetterSpacing(); method public android.graphics.MaskFilter getMaskFilter(); method public android.graphics.MaskFilter getMaskFilter(); method public int getOffsetForAdvance(char[], int, int, int, int, boolean, float); method public int getOffsetForAdvance(char[], int, int, int, int, boolean, float); Loading @@ -14455,6 +14455,7 @@ package android.graphics { method public float getShadowLayerDx(); method public float getShadowLayerDx(); method public float getShadowLayerDy(); method public float getShadowLayerDy(); method public float getShadowLayerRadius(); method public float getShadowLayerRadius(); method public int getStartHyphenEdit(); method @Px public float getStrikeThruPosition(); method @Px public float getStrikeThruPosition(); method @Px public float getStrikeThruThickness(); method @Px public float getStrikeThruThickness(); method public android.graphics.Paint.Cap getStrokeCap(); method public android.graphics.Paint.Cap getStrokeCap(); Loading Loading @@ -14510,13 +14511,13 @@ package android.graphics { method public android.graphics.ColorFilter setColorFilter(android.graphics.ColorFilter); method public android.graphics.ColorFilter setColorFilter(android.graphics.ColorFilter); method public void setDither(boolean); method public void setDither(boolean); method public void setElegantTextHeight(boolean); method public void setElegantTextHeight(boolean); method public void setEndHyphenEdit(int); method public void setFakeBoldText(boolean); method public void setFakeBoldText(boolean); method public void setFilterBitmap(boolean); method public void setFilterBitmap(boolean); method public void setFlags(int); method public void setFlags(int); method public void setFontFeatureSettings(String); method public void setFontFeatureSettings(String); method public boolean setFontVariationSettings(String); method public boolean setFontVariationSettings(String); method public void setHinting(int); method public void setHinting(int); method public void setHyphenEdit(int); method public void setLetterSpacing(float); method public void setLetterSpacing(float); method public void setLinearText(boolean); method public void setLinearText(boolean); method public android.graphics.MaskFilter setMaskFilter(android.graphics.MaskFilter); method public android.graphics.MaskFilter setMaskFilter(android.graphics.MaskFilter); Loading @@ -14524,6 +14525,7 @@ package android.graphics { method public android.graphics.Shader setShader(android.graphics.Shader); method public android.graphics.Shader setShader(android.graphics.Shader); method public void setShadowLayer(float, float, float, @ColorInt int); method public void setShadowLayer(float, float, float, @ColorInt int); method public void setShadowLayer(float, float, float, @ColorLong long); method public void setShadowLayer(float, float, float, @ColorLong long); method public void setStartHyphenEdit(int); method public void setStrikeThruText(boolean); method public void setStrikeThruText(boolean); method public void setStrokeCap(android.graphics.Paint.Cap); method public void setStrokeCap(android.graphics.Paint.Cap); method public void setStrokeJoin(android.graphics.Paint.Join); method public void setStrokeJoin(android.graphics.Paint.Join); Loading @@ -14550,11 +14552,21 @@ package android.graphics { field public static final int DEV_KERN_TEXT_FLAG = 256; // 0x100 field public static final int DEV_KERN_TEXT_FLAG = 256; // 0x100 field public static final int DITHER_FLAG = 4; // 0x4 field public static final int DITHER_FLAG = 4; // 0x4 field public static final int EMBEDDED_BITMAP_TEXT_FLAG = 1024; // 0x400 field public static final int EMBEDDED_BITMAP_TEXT_FLAG = 1024; // 0x400 field public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN = 3; // 0x3 field public static final int END_HYPHEN_EDIT_INSERT_HYPHEN = 2; // 0x2 field public static final int END_HYPHEN_EDIT_INSERT_MAQAF = 4; // 0x4 field public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN = 5; // 0x5 field public static final int END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN = 6; // 0x6 field public static final int END_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 field public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN = 1; // 0x1 field public static final int FAKE_BOLD_TEXT_FLAG = 32; // 0x20 field public static final int FAKE_BOLD_TEXT_FLAG = 32; // 0x20 field public static final int FILTER_BITMAP_FLAG = 2; // 0x2 field public static final int FILTER_BITMAP_FLAG = 2; // 0x2 field public static final int HINTING_OFF = 0; // 0x0 field public static final int HINTING_OFF = 0; // 0x0 field public static final int HINTING_ON = 1; // 0x1 field public static final int HINTING_ON = 1; // 0x1 field public static final int LINEAR_TEXT_FLAG = 64; // 0x40 field public static final int LINEAR_TEXT_FLAG = 64; // 0x40 field public static final int START_HYPHEN_EDIT_INSERT_HYPHEN = 1; // 0x1 field public static final int START_HYPHEN_EDIT_INSERT_ZWJ = 2; // 0x2 field public static final int START_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10 field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10 field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80 field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80 field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8 field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8 Loading Loading @@ -15928,12 +15940,13 @@ package android.graphics.text { } } public static class LineBreaker.Result { public static class LineBreaker.Result { method public int getEndLineHyphenEdit(int); method @Px public float getLineAscent(@IntRange(from=0) int); method @Px public float getLineAscent(@IntRange(from=0) int); method @IntRange(from=0) public int getLineBreakOffset(@IntRange(from=0) int); method @IntRange(from=0) public int getLineBreakOffset(@IntRange(from=0) int); method @IntRange(from=0) public int getLineCount(); method @IntRange(from=0) public int getLineCount(); method @Px public float getLineDescent(@IntRange(from=0) int); method @Px public float getLineDescent(@IntRange(from=0) int); method public int getLineHyphenEdit(int); method @Px public float getLineWidth(@IntRange(from=0) int); method @Px public float getLineWidth(@IntRange(from=0) int); method public int getStartLineHyphenEdit(int); method public boolean hasLineTab(int); method public boolean hasLineTab(int); } } Loading Loading @@ -46004,22 +46017,6 @@ package android.text { method public void handleTag(boolean, String, android.text.Editable, org.xml.sax.XMLReader); method public void handleTag(boolean, String, android.text.Editable, org.xml.sax.XMLReader); } } public class Hyphenator { method public static int packHyphenEdit(int, int); method public static int unpackEndHyphenEdit(int); method public static int unpackStartHyphenEdit(int); field public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN = 3; // 0x3 field public static final int END_HYPHEN_EDIT_INSERT_HYPHEN = 2; // 0x2 field public static final int END_HYPHEN_EDIT_INSERT_MAQAF = 4; // 0x4 field public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN = 5; // 0x5 field public static final int END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN = 6; // 0x6 field public static final int END_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 field public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN = 1; // 0x1 field public static final int START_HYPHEN_EDIT_INSERT_HYPHEN = 1; // 0x1 field public static final int START_HYPHEN_EDIT_INSERT_ZWJ = 2; // 0x2 field public static final int START_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 } public interface InputFilter { public interface InputFilter { method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); } } core/java/android/text/DynamicLayout.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -674,7 +674,8 @@ public class DynamicLayout extends Layout { objects[0] = reflowed.getLineDirections(i); objects[0] = reflowed.getLineDirections(i); final int end = (i == n - 1) ? where + after : reflowed.getLineStart(i + 1); final int end = (i == n - 1) ? where + after : reflowed.getLineStart(i + 1); ints[HYPHEN] = reflowed.getHyphen(i) & HYPHEN_MASK; ints[HYPHEN] = StaticLayout.packHyphenEdit( reflowed.getStartHyphenEdit(i), reflowed.getEndHyphenEdit(i)); ints[MAY_PROTRUDE_FROM_TOP_OR_BOTTOM] |= ints[MAY_PROTRUDE_FROM_TOP_OR_BOTTOM] |= contentMayProtrudeFromLineTopOrBottom(text, start, end) ? contentMayProtrudeFromLineTopOrBottom(text, start, end) ? MAY_PROTRUDE_FROM_TOP_OR_BOTTOM_MASK : 0; MAY_PROTRUDE_FROM_TOP_OR_BOTTOM_MASK : 0; Loading Loading @@ -1056,8 +1057,16 @@ public class DynamicLayout extends Layout { * @hide * @hide */ */ @Override @Override public int getHyphen(int line) { public @Paint.StartHyphenEdit int getStartHyphenEdit(int line) { return mInts.getValue(line, HYPHEN) & HYPHEN_MASK; return StaticLayout.unpackStartHyphenEdit(mInts.getValue(line, HYPHEN) & HYPHEN_MASK); } /** * @hide */ @Override public @Paint.EndHyphenEdit int getEndHyphenEdit(int line) { return StaticLayout.unpackEndHyphenEdit(mInts.getValue(line, HYPHEN) & HYPHEN_MASK); } } private boolean getContentMayProtrudeFromTopOrBottom(int line) { private boolean getContentMayProtrudeFromTopOrBottom(int line) { Loading core/java/android/text/Hyphenator.java +3 −130 Original line number Original line Diff line number Diff line Loading @@ -16,142 +16,15 @@ package android.text; package android.text; import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** /** * Provides constants and pack/unpack methods for the HyphenEdit. * Does the native Hyphenator initialization. * * Hyphenator provides constant values for start of line and end of line modification. * For example, by passing {@link #END_HYPHEN_EDIT_INSERT_HYPHEN} like as follows, HYPHEN(U+2010) * character is appended at the end of line. * * <pre> * <code> * Paint paint = new Paint(); * paint.setHyphenEdit(Hyphenator.packHyphenEdit( * Hyphenator.START_HYPHEN_EDIT_NO_EDIT, * Hyphenator.END_HYPHEN_EDIT_INSERT_HYPHEN)); * paint.measureText("abc", 0, 3); // Returns the width of "abc‐" * Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "abc‐" * </code> * </pre> * * * @see android.graphics.Paint#setHyphenEdit(int) * @hide */ */ public class Hyphenator { public class Hyphenator { private Hyphenator() {} private Hyphenator() {} /** @hide */ // This method is called from Zygote. @IntDef(prefix = { "START_HYPHEN_EDIT_" }, value = { START_HYPHEN_EDIT_NO_EDIT, START_HYPHEN_EDIT_INSERT_HYPHEN, START_HYPHEN_EDIT_INSERT_ZWJ }) @Retention(RetentionPolicy.SOURCE) public @interface StartHyphenEdit {} /** * An integer representing the starting of the line has no modification for hyphenation. */ public static final int START_HYPHEN_EDIT_NO_EDIT = 0x00; /** * An integer representing the starting of the line has normal hyphen character (U+002D). */ public static final int START_HYPHEN_EDIT_INSERT_HYPHEN = 0x01; /** * An integer representing the starting of the line has Zero-Width-Joiner (U+200D). */ public static final int START_HYPHEN_EDIT_INSERT_ZWJ = 0x02; /** @hide */ @IntDef(prefix = { "END_HYPHEN_EDIT_" }, value = { END_HYPHEN_EDIT_NO_EDIT, END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN, END_HYPHEN_EDIT_INSERT_HYPHEN, END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN, END_HYPHEN_EDIT_INSERT_MAQAF, END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN, END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN }) @Retention(RetentionPolicy.SOURCE) public @interface EndHyphenEdit {} /** * An integer representing the end of the line has no modification for hyphenation. */ public static final int END_HYPHEN_EDIT_NO_EDIT = 0x00; /** * An integer representing the character at the end of the line is replaced with hyphen * character (U+002D). */ public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN = 0x01; /** * An integer representing the end of the line has normal hyphen character (U+002D). */ public static final int END_HYPHEN_EDIT_INSERT_HYPHEN = 0x02; /** * An integer representing the end of the line has Armentian hyphen (U+058A). */ public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN = 0x03; /** * An integer representing the end of the line has maqaf (Hebrew hyphen, U+05BE). */ public static final int END_HYPHEN_EDIT_INSERT_MAQAF = 0x04; /** * An integer representing the end of the line has Canadian Syllabics hyphen (U+1400). */ public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN = 0x05; /** * An integer representing the end of the line has Zero-Width-Joiner (U+200D) followed by normal * hyphen character (U+002D). */ public static final int END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN = 0x06; // Following three constants are used for packing start hyphen edit and end hyphen edit into // single integer. Following encodings must be the same as the minikin's one. // See frameworks/minikin/include/Hyphenator.h for more details. private static final int END_HYPHEN_EDIT_MASK = 0x07; // 0b00111 private static final int START_HYPHEN_EDIT_MASK = 0x18; // 0b11000 private static final int START_HYPHEN_EDIT_SHIFT = 0x03; /** * Extract start hyphen edit from packed value. */ public static @StartHyphenEdit int unpackStartHyphenEdit(int hyphenEdit) { return (hyphenEdit & START_HYPHEN_EDIT_MASK) >> START_HYPHEN_EDIT_SHIFT; } /** * Extract end hyphen edit from packed value. */ public static @EndHyphenEdit int unpackEndHyphenEdit(int hyphenEdit) { return hyphenEdit & END_HYPHEN_EDIT_MASK; } /** * Pack the start hyphen edit and end hyphen edit into single integer. */ public static int packHyphenEdit(@StartHyphenEdit int startHyphenEdit, @EndHyphenEdit int endHyphenEdit) { return ((startHyphenEdit << START_HYPHEN_EDIT_SHIFT) & START_HYPHEN_EDIT_MASK) | (endHyphenEdit & END_HYPHEN_EDIT_MASK); } /** * @hide */ public static void init() { public static void init() { nInit(); nInit(); } } Loading core/java/android/text/Layout.java +18 −6 Original line number Original line Diff line number Diff line Loading @@ -437,7 +437,8 @@ public abstract class Layout { previousLineEnd = getLineStart(lineNum + 1); previousLineEnd = getLineStart(lineNum + 1); final boolean justify = isJustificationRequired(lineNum); final boolean justify = isJustificationRequired(lineNum); int end = getLineVisibleEnd(lineNum, start, previousLineEnd); int end = getLineVisibleEnd(lineNum, start, previousLineEnd); paint.setHyphenEdit(getHyphen(lineNum)); paint.setStartHyphenEdit(getStartHyphenEdit(lineNum)); paint.setEndHyphenEdit(getEndHyphenEdit(lineNum)); int ltop = previousLineBottom; int ltop = previousLineBottom; int lbottom = getLineTop(lineNum + 1); int lbottom = getLineTop(lineNum + 1); Loading Loading @@ -910,12 +911,21 @@ public abstract class Layout { public abstract int getBottomPadding(); public abstract int getBottomPadding(); /** /** * Returns the hyphen edit for a line. * Returns the start hyphen edit for a line. * * * @hide * @hide */ */ public int getHyphen(int line) { public @Paint.StartHyphenEdit int getStartHyphenEdit(int line) { return 0; return Paint.START_HYPHEN_EDIT_NO_EDIT; } /** * Returns the end hyphen edit for a line. * * @hide */ public @Paint.EndHyphenEdit int getEndHyphenEdit(int line) { return Paint.END_HYPHEN_EDIT_NO_EDIT; } } /** /** Loading Loading @@ -1418,7 +1428,8 @@ public abstract class Layout { final TextLine tl = TextLine.obtain(); final TextLine tl = TextLine.obtain(); final TextPaint paint = mWorkPaint; final TextPaint paint = mWorkPaint; paint.set(mPaint); paint.set(mPaint); paint.setHyphenEdit(getHyphen(line)); paint.setStartHyphenEdit(getStartHyphenEdit(line)); paint.setEndHyphenEdit(getEndHyphenEdit(line)); tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); if (isJustificationRequired(line)) { if (isJustificationRequired(line)) { Loading Loading @@ -1447,7 +1458,8 @@ public abstract class Layout { final TextLine tl = TextLine.obtain(); final TextLine tl = TextLine.obtain(); final TextPaint paint = mWorkPaint; final TextPaint paint = mWorkPaint; paint.set(mPaint); paint.set(mPaint); paint.setHyphenEdit(getHyphen(line)); paint.setStartHyphenEdit(getStartHyphenEdit(line)); paint.setEndHyphenEdit(getEndHyphenEdit(line)); tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); if (isJustificationRequired(line)) { if (isJustificationRequired(line)) { Loading core/java/android/text/StaticLayout.java +34 −8 Original line number Original line Diff line number Diff line Loading @@ -779,7 +779,8 @@ public class StaticLayout extends Layout { ascents[i] = res.getLineAscent(i); ascents[i] = res.getLineAscent(i); descents[i] = res.getLineDescent(i); descents[i] = res.getLineDescent(i); hasTabs[i] = res.hasLineTab(i); hasTabs[i] = res.hasLineTab(i); hyphenEdits[i] = res.getLineHyphenEdit(i); hyphenEdits[i] = packHyphenEdit(res.getStartLineHyphenEdit(i), res.getEndLineHyphenEdit(i)); } } final int remainingLineCount = mMaximumVisibleLineCount - mLineCount; final int remainingLineCount = mMaximumVisibleLineCount - mLineCount; Loading Loading @@ -1258,20 +1259,42 @@ public class StaticLayout extends Layout { return mBottomPadding; return mBottomPadding; } } // To store into single int field, pack the pair of start and end hyphen edit. static int packHyphenEdit( @Paint.StartHyphenEdit int start, @Paint.EndHyphenEdit int end) { return start << START_HYPHEN_BITS_SHIFT | end; } static int unpackStartHyphenEdit(int packedHyphenEdit) { return (packedHyphenEdit & START_HYPHEN_MASK) >> START_HYPHEN_BITS_SHIFT; } static int unpackEndHyphenEdit(int packedHyphenEdit) { return packedHyphenEdit & END_HYPHEN_MASK; } /** /** * Returns the packed hyphen edit value for this line. * Returns the start hyphen edit value for this line. * * * You can extract start hyphen edit and end hyphen edit by using * @param lineNumber a line number * {@link Hyphenator#unpackStartHyphenEdit(int)} and * @return A start hyphen edit value. * {@link Hyphenator#unpackEndHyphenEdit(int)}. * @hide */ @Override public @Paint.StartHyphenEdit int getStartHyphenEdit(int lineNumber) { return unpackStartHyphenEdit(mLines[mColumns * lineNumber + HYPHEN] & HYPHEN_MASK); } /** * Returns the packed hyphen edit value for this line. * * * @param lineNumber a line number * @param lineNumber a line number * @return A packed hyphen edit value. * @return An end hyphen edit value. * @hide * @hide */ */ @Override @Override public int getHyphen(int lineNumber) { public @Paint.EndHyphenEdit int getEndHyphenEdit(int lineNumber) { return mLines[mColumns * lineNumber + HYPHEN] & HYPHEN_MASK; return unpackEndHyphenEdit(mLines[mColumns * lineNumber + HYPHEN] & HYPHEN_MASK); } } /** /** Loading Loading @@ -1395,6 +1418,9 @@ public class StaticLayout extends Layout { private static final int DIR_SHIFT = 30; private static final int DIR_SHIFT = 30; private static final int TAB_MASK = 0x20000000; private static final int TAB_MASK = 0x20000000; private static final int HYPHEN_MASK = 0xFF; private static final int HYPHEN_MASK = 0xFF; private static final int START_HYPHEN_BITS_SHIFT = 3; private static final int START_HYPHEN_MASK = 0x18; // 0b11000 private static final int END_HYPHEN_MASK = 0x7; // 0b00111 private static final int TAB_INCREMENT = 20; // same as Layout, but that's private private static final int TAB_INCREMENT = 20; // same as Layout, but that's private Loading Loading
api/current.txt +16 −19 Original line number Original line Diff line number Diff line Loading @@ -14431,6 +14431,7 @@ package android.graphics { method @ColorInt public int getColor(); method @ColorInt public int getColor(); method public android.graphics.ColorFilter getColorFilter(); method public android.graphics.ColorFilter getColorFilter(); method @ColorLong public long getColorLong(); method @ColorLong public long getColorLong(); method public int getEndHyphenEdit(); method public boolean getFillPath(android.graphics.Path, android.graphics.Path); method public boolean getFillPath(android.graphics.Path, android.graphics.Path); method public int getFlags(); method public int getFlags(); method public String getFontFeatureSettings(); method public String getFontFeatureSettings(); Loading @@ -14441,7 +14442,6 @@ package android.graphics { method public float getFontSpacing(); method public float getFontSpacing(); method public String getFontVariationSettings(); method public String getFontVariationSettings(); method public int getHinting(); method public int getHinting(); method public int getHyphenEdit(); method public float getLetterSpacing(); method public float getLetterSpacing(); method public android.graphics.MaskFilter getMaskFilter(); method public android.graphics.MaskFilter getMaskFilter(); method public int getOffsetForAdvance(char[], int, int, int, int, boolean, float); method public int getOffsetForAdvance(char[], int, int, int, int, boolean, float); Loading @@ -14455,6 +14455,7 @@ package android.graphics { method public float getShadowLayerDx(); method public float getShadowLayerDx(); method public float getShadowLayerDy(); method public float getShadowLayerDy(); method public float getShadowLayerRadius(); method public float getShadowLayerRadius(); method public int getStartHyphenEdit(); method @Px public float getStrikeThruPosition(); method @Px public float getStrikeThruPosition(); method @Px public float getStrikeThruThickness(); method @Px public float getStrikeThruThickness(); method public android.graphics.Paint.Cap getStrokeCap(); method public android.graphics.Paint.Cap getStrokeCap(); Loading Loading @@ -14510,13 +14511,13 @@ package android.graphics { method public android.graphics.ColorFilter setColorFilter(android.graphics.ColorFilter); method public android.graphics.ColorFilter setColorFilter(android.graphics.ColorFilter); method public void setDither(boolean); method public void setDither(boolean); method public void setElegantTextHeight(boolean); method public void setElegantTextHeight(boolean); method public void setEndHyphenEdit(int); method public void setFakeBoldText(boolean); method public void setFakeBoldText(boolean); method public void setFilterBitmap(boolean); method public void setFilterBitmap(boolean); method public void setFlags(int); method public void setFlags(int); method public void setFontFeatureSettings(String); method public void setFontFeatureSettings(String); method public boolean setFontVariationSettings(String); method public boolean setFontVariationSettings(String); method public void setHinting(int); method public void setHinting(int); method public void setHyphenEdit(int); method public void setLetterSpacing(float); method public void setLetterSpacing(float); method public void setLinearText(boolean); method public void setLinearText(boolean); method public android.graphics.MaskFilter setMaskFilter(android.graphics.MaskFilter); method public android.graphics.MaskFilter setMaskFilter(android.graphics.MaskFilter); Loading @@ -14524,6 +14525,7 @@ package android.graphics { method public android.graphics.Shader setShader(android.graphics.Shader); method public android.graphics.Shader setShader(android.graphics.Shader); method public void setShadowLayer(float, float, float, @ColorInt int); method public void setShadowLayer(float, float, float, @ColorInt int); method public void setShadowLayer(float, float, float, @ColorLong long); method public void setShadowLayer(float, float, float, @ColorLong long); method public void setStartHyphenEdit(int); method public void setStrikeThruText(boolean); method public void setStrikeThruText(boolean); method public void setStrokeCap(android.graphics.Paint.Cap); method public void setStrokeCap(android.graphics.Paint.Cap); method public void setStrokeJoin(android.graphics.Paint.Join); method public void setStrokeJoin(android.graphics.Paint.Join); Loading @@ -14550,11 +14552,21 @@ package android.graphics { field public static final int DEV_KERN_TEXT_FLAG = 256; // 0x100 field public static final int DEV_KERN_TEXT_FLAG = 256; // 0x100 field public static final int DITHER_FLAG = 4; // 0x4 field public static final int DITHER_FLAG = 4; // 0x4 field public static final int EMBEDDED_BITMAP_TEXT_FLAG = 1024; // 0x400 field public static final int EMBEDDED_BITMAP_TEXT_FLAG = 1024; // 0x400 field public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN = 3; // 0x3 field public static final int END_HYPHEN_EDIT_INSERT_HYPHEN = 2; // 0x2 field public static final int END_HYPHEN_EDIT_INSERT_MAQAF = 4; // 0x4 field public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN = 5; // 0x5 field public static final int END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN = 6; // 0x6 field public static final int END_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 field public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN = 1; // 0x1 field public static final int FAKE_BOLD_TEXT_FLAG = 32; // 0x20 field public static final int FAKE_BOLD_TEXT_FLAG = 32; // 0x20 field public static final int FILTER_BITMAP_FLAG = 2; // 0x2 field public static final int FILTER_BITMAP_FLAG = 2; // 0x2 field public static final int HINTING_OFF = 0; // 0x0 field public static final int HINTING_OFF = 0; // 0x0 field public static final int HINTING_ON = 1; // 0x1 field public static final int HINTING_ON = 1; // 0x1 field public static final int LINEAR_TEXT_FLAG = 64; // 0x40 field public static final int LINEAR_TEXT_FLAG = 64; // 0x40 field public static final int START_HYPHEN_EDIT_INSERT_HYPHEN = 1; // 0x1 field public static final int START_HYPHEN_EDIT_INSERT_ZWJ = 2; // 0x2 field public static final int START_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10 field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10 field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80 field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80 field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8 field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8 Loading Loading @@ -15928,12 +15940,13 @@ package android.graphics.text { } } public static class LineBreaker.Result { public static class LineBreaker.Result { method public int getEndLineHyphenEdit(int); method @Px public float getLineAscent(@IntRange(from=0) int); method @Px public float getLineAscent(@IntRange(from=0) int); method @IntRange(from=0) public int getLineBreakOffset(@IntRange(from=0) int); method @IntRange(from=0) public int getLineBreakOffset(@IntRange(from=0) int); method @IntRange(from=0) public int getLineCount(); method @IntRange(from=0) public int getLineCount(); method @Px public float getLineDescent(@IntRange(from=0) int); method @Px public float getLineDescent(@IntRange(from=0) int); method public int getLineHyphenEdit(int); method @Px public float getLineWidth(@IntRange(from=0) int); method @Px public float getLineWidth(@IntRange(from=0) int); method public int getStartLineHyphenEdit(int); method public boolean hasLineTab(int); method public boolean hasLineTab(int); } } Loading Loading @@ -46004,22 +46017,6 @@ package android.text { method public void handleTag(boolean, String, android.text.Editable, org.xml.sax.XMLReader); method public void handleTag(boolean, String, android.text.Editable, org.xml.sax.XMLReader); } } public class Hyphenator { method public static int packHyphenEdit(int, int); method public static int unpackEndHyphenEdit(int); method public static int unpackStartHyphenEdit(int); field public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN = 3; // 0x3 field public static final int END_HYPHEN_EDIT_INSERT_HYPHEN = 2; // 0x2 field public static final int END_HYPHEN_EDIT_INSERT_MAQAF = 4; // 0x4 field public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN = 5; // 0x5 field public static final int END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN = 6; // 0x6 field public static final int END_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 field public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN = 1; // 0x1 field public static final int START_HYPHEN_EDIT_INSERT_HYPHEN = 1; // 0x1 field public static final int START_HYPHEN_EDIT_INSERT_ZWJ = 2; // 0x2 field public static final int START_HYPHEN_EDIT_NO_EDIT = 0; // 0x0 } public interface InputFilter { public interface InputFilter { method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int); } }
core/java/android/text/DynamicLayout.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -674,7 +674,8 @@ public class DynamicLayout extends Layout { objects[0] = reflowed.getLineDirections(i); objects[0] = reflowed.getLineDirections(i); final int end = (i == n - 1) ? where + after : reflowed.getLineStart(i + 1); final int end = (i == n - 1) ? where + after : reflowed.getLineStart(i + 1); ints[HYPHEN] = reflowed.getHyphen(i) & HYPHEN_MASK; ints[HYPHEN] = StaticLayout.packHyphenEdit( reflowed.getStartHyphenEdit(i), reflowed.getEndHyphenEdit(i)); ints[MAY_PROTRUDE_FROM_TOP_OR_BOTTOM] |= ints[MAY_PROTRUDE_FROM_TOP_OR_BOTTOM] |= contentMayProtrudeFromLineTopOrBottom(text, start, end) ? contentMayProtrudeFromLineTopOrBottom(text, start, end) ? MAY_PROTRUDE_FROM_TOP_OR_BOTTOM_MASK : 0; MAY_PROTRUDE_FROM_TOP_OR_BOTTOM_MASK : 0; Loading Loading @@ -1056,8 +1057,16 @@ public class DynamicLayout extends Layout { * @hide * @hide */ */ @Override @Override public int getHyphen(int line) { public @Paint.StartHyphenEdit int getStartHyphenEdit(int line) { return mInts.getValue(line, HYPHEN) & HYPHEN_MASK; return StaticLayout.unpackStartHyphenEdit(mInts.getValue(line, HYPHEN) & HYPHEN_MASK); } /** * @hide */ @Override public @Paint.EndHyphenEdit int getEndHyphenEdit(int line) { return StaticLayout.unpackEndHyphenEdit(mInts.getValue(line, HYPHEN) & HYPHEN_MASK); } } private boolean getContentMayProtrudeFromTopOrBottom(int line) { private boolean getContentMayProtrudeFromTopOrBottom(int line) { Loading
core/java/android/text/Hyphenator.java +3 −130 Original line number Original line Diff line number Diff line Loading @@ -16,142 +16,15 @@ package android.text; package android.text; import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** /** * Provides constants and pack/unpack methods for the HyphenEdit. * Does the native Hyphenator initialization. * * Hyphenator provides constant values for start of line and end of line modification. * For example, by passing {@link #END_HYPHEN_EDIT_INSERT_HYPHEN} like as follows, HYPHEN(U+2010) * character is appended at the end of line. * * <pre> * <code> * Paint paint = new Paint(); * paint.setHyphenEdit(Hyphenator.packHyphenEdit( * Hyphenator.START_HYPHEN_EDIT_NO_EDIT, * Hyphenator.END_HYPHEN_EDIT_INSERT_HYPHEN)); * paint.measureText("abc", 0, 3); // Returns the width of "abc‐" * Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "abc‐" * </code> * </pre> * * * @see android.graphics.Paint#setHyphenEdit(int) * @hide */ */ public class Hyphenator { public class Hyphenator { private Hyphenator() {} private Hyphenator() {} /** @hide */ // This method is called from Zygote. @IntDef(prefix = { "START_HYPHEN_EDIT_" }, value = { START_HYPHEN_EDIT_NO_EDIT, START_HYPHEN_EDIT_INSERT_HYPHEN, START_HYPHEN_EDIT_INSERT_ZWJ }) @Retention(RetentionPolicy.SOURCE) public @interface StartHyphenEdit {} /** * An integer representing the starting of the line has no modification for hyphenation. */ public static final int START_HYPHEN_EDIT_NO_EDIT = 0x00; /** * An integer representing the starting of the line has normal hyphen character (U+002D). */ public static final int START_HYPHEN_EDIT_INSERT_HYPHEN = 0x01; /** * An integer representing the starting of the line has Zero-Width-Joiner (U+200D). */ public static final int START_HYPHEN_EDIT_INSERT_ZWJ = 0x02; /** @hide */ @IntDef(prefix = { "END_HYPHEN_EDIT_" }, value = { END_HYPHEN_EDIT_NO_EDIT, END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN, END_HYPHEN_EDIT_INSERT_HYPHEN, END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN, END_HYPHEN_EDIT_INSERT_MAQAF, END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN, END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN }) @Retention(RetentionPolicy.SOURCE) public @interface EndHyphenEdit {} /** * An integer representing the end of the line has no modification for hyphenation. */ public static final int END_HYPHEN_EDIT_NO_EDIT = 0x00; /** * An integer representing the character at the end of the line is replaced with hyphen * character (U+002D). */ public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN = 0x01; /** * An integer representing the end of the line has normal hyphen character (U+002D). */ public static final int END_HYPHEN_EDIT_INSERT_HYPHEN = 0x02; /** * An integer representing the end of the line has Armentian hyphen (U+058A). */ public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN = 0x03; /** * An integer representing the end of the line has maqaf (Hebrew hyphen, U+05BE). */ public static final int END_HYPHEN_EDIT_INSERT_MAQAF = 0x04; /** * An integer representing the end of the line has Canadian Syllabics hyphen (U+1400). */ public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN = 0x05; /** * An integer representing the end of the line has Zero-Width-Joiner (U+200D) followed by normal * hyphen character (U+002D). */ public static final int END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN = 0x06; // Following three constants are used for packing start hyphen edit and end hyphen edit into // single integer. Following encodings must be the same as the minikin's one. // See frameworks/minikin/include/Hyphenator.h for more details. private static final int END_HYPHEN_EDIT_MASK = 0x07; // 0b00111 private static final int START_HYPHEN_EDIT_MASK = 0x18; // 0b11000 private static final int START_HYPHEN_EDIT_SHIFT = 0x03; /** * Extract start hyphen edit from packed value. */ public static @StartHyphenEdit int unpackStartHyphenEdit(int hyphenEdit) { return (hyphenEdit & START_HYPHEN_EDIT_MASK) >> START_HYPHEN_EDIT_SHIFT; } /** * Extract end hyphen edit from packed value. */ public static @EndHyphenEdit int unpackEndHyphenEdit(int hyphenEdit) { return hyphenEdit & END_HYPHEN_EDIT_MASK; } /** * Pack the start hyphen edit and end hyphen edit into single integer. */ public static int packHyphenEdit(@StartHyphenEdit int startHyphenEdit, @EndHyphenEdit int endHyphenEdit) { return ((startHyphenEdit << START_HYPHEN_EDIT_SHIFT) & START_HYPHEN_EDIT_MASK) | (endHyphenEdit & END_HYPHEN_EDIT_MASK); } /** * @hide */ public static void init() { public static void init() { nInit(); nInit(); } } Loading
core/java/android/text/Layout.java +18 −6 Original line number Original line Diff line number Diff line Loading @@ -437,7 +437,8 @@ public abstract class Layout { previousLineEnd = getLineStart(lineNum + 1); previousLineEnd = getLineStart(lineNum + 1); final boolean justify = isJustificationRequired(lineNum); final boolean justify = isJustificationRequired(lineNum); int end = getLineVisibleEnd(lineNum, start, previousLineEnd); int end = getLineVisibleEnd(lineNum, start, previousLineEnd); paint.setHyphenEdit(getHyphen(lineNum)); paint.setStartHyphenEdit(getStartHyphenEdit(lineNum)); paint.setEndHyphenEdit(getEndHyphenEdit(lineNum)); int ltop = previousLineBottom; int ltop = previousLineBottom; int lbottom = getLineTop(lineNum + 1); int lbottom = getLineTop(lineNum + 1); Loading Loading @@ -910,12 +911,21 @@ public abstract class Layout { public abstract int getBottomPadding(); public abstract int getBottomPadding(); /** /** * Returns the hyphen edit for a line. * Returns the start hyphen edit for a line. * * * @hide * @hide */ */ public int getHyphen(int line) { public @Paint.StartHyphenEdit int getStartHyphenEdit(int line) { return 0; return Paint.START_HYPHEN_EDIT_NO_EDIT; } /** * Returns the end hyphen edit for a line. * * @hide */ public @Paint.EndHyphenEdit int getEndHyphenEdit(int line) { return Paint.END_HYPHEN_EDIT_NO_EDIT; } } /** /** Loading Loading @@ -1418,7 +1428,8 @@ public abstract class Layout { final TextLine tl = TextLine.obtain(); final TextLine tl = TextLine.obtain(); final TextPaint paint = mWorkPaint; final TextPaint paint = mWorkPaint; paint.set(mPaint); paint.set(mPaint); paint.setHyphenEdit(getHyphen(line)); paint.setStartHyphenEdit(getStartHyphenEdit(line)); paint.setEndHyphenEdit(getEndHyphenEdit(line)); tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); if (isJustificationRequired(line)) { if (isJustificationRequired(line)) { Loading Loading @@ -1447,7 +1458,8 @@ public abstract class Layout { final TextLine tl = TextLine.obtain(); final TextLine tl = TextLine.obtain(); final TextPaint paint = mWorkPaint; final TextPaint paint = mWorkPaint; paint.set(mPaint); paint.set(mPaint); paint.setHyphenEdit(getHyphen(line)); paint.setStartHyphenEdit(getStartHyphenEdit(line)); paint.setEndHyphenEdit(getEndHyphenEdit(line)); tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, tl.set(paint, mText, start, end, dir, directions, hasTabs, tabStops, getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); getEllipsisStart(line), getEllipsisStart(line) + getEllipsisCount(line)); if (isJustificationRequired(line)) { if (isJustificationRequired(line)) { Loading
core/java/android/text/StaticLayout.java +34 −8 Original line number Original line Diff line number Diff line Loading @@ -779,7 +779,8 @@ public class StaticLayout extends Layout { ascents[i] = res.getLineAscent(i); ascents[i] = res.getLineAscent(i); descents[i] = res.getLineDescent(i); descents[i] = res.getLineDescent(i); hasTabs[i] = res.hasLineTab(i); hasTabs[i] = res.hasLineTab(i); hyphenEdits[i] = res.getLineHyphenEdit(i); hyphenEdits[i] = packHyphenEdit(res.getStartLineHyphenEdit(i), res.getEndLineHyphenEdit(i)); } } final int remainingLineCount = mMaximumVisibleLineCount - mLineCount; final int remainingLineCount = mMaximumVisibleLineCount - mLineCount; Loading Loading @@ -1258,20 +1259,42 @@ public class StaticLayout extends Layout { return mBottomPadding; return mBottomPadding; } } // To store into single int field, pack the pair of start and end hyphen edit. static int packHyphenEdit( @Paint.StartHyphenEdit int start, @Paint.EndHyphenEdit int end) { return start << START_HYPHEN_BITS_SHIFT | end; } static int unpackStartHyphenEdit(int packedHyphenEdit) { return (packedHyphenEdit & START_HYPHEN_MASK) >> START_HYPHEN_BITS_SHIFT; } static int unpackEndHyphenEdit(int packedHyphenEdit) { return packedHyphenEdit & END_HYPHEN_MASK; } /** /** * Returns the packed hyphen edit value for this line. * Returns the start hyphen edit value for this line. * * * You can extract start hyphen edit and end hyphen edit by using * @param lineNumber a line number * {@link Hyphenator#unpackStartHyphenEdit(int)} and * @return A start hyphen edit value. * {@link Hyphenator#unpackEndHyphenEdit(int)}. * @hide */ @Override public @Paint.StartHyphenEdit int getStartHyphenEdit(int lineNumber) { return unpackStartHyphenEdit(mLines[mColumns * lineNumber + HYPHEN] & HYPHEN_MASK); } /** * Returns the packed hyphen edit value for this line. * * * @param lineNumber a line number * @param lineNumber a line number * @return A packed hyphen edit value. * @return An end hyphen edit value. * @hide * @hide */ */ @Override @Override public int getHyphen(int lineNumber) { public @Paint.EndHyphenEdit int getEndHyphenEdit(int lineNumber) { return mLines[mColumns * lineNumber + HYPHEN] & HYPHEN_MASK; return unpackEndHyphenEdit(mLines[mColumns * lineNumber + HYPHEN] & HYPHEN_MASK); } } /** /** Loading Loading @@ -1395,6 +1418,9 @@ public class StaticLayout extends Layout { private static final int DIR_SHIFT = 30; private static final int DIR_SHIFT = 30; private static final int TAB_MASK = 0x20000000; private static final int TAB_MASK = 0x20000000; private static final int HYPHEN_MASK = 0xFF; private static final int HYPHEN_MASK = 0xFF; private static final int START_HYPHEN_BITS_SHIFT = 3; private static final int START_HYPHEN_MASK = 0x18; // 0b11000 private static final int END_HYPHEN_MASK = 0x7; // 0b00111 private static final int TAB_INCREMENT = 20; // same as Layout, but that's private private static final int TAB_INCREMENT = 20; // same as Layout, but that's private Loading