SwtMisc.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:durian-swt 作者:
/** Populates the height and width of the system font. */
private static void populateSystemFont() {
    // create a tiny image to bind our GC to (not that it can't be size 0)
    Image dummyImg = new Image(assertUI(), 1, 1);
    GC gc = new GC(dummyImg);

    FontMetrics metrics = gc.getFontMetrics();
    systemFontHeight = metrics.getHeight();
    systemFontWidth = metrics.getAverageCharWidth();
    if (OS.getNative().isMac()) {
        // add 20% width on Mac
        systemFontWidth = (systemFontWidth * 12) / 10;
    }

    gc.dispose();
    dummyImg.dispose();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号