本文整理汇总了Java中org.eclipse.swt.graphics.Font.getFontData方法的典型用法代码示例。如果您正苦于以下问题:Java Font.getFontData方法的具体用法?Java Font.getFontData怎么用?Java Font.getFontData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.graphics.Font
的用法示例。
在下文中一共展示了Font.getFontData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateScaledFont
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
/**
* update scaledFonts
* @param zoom
* at zoom
*/
private void updateScaledFont(double zoom) {
if (cachedZoom == zoom)
return;
Text text = (Text)getCellEditor().getControl();
Font font = getEditPart().getFigure().getFont();
disposeScaledFont();
cachedZoom = zoom;
if (zoom == 1.0)
text.setFont(font);
else {
FontData fd = font.getFontData()[0];
fd.setHeight((int)(fd.getHeight() * zoom));
text.setFont(scaledFont = new Font(null, fd));
}
}
示例2: get
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
@Override
public Font get() {
final Font font = getDialogArea().getFont();
final FontData[] data = font.getFontData();
for (int i = 0; i < data.length; i++) {
data[i].setStyle(BOLD);
}
return new Font(font.getDevice(), data);
}
示例3: initFormText
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
public static void initFormText(FormText formText) {
formText.setWhitespaceNormalized(false);
Font formTextFont = formText.getFont();
FontData formTextFontData = formTextFont.getFontData()[0];
FontData h1FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 5, SWT.BOLD);
final Font h1Font = new Font(formTextFont.getDevice(), h1FontData);
formText.setFont(FONT_H1_KEY, h1Font);
FontData h3FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 3, SWT.BOLD);
final Font h3Font = new Font(formTextFont.getDevice(), h3FontData);
formText.setFont(FONT_H3_KEY, h3Font);
Font codeFont = JFaceResources.getTextFont();
formText.setFont(FONT_CODE_KEY, codeFont);
formText.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
h1Font.dispose();
h3Font.dispose();
}
});
// Set fontKeySet = JFaceResources.getFontRegistry().getKeySet();
// if (fontKeySet != null) {
// for (Object fontKey : fontKeySet) {
// System.out.println(fontKey);
// }
// }
}
示例4: setProviderLoadingFailureText
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
/**
* Set the supplied text for the provider description text widget and make its font style
* bold.
* @param text The text for the provider description text widget.
*/
private void setProviderLoadingFailureText(String text) {
this.providerDescriptionText.setText(text);
Font font = this.providerDescriptionText.getFont();
FontData[] fontData = font.getFontData();
fontData[0].setStyle(SWT.BOLD);
this.providerDescriptionText.setFont(new Font(this.display, fontData));
}
示例5: setGeneratorLoadingFailureText
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
/**
* Set the supplied text for the generator description text widget and make its font style
* bold.
* @param text The text for the generator description text widget.
*/
private void setGeneratorLoadingFailureText(String text) {
this.generatorDescriptionText.setText(text);
Font font = this.generatorDescriptionText.getFont();
FontData[] fontData = font.getFontData();
fontData[0].setStyle(SWT.BOLD);
this.generatorDescriptionText.setFont(new Font(this.display, fontData));
}
示例6: newStyledFont
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
private Font newStyledFont(int index, int style) {
Font f = regFonts[index];
if (isset(f)) {
FontData[] fontData = f.getFontData();
fontData[0].setStyle(style);
fontData[0].setLocale(Translate.getLocale().toString());
return new Font(Display.getDefault(), fontData);
} else {
Application.report("newBold failed. f=" + f);
}
return null;
}
示例7: newDefaultFont
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
private Font newDefaultFont(int id) {
Display display = Display.getCurrent();
int bump = 0;
Font fontCopy = null;
switch (id) {
case DIALOG_FONT:
fontCopy = JFaceResources.getDialogFont();
break;
case TABLE_FONT:
fontCopy = JFaceResources.getDefaultFont();
if (GUI.isMac())
bump = -1;
break;
case TEXT_FONT:
fontCopy = JFaceResources.getTextFont();
break;
case HEADER_FONT:
fontCopy = JFaceResources.getDefaultFont();
break;
case TREE_FONT:
fontCopy = JFaceResources.getTextFont();
break;
default:
break;
}
FontData fd;
if (fontCopy != null)
fd = fontCopy.getFontData()[0];
else
fd = display.getSystemFont().getFontData()[0];
int size = Math.round(fd.getHeight()) + bump;
Font f = new Font(display, fd.getName(), size, 0);
FontData ff = f.getFontData()[0];
return f;
}
示例8: toAwtFont
import org.eclipse.swt.graphics.Font; //导入方法依赖的package包/类
/**
* Create an awt font by converting as much information
* as possible from the provided swt <code>Font</code>.
*
* @param device The swt device to draw on (display or gc device).
* @param font The swt font to convert.
* @return An awt font converted from the provided swt font.
*/
public static java.awt.Font toAwtFont(Device device, Font font) {
FontData fontData = font.getFontData()[0];
return toAwtFont(device, fontData, true);
}