sun.font.CharToGlyphMapper Java Examples

The following examples show how to use sun.font.CharToGlyphMapper. 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: PathGraphics.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #2
Source File: PathGraphics.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #3
Source File: PathGraphics.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #4
Source File: PathGraphics.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #5
Source File: PathGraphics.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #6
Source File: PathGraphics.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #7
Source File: PathGraphics.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #8
Source File: PathGraphics.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #9
Source File: PathGraphics.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #10
Source File: PathGraphics.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #11
Source File: PathGraphics.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #12
Source File: PathGraphics.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #13
Source File: PathGraphics.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
 
Example #14
Source File: PathGraphics.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static char[] getGlyphToCharMapForFont(Font2D font2D) {
    /* NB Composites report the number of glyphs in slot 0.
     * So if a string uses a char from a later slot, or a fallback slot,
     * it will not be able to use this faster path.
     */
    int numGlyphs = font2D.getNumGlyphs();
    int missingGlyph = font2D.getMissingGlyphCode();
    char[] glyphToCharMap = new char[numGlyphs];
    int glyph;

    for (int i=0;i<numGlyphs; i++) {
        glyphToCharMap[i] = CharToGlyphMapper.INVISIBLE_GLYPH_ID;
    }

    /* Consider refining the ranges to try to map by asking the font
     * what ranges it supports.
     * Since a glyph may be mapped by multiple code points, and this
     * code can't handle that, we always prefer the earlier code point.
     */
    for (char c=0; c<0xFFFF; c++) {
       if (c >= CharToGlyphMapper.HI_SURROGATE_START &&
           c <= CharToGlyphMapper.LO_SURROGATE_END) {
            continue;
        }
        glyph = font2D.charToGlyph(c);
        if (glyph != missingGlyph &&
            glyph >= 0 && glyph < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}