sun.font.FontAccess Java Examples

The following examples show how to use sun.font.FontAccess. 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: X11FontManager.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #2
Source File: X11FontManager.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #3
Source File: X11FontManager.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #4
Source File: X11FontManager.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #5
Source File: X11FontManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #6
Source File: X11FontManager.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #7
Source File: X11FontManager.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #8
Source File: X11FontManager.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #9
Source File: X11FontManager.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #10
Source File: X11FontManager.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #11
Source File: X11FontManager.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #12
Source File: X11FontManager.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #13
Source File: X11FontManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {

    CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);

    if (font2D == null) { // Not expected, just a precaution.
       return new FontUIResource(family, style, size);
    }

    /* The name of the font will be that of the physical font in slot,
     * but by setting the handle to that of the CompositeFont it
     * renders as that CompositeFont.
     * It also needs to be marked as a created font which is the
     * current mechanism to signal that deriveFont etc must copy
     * the handle from the original font.
     */
    FontUIResource fuir =
        new FontUIResource(font2D.getFamilyName(null), style, size);
    FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
    FontAccess.getFontAccess().setCreatedFont(fuir);
    return fuir;
}
 
Example #14
Source File: PSPrinterJob.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
                                                 .getFontPeer(font);
    CharsetString[] acs = peer.makeMultiCharsetString(str, false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
Example #15
Source File: PSPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
                                                 .getFontPeer(font);
    CharsetString[] acs = peer.makeMultiCharsetString(str, false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}