【问题标题】:Determining in Java whether a particular font can render a particular character在 Java 中确定特定字体是否可以呈现特定字符
【发布时间】:2011-09-26 22:51:42
【问题描述】:

Java 中有没有办法确定特定字体是否可以呈现特定字符?

【问题讨论】:

    标签: java unicode fonts character


    【解决方案1】:

    试试

    Font f = ... ; // you have your font
    Character c = 'ن'; // Nun, N, in Farsi
    
    if(!f.canDisplay(c)) {
        int gcode = f.getMissingGlyphCode();
        System.out.format("not supported.  Glyph code used: %d\n", gcode);
    }
    

    【讨论】:

    • 针对 JDK Korean + Windows 错误测试了这个,它似乎有效! Font f = new JLabel("").getFont(); System.out.println(f.canDisplay('한')); // correctly shows "false"
    猜你喜欢
    • 2011-02-10
    • 1970-01-01
    • 2018-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-29
    • 1970-01-01
    相关资源
    最近更新 更多