本文整理汇总了Java中org.eclipse.jface.resource.FontRegistry.get方法的典型用法代码示例。如果您正苦于以下问题:Java FontRegistry.get方法的具体用法?Java FontRegistry.get怎么用?Java FontRegistry.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.FontRegistry
的用法示例。
在下文中一共展示了FontRegistry.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initDiffStyleRangeForLineType
import org.eclipse.jface.resource.FontRegistry; //导入方法依赖的package包/类
/**
* Starts a new {@link StyleRange} given a specific line type.
*/
private StyleRange initDiffStyleRangeForLineType(DiffLineType lineType, int startTextOffset) {
ColorRegistry reg =
PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
StyleRange range = new StyleRange();
range.start = startTextOffset;
switch (lineType) {
case ADD:
range.foreground = reg.get(THEME_DiffAddForegroundColor);
range.background = reg.get(THEME_DiffAddBackgroundColor);
break;
case REMOVE:
range.foreground = reg.get(THEME_DiffRemoveForegroundColor);
range.background = reg.get(THEME_DiffRemoveBackgroundColor);
break;
case HUNK:
range.foreground = reg.get(THEME_DiffHunkForegroundColor);
range.background = reg.get(THEME_DiffHunkBackgroundColor);
break;
case HEADLINE:
range.foreground = reg.get(THEME_DiffHeadlineForegroundColor);
range.background = reg.get(THEME_DiffHeadlineBackgroundColor);
FontRegistry fontReg =
PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
range.font = fontReg.get(THEME_DiffHeadlineFont);
break;
default:
break;
}
return range;
}
示例2: deriveFontSize
import org.eclipse.jface.resource.FontRegistry; //导入方法依赖的package包/类
private static Font deriveFontSize(Font font, String preferenceKey) {
int pixelHeight = TIMELINE_PREFERENCES.getInt(preferenceKey);
if (font == null) {
font = Display.getDefault().getSystemFont();
}
Device device = font.getDevice();
if (device == null) {
device = WidgetUtils.getDisplay();
}
int pixelsPerInch = device.getDPI().y;
int pointHeight;
if (pixelsPerInch == 0) {
pointHeight = pixelHeight;
} else {
pointHeight = POINTS_PER_INCH * pixelHeight / pixelsPerInch;
}
FontData[] fontData = font.getFontData();
for (int i=0; i<fontData.length; i++) {
fontData[i].setHeight(pointHeight);
}
String symbolicFontName = font.toString() + "_" + pointHeight;
FontRegistry fontRegistry = FontUtils.FONT_REGISTRY_INSTANCE;
boolean fontExists = fontRegistry.getKeySet().contains(symbolicFontName);
Font desiredFont = null;
if(!fontExists) {
desiredFont = FontUtils.getStyledFont(font.getDevice(), fontData);
fontRegistry.put(symbolicFontName, fontData);
} else {
desiredFont = fontRegistry.get(symbolicFontName);
}
return desiredFont;
}
示例3: getBoldFont
import org.eclipse.jface.resource.FontRegistry; //导入方法依赖的package包/类
private Font getBoldFont() {
Font systemFont = FontUtils.getSystemFont();
int desiredFontHeight = 10;
String symbolicFontName = systemFont.toString() + "_" + desiredFontHeight;
FontRegistry fontRegistry = FontUtils.FONT_REGISTRY_INSTANCE;
boolean fontExists = fontRegistry.getKeySet().contains(symbolicFontName);
Font font = null;
if(!fontExists) {
font = FontUtils.getStyledFont(desiredFontHeight, SWT.NONE);
fontRegistry.put(symbolicFontName, font.getFontData());
} else {
font = fontRegistry.get(symbolicFontName);
}
return font;
}
示例4: updateFontEntry
import org.eclipse.jface.resource.FontRegistry; //导入方法依赖的package包/类
private static void updateFontEntry( Display display, FontRegistry fontRegistry, String symbolicName ) {
Font textFont = fontRegistry.get( symbolicName );
fontRegistry.put( symbolicName, display.getSystemFont().getFontData() );
display.readAndDispatch();
fontRegistry.put( symbolicName, textFont.getFontData() );
display.readAndDispatch();
}
示例5: getFont
import org.eclipse.jface.resource.FontRegistry; //导入方法依赖的package包/类
public static Font getFont(String cfgName){
FontRegistry fr = JFaceResources.getFontRegistry();
if (!fr.hasValueFor(cfgName)) {
FontData[] fd =
PreferenceConverter.getFontDataArray(new SettingsPreferenceStore(CoreHub.userCfg),
cfgName);
fr.put(cfgName, fd);
}
return fr.get(cfgName);
}