/** * Create a new managed font by using fontdata * * @param display * the display to use * @param fontData * The fontdata to create the font with. */ public ManagedFont( Display display, FontData fontData ) { this.font = new Font( display, fontData ); this.systemFont = false; }
public void setFont( String fontName, int fontSize, boolean fontBold, boolean fontItalic ) { int swt = SWT.NORMAL; if ( fontBold ) { swt = SWT.BOLD; } if ( fontItalic ) { swt = swt | SWT.ITALIC; } Font font = new Font( PropsUI.getDisplay(), fontName, fontSize, swt ); int index = fonts.indexOf( font ); if ( index < 0 ) { fonts.add( font ); } else { font.dispose(); font = fonts.get( index ); } gc.setFont( font ); }
public void setFont( String fontName, int fontSize, boolean fontBold, boolean fontItalic ) { int swt = SWT.NORMAL; if ( fontBold ) { swt = SWT.BOLD; } if ( fontItalic ) { swt = swt | SWT.ITALIC; } Font font = new Font( PropsUI.getDisplay(), fontName, fontSize, swt ); int index = fonts.indexOf( font ); if ( index < 0 ) { fonts.add( font ); } else { font.dispose(); font = fonts.get( index ); } gc.setFont( font ); }
font = new Font(Display.getCurrent(), fontData); m_fontMap.put(fontName, font);
public void widgetSelected( SelectionEvent arg0 ) { graphFont.dispose(); graphFontData = props.getDefaultFontData(); graphFont = new Font( display, graphFontData ); wGFont.redraw(); } } );
public void widgetSelected( SelectionEvent arg0 ) { noteFontData = props.getDefaultFontData(); noteFont.dispose(); noteFont = new Font( display, noteFontData ); wNFont.redraw(); } } );
/** * Returns a bold version of the given {@link Font}. * * @param baseFont * the {@link Font} for which a bold version is desired * @return the bold version of the given {@link Font} */ public static Font getBoldFont(Font baseFont) { Font font = m_fontToBoldFontMap.get(baseFont); if (font == null) { FontData fontDatas[] = baseFont.getFontData(); FontData data = fontDatas[0]; font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD); m_fontToBoldFontMap.put(baseFont, font); } return font; } /**
public static void setGCFont( GC gc, Device device, FontData fontData ) { if ( Const.getOS().startsWith( "Windows" ) ) { Font font = new Font( device, fontData ); gc.setFont( font ); font.dispose(); } else { gc.setFont( device.getSystemFont() ); } }
public void getData() { fixedFontData = props.getFixedFont(); fixedFont = new Font( display, fixedFontData ); graphFontData = props.getGraphFont(); graphFont = new Font( display, graphFontData ); noteFontData = props.getNoteFont(); noteFont = new Font( display, noteFontData ); backgroundRGB = props.getBackgroundRGB(); if ( backgroundRGB == null ) { backgroundRGB = display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ).getRGB(); } background = new Color( display, backgroundRGB ); graphColorRGB = props.getGraphColorRGB(); graphColor = new Color( display, graphColorRGB ); tabColorRGB = props.getTabColorRGB(); tabColor = new Color( display, tabColorRGB ); }
public void widgetSelected( SelectionEvent arg0 ) { FontDialog fd = new FontDialog( shell ); fd.setFontList( new FontData[] { graphFontData } ); FontData newfd = fd.open(); if ( newfd != null ) { graphFontData = newfd; graphFont.dispose(); graphFont = new Font( display, graphFontData ); wGFont.redraw(); } } } );
public void widgetSelected( SelectionEvent arg0 ) { FontDialog fd = new FontDialog( shell ); fd.setFontList( new FontData[] { noteFontData } ); FontData newfd = fd.open(); if ( newfd != null ) { noteFontData = newfd; noteFont.dispose(); noteFont = new Font( display, noteFontData ); wNFont.redraw(); } } } );
public void widgetSelected( SelectionEvent arg0 ) { FontDialog fd = new FontDialog( shell ); fd.setFontList( new FontData[] { fixedFontData } ); FontData newfd = fd.open(); if ( newfd != null ) { fixedFontData = newfd; fixedFont.dispose(); fixedFont = new Font( display, fixedFontData ); wFFont.redraw(); } } } );
private void refreshTextNote() { int swt = SWT.NORMAL; if ( wFontBold.getSelection() ) { swt = SWT.BOLD; } if ( wFontItalic.getSelection() ) { swt = swt | SWT.ITALIC; } // dispose of old font only after setting it on wDesc Font oldFont = font; font = new Font( shell.getDisplay(), wFontName.getText(), wFontSize.getSelection(), swt ); wDesc.setFont( font ); if ( oldFont != null && !oldFont.isDisposed() ) { oldFont.dispose(); } for ( Control control : wDesc.getChildren() ) { control.setBackground( bgColor ); } wFontColor.setBackground( fontColor ); wBackGroundColor.setBackground( bgColor ); wBorderColor.setBackground( borderColor ); } }
licFont.dispose(); licFont = new Font( e.display, "Helvetica", licFontSize, SWT.NORMAL ); e.gc.setFont( licFont );
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(); } } );
private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) { link = new Link( shell, SWT.SINGLE | SWT.WRAP ); link.setText( helpLink ); if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) { FontData[] fD = link.getFont().getFontData(); fD[0].setHeight( 13 ); link.setFont( new Font( display, fD[0] ) ); } FormData fdlink = new FormData(); fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon fdlink.top = new FormAttachment( description, margin ); fdlink.width = maxTextWidth; link.setLayoutData( fdlink ); props.setLook( link ); link.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { if ( Desktop.isDesktopSupported() ) { try { Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) ); } catch ( Exception e ) { log.logError( "Error opening external browser", e ); } } } } ); }
helpLabel.setFont( new Font( display, "Open Sans Regular", 11, SWT.NORMAL ) ); helpLabel.setForeground( new Color( display, 0, 94, 170 ) ); FormData helpLabelFormData = new FormData();
TableView.dummyGC = new GC( TableView.dummyImage ); gridFont = new Font( disp, props.getGridFont() ); TableView.dummyGC.setFont( gridFont );
public static Font getAnyFontBoldItalic(GC gc) { if (fontBoldItalic == null || fontBoldItalic.isDisposed()) { FontData[] fontData = gc.getFont().getFontData(); for (FontData fd : fontData) { fd.setStyle(SWT.BOLD | SWT.ITALIC); } fontBoldItalic = new Font(gc.getDevice(), fontData); } return fontBoldItalic; }