java.awt.font.GlyphJustificationInfo Java Examples
The following examples show how to use
java.awt.font.GlyphJustificationInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlyphJustificationInfoSerializationWrapper.java From pumpernickel with MIT License | 6 votes |
@Override public GlyphJustificationInfo create() { float weight = ((Number) map.get(KEY_WEIGHT)).floatValue(); boolean growAbsorb = (Boolean) map.get(KEY_GROW_ABSORB); int growPriority = ((Number) map.get(KEY_GROW_PRIORITY)).intValue(); float growLeftLimit = ((Number) map.get(KEY_GROW_LEFT_LIMIT)) .floatValue(); float growRightLimit = ((Number) map.get(KEY_GROW_RIGHT_LIMIT)) .floatValue(); boolean shrinkAbsorb = (Boolean) map.get(KEY_SHRINK_ABSORB); int shrinkPriority = ((Number) map.get(KEY_SHRINK_PRIORITY)).intValue(); float shrinkLeftLimit = ((Number) map.get(KEY_SHRINK_LEFT_LIMIT)) .floatValue(); float shrinkRightLimit = ((Number) map.get(KEY_SHRINK_RIGHT_LIMIT)) .floatValue(); return new GlyphJustificationInfo(weight, growAbsorb, growPriority, growLeftLimit, growRightLimit, shrinkAbsorb, shrinkPriority, shrinkLeftLimit, shrinkRightLimit); }
Example #2
Source File: GlyphVectorSerializationWrapper.java From pumpernickel with MIT License | 6 votes |
public GlyphElement(GlyphVector gv, int index) { glyphCode = gv.getGlyphCode(index); transform = gv.getGlyphTransform(index); outline = new ShapeSerializationWrapper(gv.getGlyphOutline(index)); position = new Point2DSerializationWrapper( gv.getGlyphPosition(index)); logicalBounds = new ShapeSerializationWrapper( gv.getGlyphLogicalBounds(index)); GlyphJustificationInfo gji = gv.getGlyphJustificationInfo(index); justificationInfo = gji == null ? null : new GlyphJustificationInfoSerializationWrapper(gji); glyphMetrics = new GlyphMetricsSerializationWrapper( gv.getGlyphMetrics(index)); visualBounds = new ShapeSerializationWrapper( gv.getGlyphVisualBounds(index)); }
Example #3
Source File: StandardGlyphVector.java From hottub with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #4
Source File: StandardGlyphVector.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #5
Source File: StandardGlyphVector.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #6
Source File: StandardGlyphVector.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #7
Source File: GlyphJustificationInfoSerializationWrapper.java From pumpernickel with MIT License | 5 votes |
@Override public SerializationWrapper<?> filter(Object object) { if (object instanceof GlyphJustificationInfo) { GlyphJustificationInfo gji = (GlyphJustificationInfo) object; return new GlyphJustificationInfoSerializationWrapper(gji); } return null; }
Example #8
Source File: GlyphJustificationInfoSerializationWrapper.java From pumpernickel with MIT License | 5 votes |
public GlyphJustificationInfoSerializationWrapper( GlyphJustificationInfo gji) { map.put(KEY_WEIGHT, gji.weight); map.put(KEY_GROW_ABSORB, gji.growAbsorb); map.put(KEY_GROW_PRIORITY, gji.growPriority); map.put(KEY_GROW_LEFT_LIMIT, gji.growLeftLimit); map.put(KEY_GROW_RIGHT_LIMIT, gji.growRightLimit); map.put(KEY_SHRINK_ABSORB, gji.shrinkAbsorb); map.put(KEY_SHRINK_PRIORITY, gji.shrinkPriority); map.put(KEY_SHRINK_LEFT_LIMIT, gji.shrinkLeftLimit); map.put(KEY_SHRINK_RIGHT_LIMIT, gji.shrinkRightLimit); }
Example #9
Source File: StandardGlyphVector.java From Bytecoder with Apache License 2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #10
Source File: GlyphVectorSerializationWrapper.java From pumpernickel with MIT License | 5 votes |
@Override public GlyphJustificationInfo getGlyphJustificationInfo( int glyphIndex) { if (glyphs[glyphIndex].justificationInfo == null) return null; return glyphs[glyphIndex].justificationInfo.create(); }
Example #11
Source File: StandardGlyphVector.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #12
Source File: StandardGlyphVector.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #13
Source File: StandardGlyphVector.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #14
Source File: StandardGlyphVector.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #15
Source File: StandardGlyphVector.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #16
Source File: StandardGlyphVector.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public GlyphJustificationInfo getGlyphJustificationInfo(int ix) { if (ix < 0 || ix >= glyphs.length) { throw new IndexOutOfBoundsException("ix = " + ix); } // currently we don't have enough information to do this right. should // get info from the font and use real OT/GX justification. Right now // sun/font/ExtendedTextSourceLabel assigns one of three infos // based on whether the char is kanji, space, or other. return null; }
Example #17
Source File: ExtendedTextSourceLabel.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #18
Source File: ExtendedTextSourceLabel.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #19
Source File: ExtendedTextSourceLabel.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #20
Source File: AbstractMockGlyphVector.java From consulo with Apache License 2.0 | 4 votes |
@Override public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex) { throw new UnsupportedOperationException(); }
Example #21
Source File: ExtendedTextSourceLabel.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #22
Source File: ExtendedTextSourceLabel.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #23
Source File: ExtendedTextSourceLabel.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #24
Source File: ExtendedTextSourceLabel.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #25
Source File: ExtendedTextSourceLabel.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { // This simple implementation only uses spaces for justification. // Since regular characters aren't justified, we don't need to deal with // special infos for combining marks or ligature substitution glyphs. // added character justification for kanjii only 2/22/98 StandardGlyphVector gv = getGV(); float[] charinfo = getCharinfo(); float size = gv.getFont().getSize2D(); GlyphJustificationInfo nullInfo = new GlyphJustificationInfo(0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); GlyphJustificationInfo spaceInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size, true, GlyphJustificationInfo.PRIORITY_WHITESPACE, 0, size / 4f); GlyphJustificationInfo kanjiInfo = new GlyphJustificationInfo(size, true, GlyphJustificationInfo.PRIORITY_INTERCHAR, size, size, false, GlyphJustificationInfo.PRIORITY_NONE, 0, 0); char[] chars = source.getChars(); int offset = source.getStart(); // assume data is 1-1 and either all rtl or all ltr, for now int numGlyphs = gv.getNumGlyphs(); int minGlyph = 0; int maxGlyph = numGlyphs; boolean ltr = (source.getLayoutFlags() & 0x1) == 0; if (charStart != 0 || charLimit != source.getLength()) { if (ltr) { minGlyph = charStart; maxGlyph = charLimit; } else { minGlyph = numGlyphs - charLimit; maxGlyph = numGlyphs - charStart; } } for (int i = 0; i < numGlyphs; ++i) { GlyphJustificationInfo info = null; if (i >= minGlyph && i < maxGlyph) { if (charinfo[i * numvals + advx] == 0) { // combining marks don't justify info = nullInfo; } else { int ci = v2l(i); // 1-1 assumption again char c = chars[offset + ci]; if (Character.isWhitespace(c)) { info = spaceInfo; // CJK, Hangul, CJK Compatibility areas } else if (c >= 0x4e00 && (c < 0xa000) || (c >= 0xac00 && c < 0xd7b0) || (c >= 0xf900 && c < 0xfb00)) { info = kanjiInfo; } else { info = nullInfo; } } } infos[infoStart + i] = info; } }
Example #26
Source File: ExtendedTextLabel.java From jdk8u_jdk with GNU General Public License v2.0 | 2 votes |
/** * Return GlyphJustificationInfo objects for the characters between * charStart and charLimit, starting at offset infoStart. Infos * will be in visual order. All positions between infoStart and * getNumJustificationInfos will be set. If a position corresponds * to a character outside the provided range, it is set to null. */ public abstract void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit);
Example #27
Source File: GlyphVector.java From jdk-1.7-annotated with Apache License 2.0 | 2 votes |
/** * Returns the justification information for the glyph at * the specified index into this <code>GlyphVector</code>. * @param glyphIndex the index into this <code>GlyphVector</code> * that corresponds to the glyph from which to retrieve its * justification properties * @return a {@link GlyphJustificationInfo} object that * represents the justification properties of the glyph at the * specified <code>glyphIndex</code> into this * <code>GlyphVector</code>. * @throws IndexOutOfBoundsException if <code>glyphIndex</code> * is less than 0 or greater than or equal to the number * of glyphs in this <code>GlyphVector</code> */ public abstract GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex);
Example #28
Source File: GlyphVector.java From jdk8u_jdk with GNU General Public License v2.0 | 2 votes |
/** * Returns the justification information for the glyph at * the specified index into this <code>GlyphVector</code>. * @param glyphIndex the index into this <code>GlyphVector</code> * that corresponds to the glyph from which to retrieve its * justification properties * @return a {@link GlyphJustificationInfo} object that * represents the justification properties of the glyph at the * specified <code>glyphIndex</code> into this * <code>GlyphVector</code>. * @throws IndexOutOfBoundsException if <code>glyphIndex</code> * is less than 0 or greater than or equal to the number * of glyphs in this <code>GlyphVector</code> */ public abstract GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex);
Example #29
Source File: GraphicComponent.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * Return GlyphJustificationInfo objects for the characters between * charStart and charLimit, starting at offset infoStart. Infos * will be in visual order. All positions between infoStart and * getNumJustificationInfos will be set. If a position corresponds * to a character outside the provided range, it is set to null. */ public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit) { }
Example #30
Source File: TextLineComponent.java From jdk8u_jdk with GNU General Public License v2.0 | 2 votes |
/** * Return GlyphJustificationInfo objects for the characters between * charStart and charLimit, starting at offset infoStart. Infos * will be in visual order. All positions between infoStart and * getNumJustificationInfos will be set. If a position corresponds * to a character outside the provided range, it is set to null. */ public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit);