There are 6 code examples for org.eclipse.swt.graphics.FontData.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: OpenII Package: org.mitre.openii.editors.search
Source Code: SearchView.java (Click to view .java file)
Method Code:
/**
* Displays the schema label
*/
private void displayLabel(Composite parent,String text){
FontData fontData=new FontData();
fontData.setHeight(12);
fontData.setStyle(SWT.BOLD);
label=new CLabel(parent,SWT.NONE);
label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
label.setFont(new Font(Display.getCurrent(),fontData));
label.setImage(OpenIIActivator.getImage("Schema.gif"));
label.setText(text);
label.setCursor(new Cursor(getDisplay(),SWT.CURSOR_HAND));
label.addMouseListener(this);
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal
Source Code: OwlUI.java (Click to view .java file)
Method Code:
/**
* @param zoomIn
* @param reset
*/
@SuppressWarnings("restriction") public static void zoomNewsText(boolean zoomIn,boolean reset){
ITheme theme=PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
FontRegistry registry=theme.getFontRegistry();
FontData[] oldFontDatas=registry.getFontData(NEWS_TEXT_FONT_ID);
FontData[] newFontDatas=new FontData[oldFontDatas.length];
for (int i=0; i < oldFontDatas.length; i++) {
FontData oldFontData=oldFontDatas[i];
int oldHeight=oldFontData.getHeight();
if (reset) newFontDatas[i]=new FontData(oldFontData.getName(),DEFAULT_NEWS_TEXT_FONT_HEIGHT,oldFontData.getStyle());
else newFontDatas[i]=new FontData(oldFontData.getName(),zoomIn ? oldHeight + 1 : Math.max(oldHeight - 1,0),oldFontData.getStyle());
}
registry.put(NEWS_TEXT_FONT_ID,newFontDatas);
String key=org.eclipse.ui.internal.themes.ThemeElementHelper.createPreferenceKey(theme,NEWS_TEXT_FONT_ID);
String fdString=PreferenceConverter.getStoredRepresentation(newFontDatas);
String storeString=org.eclipse.ui.internal.util.PrefUtil.getInternalPreferenceStore().getString(key);
if (!fdString.equals(storeString)) org.eclipse.ui.internal.util.PrefUtil.getInternalPreferenceStore().setValue(key,fdString);
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal
Source Code: OwlUI.java (Click to view .java file)
Method Code:
/**
* @param zoomIn
* @param reset
*/
@SuppressWarnings("restriction") public static void zoomNewsText(boolean zoomIn,boolean reset){
ITheme theme=PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
FontRegistry registry=theme.getFontRegistry();
FontData[] oldFontDatas=registry.getFontData(NEWS_TEXT_FONT_ID);
FontData[] newFontDatas=new FontData[oldFontDatas.length];
for (int i=0; i < oldFontDatas.length; i++) {
FontData oldFontData=oldFontDatas[i];
int oldHeight=oldFontData.getHeight();
if (reset) newFontDatas[i]=new FontData(oldFontData.getName(),DEFAULT_NEWS_TEXT_FONT_HEIGHT,oldFontData.getStyle());
else newFontDatas[i]=new FontData(oldFontData.getName(),zoomIn ? oldHeight + 1 : Math.max(oldHeight - 1,0),oldFontData.getStyle());
}
registry.put(NEWS_TEXT_FONT_ID,newFontDatas);
String key=org.eclipse.ui.internal.themes.ThemeElementHelper.createPreferenceKey(theme,NEWS_TEXT_FONT_ID);
String fdString=PreferenceConverter.getStoredRepresentation(newFontDatas);
String storeString=org.eclipse.ui.internal.util.PrefUtil.getInternalPreferenceStore().getString(key);
if (!fdString.equals(storeString)) org.eclipse.ui.internal.util.PrefUtil.getInternalPreferenceStore().setValue(key,fdString);
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal
Source Code: SplashHandler.java (Click to view .java file)
Method Code:
private void initResources(Shell splash){
FontData fontData=splash.getDisplay().getSystemFont().getFontData()[0];
fVersionFont=new Font(splash.getDisplay(),fontData.getName(),8,SWT.BOLD);
fVersionColor=new Color(splash.getDisplay(),new RGB(53,53,53));
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal.dialogs
Source Code: PreviewFeedDialog.java (Click to view .java file)
Method Code:
private void createFonts(){
int fontHeight=10;
Font newsFont=OwlUI.getThemeFont(OwlUI.NEWS_TEXT_FONT_ID,SWT.NORMAL);
FontData[] fontData=newsFont.getFontData();
if (fontData.length > 0) {
fNewsFontFamily=fontData[0].getName();
fontHeight=fontData[0].getHeight();
}
int normal=fontHeight;
String fontUnit="pt";
fNormalFontCSS="font-size: " + normal + fontUnit+ ";";
}
Project Name: rssowl.ui Package: org.rssowl.ui.internal.editors.feed
Source Code: NewsBrowserLabelProvider.java (Click to view .java file)
Method Code:
private void createFonts(){
int fontHeight=10;
Font newsFont=OwlUI.getThemeFont(OwlUI.NEWS_TEXT_FONT_ID,SWT.NORMAL);
FontData[] fontData=newsFont.getFontData();
if (fontData.length > 0) {
fNewsFontFamily=fontData[0].getName();
fontHeight=fontData[0].getHeight();
}
int normal=fontHeight;
int verysmall=normal - 2;
int small=normal - 1;
int bigger=normal + 1;
int biggest=bigger + 2;
String fontUnit="pt";
fNormalFontCSS="font-size: " + normal + fontUnit+ ";";
fVerySmallFontCSS="font-size: " + verysmall + fontUnit+ ";";
fSmallFontCSS="font-size: " + small + fontUnit+ ";";
fBiggerFontCSS="font-size: " + bigger + fontUnit+ ";";
fBiggestFontCSS="font-size: " + biggest + fontUnit+ ";";
}