当前位置: 首页>>代码示例>>Java>>正文


Java FontRegistry.get方法代码示例

本文整理汇总了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;
}
 
开发者ID:google,项目名称:git-appraise-eclipse,代码行数:34,代码来源:DiffAttributeEditor.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:34,代码来源:TimelineUtils.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:16,代码来源:PageSelectionWidget.java

示例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();
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:8,代码来源:FontRegistryUpdater.java

示例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);
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:11,代码来源:UiDesk.java


注:本文中的org.eclipse.jface.resource.FontRegistry.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。