当前位置: 首页>>代码示例>>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;未经允许,请勿转载。