Loading core/java/android/text/TextLine.java +16 −6 Original line number Diff line number Diff line Loading @@ -852,6 +852,18 @@ class TextLine { return runIsRtl ? -ret : ret; } private int adjustHyphenEdit(int start, int limit, int hyphenEdit) { int result = hyphenEdit; // Only draw hyphens on first or last run in line. Disable them otherwise. if (start > 0) { // not the first run result &= ~Paint.HYPHENEDIT_MASK_START_OF_LINE; } if (limit < mLen) { // not the last run result &= ~Paint.HYPHENEDIT_MASK_END_OF_LINE; } return result; } /** * Utility function for handling a unidirectional run. The run must not * contain tabs but can contain styles. Loading Loading @@ -893,9 +905,9 @@ class TextLine { if (mSpanned == null) { TextPaint wp = mWorkPaint; wp.set(mPaint); final int mlimit = measureLimit; wp.setHyphenEdit(adjustHyphenEdit(start, limit, wp.getHyphenEdit())); return handleText(wp, start, limit, start, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth || mlimit < measureLimit, mlimit); y, bottom, fmi, needWidth, measureLimit); } mMetricAffectingSpanSpanSet.init(mSpanned, mStart + start, mStart + limit); Loading Loading @@ -953,10 +965,8 @@ class TextLine { span.updateDrawState(wp); } // Only draw hyphen on last run in line if (jnext < mLen) { wp.setHyphenEdit(0); } wp.setHyphenEdit(adjustHyphenEdit(j, jnext, wp.getHyphenEdit())); x += handleText(wp, j, jnext, i, inext, runIsRtl, c, x, top, y, bottom, fmi, needWidth || jnext < measureLimit, offset); } Loading graphics/java/android/graphics/Paint.java +16 −1 Original line number Diff line number Diff line Loading @@ -339,6 +339,20 @@ public class Paint { */ private static final int CURSOR_OPT_MAX_VALUE = CURSOR_AT; /** * Mask for hyphen edits that happen at the end of a line. Keep in sync with the definition in * Minikin's Hyphenator.h. * @hide */ public static final int HYPHENEDIT_MASK_END_OF_LINE = 0x07; /** * Mask for hyphen edits that happen at the start of a line. Keep in sync with the definition in * Minikin's Hyphenator.h. * @hide */ public static final int HYPHENEDIT_MASK_START_OF_LINE = 0x03 << 3; /** * The Style specifies if the primitive being drawn is filled, stroked, or * both (in the same color). The default is FILL. Loading Loading @@ -1540,7 +1554,8 @@ public class Paint { * Set a hyphen edit on the paint (causes a hyphen to be added to text when * measured or drawn). * * @param hyphen 0 for no edit, 1 for adding a hyphen (other values in future) * @param hyphen 0 for no edit, 1 for adding a hyphen at the end, etc. * Definition of various values are in the HyphenEdit class in Minikin's Hyphenator.h. * * @hide */ Loading libs/hwui/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,7 @@ hwui_c_includes += \ external/skia/src/effects \ external/skia/src/image \ external/skia/src/utils \ external/icu/icu4c/source/common \ external/harfbuzz_ng/src \ external/freetype/include Loading Loading
core/java/android/text/TextLine.java +16 −6 Original line number Diff line number Diff line Loading @@ -852,6 +852,18 @@ class TextLine { return runIsRtl ? -ret : ret; } private int adjustHyphenEdit(int start, int limit, int hyphenEdit) { int result = hyphenEdit; // Only draw hyphens on first or last run in line. Disable them otherwise. if (start > 0) { // not the first run result &= ~Paint.HYPHENEDIT_MASK_START_OF_LINE; } if (limit < mLen) { // not the last run result &= ~Paint.HYPHENEDIT_MASK_END_OF_LINE; } return result; } /** * Utility function for handling a unidirectional run. The run must not * contain tabs but can contain styles. Loading Loading @@ -893,9 +905,9 @@ class TextLine { if (mSpanned == null) { TextPaint wp = mWorkPaint; wp.set(mPaint); final int mlimit = measureLimit; wp.setHyphenEdit(adjustHyphenEdit(start, limit, wp.getHyphenEdit())); return handleText(wp, start, limit, start, limit, runIsRtl, c, x, top, y, bottom, fmi, needWidth || mlimit < measureLimit, mlimit); y, bottom, fmi, needWidth, measureLimit); } mMetricAffectingSpanSpanSet.init(mSpanned, mStart + start, mStart + limit); Loading Loading @@ -953,10 +965,8 @@ class TextLine { span.updateDrawState(wp); } // Only draw hyphen on last run in line if (jnext < mLen) { wp.setHyphenEdit(0); } wp.setHyphenEdit(adjustHyphenEdit(j, jnext, wp.getHyphenEdit())); x += handleText(wp, j, jnext, i, inext, runIsRtl, c, x, top, y, bottom, fmi, needWidth || jnext < measureLimit, offset); } Loading
graphics/java/android/graphics/Paint.java +16 −1 Original line number Diff line number Diff line Loading @@ -339,6 +339,20 @@ public class Paint { */ private static final int CURSOR_OPT_MAX_VALUE = CURSOR_AT; /** * Mask for hyphen edits that happen at the end of a line. Keep in sync with the definition in * Minikin's Hyphenator.h. * @hide */ public static final int HYPHENEDIT_MASK_END_OF_LINE = 0x07; /** * Mask for hyphen edits that happen at the start of a line. Keep in sync with the definition in * Minikin's Hyphenator.h. * @hide */ public static final int HYPHENEDIT_MASK_START_OF_LINE = 0x03 << 3; /** * The Style specifies if the primitive being drawn is filled, stroked, or * both (in the same color). The default is FILL. Loading Loading @@ -1540,7 +1554,8 @@ public class Paint { * Set a hyphen edit on the paint (causes a hyphen to be added to text when * measured or drawn). * * @param hyphen 0 for no edit, 1 for adding a hyphen (other values in future) * @param hyphen 0 for no edit, 1 for adding a hyphen at the end, etc. * Definition of various values are in the HyphenEdit class in Minikin's Hyphenator.h. * * @hide */ Loading
libs/hwui/Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -187,6 +187,7 @@ hwui_c_includes += \ external/skia/src/effects \ external/skia/src/image \ external/skia/src/utils \ external/icu/icu4c/source/common \ external/harfbuzz_ng/src \ external/freetype/include Loading