Java 类sun.font.CharToGlyphMapper 实例源码

项目:OpenJSharp    文件:PathGraphics.java   
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;
}
项目:jdk8u-jdk    文件:PathGraphics.java   
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;
}
项目:openjdk-jdk10    文件:PathGraphics.java   
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;
}
项目:openjdk9    文件:PathGraphics.java   
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;
}
项目:jdk8u_jdk    文件:PathGraphics.java   
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;
}
项目:lookaside_java-1.8.0-openjdk    文件:PathGraphics.java   
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;
}
项目:infobip-open-jdk-8    文件:PathGraphics.java   
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;
}
项目:jdk8u-dev-jdk    文件:PathGraphics.java   
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;
}
项目:jdk7-jdk    文件:PathGraphics.java   
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 < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
项目:openjdk-source-code-learn    文件:PathGraphics.java   
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 < numGlyphs &&
            (glyphToCharMap[glyph] ==
             CharToGlyphMapper.INVISIBLE_GLYPH_ID)) {
            glyphToCharMap[glyph] = c;
        }
    }
    return glyphToCharMap;
}
项目:OLD-OpenJDK8    文件:PathGraphics.java   
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;
}
项目:openjdk-jdk7u-jdk    文件:PathGraphics.java   
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;
}
项目:openjdk-icedtea7    文件:PathGraphics.java   
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;
}