sun.awt.FontDescriptor Java Examples

The following examples show how to use sun.awt.FontDescriptor. 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: WFontConfiguration.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #2
Source File: WFontConfiguration.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #3
Source File: FcFontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #4
Source File: WFontConfiguration.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #5
Source File: WFontConfiguration.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #6
Source File: FcFontConfiguration.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #7
Source File: WFontConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #8
Source File: WFontConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #9
Source File: WFontConfiguration.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #10
Source File: WFontConfiguration.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #11
Source File: WFontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #12
Source File: WFontConfiguration.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #13
Source File: FcFontConfiguration.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #14
Source File: WFontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #15
Source File: WFontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #16
Source File: FcFontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #17
Source File: WFontConfiguration.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #18
Source File: WFontConfiguration.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #19
Source File: FcFontConfiguration.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #20
Source File: WFontConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #21
Source File: WFontConfiguration.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #22
Source File: FcFontConfiguration.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #23
Source File: WFontConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #24
Source File: WFontConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #25
Source File: FcFontConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #26
Source File: WFontConfiguration.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #27
Source File: WFontConfiguration.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}
 
Example #28
Source File: FcFontConfiguration.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
    CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
    int idx = fontIndex * NUM_STYLES + styleIndex;
    String[] componentFaceNames = cfi[idx].getComponentFaceNames();
    FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
    for (int i = 0; i < componentFaceNames.length; i++) {
        ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.ISO_8859_1.newEncoder(), new int[0]);
    }

    return ret;
}
 
Example #29
Source File: WFontConfiguration.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the component font name (face name plus charset) of the
 * font that should be used for AWT text components. May return null.
 */
public String getTextComponentFontName(String familyName, int style) {
    FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style);
    String fontName = findFontWithCharset(fontDescriptors, textInputCharset);
    if (fontName == null) {
        fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET");
    }
    return fontName;
}
 
Example #30
Source File: WFontConfiguration.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private String findFontWithCharset(FontDescriptor[] fontDescriptors, String charset) {
    String fontName = null;
    for (int i = 0; i < fontDescriptors.length; i++) {
        String componentFontName = fontDescriptors[i].getNativeName();
        if (componentFontName.endsWith(charset)) {
            fontName = componentFontName;
        }
    }
    return fontName;
}