當前位置: 首頁>>代碼示例>>Java>>正文


Java Font.dispose方法代碼示例

本文整理匯總了Java中org.eclipse.swt.graphics.Font.dispose方法的典型用法代碼示例。如果您正苦於以下問題:Java Font.dispose方法的具體用法?Java Font.dispose怎麽用?Java Font.dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.graphics.Font的用法示例。


在下文中一共展示了Font.dispose方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dispose

import org.eclipse.swt.graphics.Font; //導入方法依賴的package包/類
@Override
public void dispose() {
	super.dispose();
	if (null != boldFontSupplier) {
		final Font font = boldFontSupplier.get();
		if (null != font && !font.isDisposed()) {
			font.dispose();
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:11,代碼來源:OpenTypeSelectionDialog.java

示例2: dispose

import org.eclipse.swt.graphics.Font; //導入方法依賴的package包/類
@Override
public void dispose ()
{
    for ( final Font font : this.fontCache.values () )
    {
        font.dispose ();
    }
    this.fontCache.clear ();

    super.dispose ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:12,代碼來源:TitleRenderer.java

示例3: swapFont

import org.eclipse.swt.graphics.Font; //導入方法依賴的package包/類
private Font swapFont(Font old, Font newFont) {
    if (old == newFont)
        logger.error("font swap error.");

    if (isset(old))
        old.dispose();
    return newFont;
}
 
開發者ID:openaudible,項目名稱:openaudible,代碼行數:9,代碼來源:FontShop.java

示例4: toAwtFont

import org.eclipse.swt.graphics.Font; //導入方法依賴的package包/類
/**
 * Create an awt font by converting as much information 
 * as possible from the provided swt <code>FontData</code>.
 * <p>Generally speaking, given a font size, an swt font will 
 * display differently on the screen than the corresponding awt 
 * one. Because the SWT toolkit use native graphical ressources whenever 
 * it is possible, this fact is plateform dependent. To address 
 * this issue, it is possible to enforce the method to return 
 * an awt font with the same height as the swt one.
 * 
 * @param device The swt device being drawn on (display or gc device).
 * @param fontData The swt font to convert.
 * @param ensureSameSize A boolean used to enforce the same size 
 * (in pixels) between the swt font and the newly created awt font.
 * @return An awt font converted from the provided swt font.
 */
public static java.awt.Font toAwtFont(Device device, FontData fontData, 
        boolean ensureSameSize) {
    int style;
    switch (fontData.getStyle()) {
        case SWT.NORMAL:
            style = java.awt.Font.PLAIN;
            break;
        case SWT.ITALIC:
            style = java.awt.Font.ITALIC;
            break;
        case SWT.BOLD:
            style = java.awt.Font.BOLD;
            break;
        default:
            style = java.awt.Font.PLAIN;
            break;
    }
    int height = (int) Math.round(fontData.getHeight() * device.getDPI().y 
            / 72.0);
    // hack to ensure the newly created awt fonts will be rendered with the
    // same height as the swt one
    if (ensureSameSize) {
        GC tmpGC = new GC(device);
        Font tmpFont = new Font(device, fontData);
        tmpGC.setFont(tmpFont);
        JPanel DUMMY_PANEL = new JPanel();
        java.awt.Font tmpAwtFont = new java.awt.Font(fontData.getName(), 
                style, height);
        if (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                > tmpGC.textExtent(Az).x) {
            while (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                    > tmpGC.textExtent(Az).x) {
                height--;                
                tmpAwtFont = new java.awt.Font(fontData.getName(), style, 
                        height);
            }
        }
        else if (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                < tmpGC.textExtent(Az).x) {
            while (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                    < tmpGC.textExtent(Az).x) {
                height++;
                tmpAwtFont = new java.awt.Font(fontData.getName(), style, 
                        height);
            }
        }
        tmpFont.dispose();
        tmpGC.dispose();
    }
    return new java.awt.Font(fontData.getName(), style, height);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:68,代碼來源:SWTUtils.java

示例5: getFont

import org.eclipse.swt.graphics.Font; //導入方法依賴的package包/類
/**
 * 
 */
public static Font getFont(Class<?> clazz, String key, Supplier<Font> font) {
	Font r = FONTS.get(clazz, key); if(r != null) return r;
	Font existing = FONTS.putIfAbsent(clazz, key, r = font.get());
	if (existing != null) { r.dispose(); r = existing; } return r; // Dispose
}
 
開發者ID:nextopcn,項目名稱:xcalendar,代碼行數:9,代碼來源:Fonts.java

示例6: dispose

import org.eclipse.swt.graphics.Font; //導入方法依賴的package包/類
public static void dispose() {
	for(Font f : instances.values())
		f.dispose();
}
 
開發者ID:andre-santos-pt,項目名稱:pandionj,代碼行數:5,代碼來源:FontManager.java


注:本文中的org.eclipse.swt.graphics.Font.dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。