类java.awt.font.GlyphJustificationInfo源码实例Demo

下面列出了怎么用java.awt.font.GlyphJustificationInfo的API类实例代码及写法,或者点击链接到github查看源代码。

@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);
}
 
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));
}
 
源代码3 项目: jdk8u-dev-jdk   文件: StandardGlyphVector.java
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;
}
 
源代码4 项目: dragonwell8_jdk   文件: StandardGlyphVector.java
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;
}
 
源代码5 项目: TencentKona-8   文件: StandardGlyphVector.java
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;
}
 
源代码6 项目: openjdk-jdk8u   文件: StandardGlyphVector.java
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;
}
 
源代码7 项目: Bytecoder   文件: StandardGlyphVector.java
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;
}
 
源代码8 项目: jdk8u-jdk   文件: StandardGlyphVector.java
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;
}
 
源代码9 项目: jdk8u-jdk   文件: StandardGlyphVector.java
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;
}
 
源代码10 项目: hottub   文件: StandardGlyphVector.java
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;
}
 
源代码11 项目: openjdk-8-source   文件: StandardGlyphVector.java
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;
}
 
源代码12 项目: openjdk-8   文件: StandardGlyphVector.java
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;
}
 
@Override
public SerializationWrapper<?> filter(Object object) {
	if (object instanceof GlyphJustificationInfo) {
		GlyphJustificationInfo gji = (GlyphJustificationInfo) object;
		return new GlyphJustificationInfoSerializationWrapper(gji);
	}
	return null;
}
 
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);
}
 
@Override
public GlyphJustificationInfo getGlyphJustificationInfo(
		int glyphIndex) {
	if (glyphs[glyphIndex].justificationInfo == null)
		return null;
	return glyphs[glyphIndex].justificationInfo.create();
}
 
源代码16 项目: jdk8u_jdk   文件: StandardGlyphVector.java
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;
}
 
源代码17 项目: TencentKona-8   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码18 项目: jdk8u60   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码19 项目: openjdk-jdk8u   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码20 项目: openjdk-jdk9   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码21 项目: jdk8u-jdk   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码22 项目: jdk8u-jdk   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码23 项目: openjdk-8-source   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码24 项目: openjdk-8   文件: ExtendedTextSourceLabel.java
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;
  }
}
 
源代码25 项目: consulo   文件: AbstractMockGlyphVector.java
@Override
public GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex) {
  throw new UnsupportedOperationException();
}
 
源代码26 项目: jdk1.8-source-analysis   文件: GlyphVector.java
/**
 * 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);
 
源代码27 项目: dragonwell8_jdk   文件: GlyphVector.java
/**
 * 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);
 
源代码28 项目: dragonwell8_jdk   文件: GraphicComponent.java
/**
 * 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) {
}
 
源代码29 项目: dragonwell8_jdk   文件: ExtendedTextLabel.java
/**
 * 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);
 
源代码30 项目: dragonwell8_jdk   文件: TextLineComponent.java
/**
 * 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);
 
 类所在包
 同包方法