public FontData getFixedFont() { FontData def = getDefaultFontData(); String name = properties.getProperty( STRING_FONT_FIXED_NAME ); int size = Const.toInt( properties.getProperty( STRING_FONT_FIXED_SIZE ), def.getHeight() ); int style = Const.toInt( properties.getProperty( STRING_FONT_FIXED_STYLE ), def.getStyle() ); return new FontData( name, size, style ); }
Font font = m_fontMap.get(fontName); if (font == null) { FontData fontData = new FontData(name, size, style); if (strikeout || underline) { try {
public FontData getGraphFont() { FontData def = getDefaultFontData(); String name = properties.getProperty( STRING_FONT_GRAPH_NAME, def.getName() ); int size = Const.toInt( properties.getProperty( STRING_FONT_GRAPH_SIZE ), def.getHeight() ); int style = Const.toInt( properties.getProperty( STRING_FONT_GRAPH_STYLE ), def.getStyle() ); return new FontData( name, size, style ); }
public FontData getNoteFont() { FontData def = getDefaultFontData(); String name = properties.getProperty( STRING_FONT_NOTE_NAME, def.getName() ); String ssize = properties.getProperty( STRING_FONT_NOTE_SIZE ); String sstyle = properties.getProperty( STRING_FONT_NOTE_STYLE ); int size = Const.toInt( ssize, def.getHeight() ); int style = Const.toInt( sstyle, def.getStyle() ); return new FontData( name, size, style ); }
public FontData getGridFont() { FontData def = getDefaultFontData(); String name = properties.getProperty( STRING_FONT_GRID_NAME, def.getName() ); String ssize = properties.getProperty( STRING_FONT_GRID_SIZE ); String sstyle = properties.getProperty( STRING_FONT_GRID_STYLE ); int size = Const.toInt( ssize, def.getHeight() ); int style = Const.toInt( sstyle, def.getStyle() ); return new FontData( name, size, style ); }
public FontData getDefaultFont() { FontData def = getDefaultFontData(); if ( isOSLookShown() ) { return def; } String name = properties.getProperty( STRING_FONT_DEFAULT_NAME, def.getName() ); int size = Const.toInt( properties.getProperty( STRING_FONT_DEFAULT_SIZE ), def.getHeight() ); int style = Const.toInt( properties.getProperty( STRING_FONT_DEFAULT_STYLE ), def.getStyle() ); return new FontData( name, size, style ); }
new FontData( props.getGraphFont().getName(), (int) Math.round( props.getGraphFont().getHeight() * 1.2 ), props .getGraphFont().getStyle() ); fontMedium = new ManagedFont( display, mediumFontData ); new FontData( props.getGraphFont().getName(), (int) Math.round( props.getGraphFont().getHeight() * 1.2 ), props .getGraphFont().getStyle() | SWT.BOLD ); new FontData( props.getGraphFont().getName(), props.getGraphFont().getHeight() * 3, props.getGraphFont() .getStyle() ); fontLarge = new ManagedFont( display, largeFontData ); new FontData( props.getGraphFont().getName(), props.getGraphFont().getHeight() - 2, props.getGraphFont() .getStyle() ); fontTiny = new ManagedFont( display, tinyFontData ); new FontData( props.getGraphFont().getName(), props.getGraphFont().getHeight() - 1, props.getGraphFont() .getStyle() ); fontSmall = new ManagedFont( display, smallFontData ); new FontData( props.getDefaultFontData().getName(), props.getDefaultFontData().getHeight(), props .getDefaultFontData().getStyle() | SWT.BOLD );
public void widgetSelected( SelectionEvent arg0 ) { fixedFontData = new FontData( PropsUI.getInstance().getFixedFont().getName(), PropsUI.getInstance().getFixedFont().getHeight(), PropsUI.getInstance().getFixedFont().getStyle() ); fixedFont.dispose(); fixedFont = new Font( display, fixedFontData ); wFFont.redraw(); } } );
class BoldFontStyler extends Styler { @Override public void applyStyles(final TextStyle textStyle) { FontDescriptor boldDescriptor = FontDescriptor.createFrom(new FontData()).setStyle(SWT.BOLD); Font boldFont = boldDescriptor.createFont(Display.getCurrent()); textStyle.font = boldFont; } }
/*public*/ Font(Device device, String name, float height, int style) { super(device); if (name == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); init(new FontData (name, height, style)); init(); } @Override
private static FontData[] getModifiedFontData(FontData[] originalData, int additionalStyle) { FontData[] styleData = new FontData[originalData.length]; for (int i = 0; i < styleData.length; i++) { FontData base = originalData[i]; styleData[i] = new FontData(base.getName(), base.getHeight(), base.getStyle() | additionalStyle); } return styleData; }
private static FontData cloneFontData( FontData fontData ) { String name = fontData.getName(); int height = fontData.getHeight(); int style = fontData.getStyle(); return new FontData( name, height, style ); }
public void setUnselect() { selectedItemID = -1; if (toolButton != null) { if (getId().equals(DRAWTEXT_TOOLBAR + "")) { //$NON-NLS-1$ FontData fontData = new FontData(stringCustom); toolButton.setImage(createFontImage(fontData, int2rgb(intgerCustom), false)); } toolButton.redraw(); } }
public static Font createFont( CssFont font ) { String name = font.getFamilyAsString(); int style = SWT.NORMAL; if( font.bold ) { style |= SWT.BOLD; } if( font.italic ) { style |= SWT.ITALIC; } FontData data = new FontData( name, font.size, style ); return getApplicationContext().getResourceFactory().getFont( data ); }
@Override public void clickBody() { selectedItemID = DRAW_TEXT; if (toolButton != null) { FontData fontData = new FontData(stringCustom); toolButton.setImage(createFontImage(fontData, int2rgb(intgerCustom), true)); toolButton.redraw(); } run(); }
public static Font deriveFont(Font f, int style, int height) { FontData[] fd = f.getFontData(); FontData[] newFD = new FontData[fd.length]; for(int i = 0; i < fd.length; i++ ) { newFD[i] = new FontData(fd[i].getName(), height, style); } return new Font(Display.getCurrent(), newFD); }
private void changeFont(Control control, boolean italic) { Display.getCurrent().asyncExec(() -> { FontData fd= control.getFont().getFontData()[0]; int style= italic ? (fd.getStyle() | SWT.ITALIC) : (fd.getStyle() & ~SWT.ITALIC); control.setFont(new Font(control.getDisplay(), new FontData(fd.getName(), fd.getHeight(), style))); if (control instanceof Composite) ((Composite) control).layout(); }); }
/** * Returns a copy of the original FontData * * @param next FontData to copy * @return a copy of the given FontData */ public static FontData copy(FontData next) { FontData result = new FontData(next.getName(), next.getHeight(), next.getStyle()); result.setLocale(next.getLocale()); return result; }
private static FontData cloneFontData( FontData fontData ) { FontData result = new FontData( fontData.getName(), fontData.getHeight(), fontData.getStyle() ); result.setLocale( fontData.getLocale() ); return result; }
private FontData[] createFontData(FontState fontState, Font baseFont) { FontData[] fontData = new FontData[baseFont.getFontData().length]; int index = -1; for (FontData fd : baseFont.getFontData()) { fontData[++index] = new FontData(fd.getName(), fd.getHeight(), fd.getStyle()); } return applyFontState(fontState, fontData); }