Java Code Examples for java.awt.font.GlyphJustificationInfo#PRIORITY_NONE

The following examples show how to use java.awt.font.GlyphJustificationInfo#PRIORITY_NONE . 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: ExtendedTextSourceLabel.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
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 2
Source File: ExtendedTextSourceLabel.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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 3
Source File: ExtendedTextSourceLabel.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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 4
Source File: ExtendedTextSourceLabel.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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 5
Source File: ExtendedTextSourceLabel.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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 6
Source File: ExtendedTextSourceLabel.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
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 7
Source File: ExtendedTextSourceLabel.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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 8
Source File: ExtendedTextSourceLabel.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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 9
Source File: ExtendedTextSourceLabel.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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 10
Source File: ExtendedTextSourceLabel.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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 11
Source File: ExtendedTextSourceLabel.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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 12
Source File: ExtendedTextSourceLabel.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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 13
Source File: ExtendedTextSourceLabel.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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 14
Source File: ExtendedTextSourceLabel.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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;
  }
}