Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.FontData


     
   }
  
   public SchedulerEditorFontDialog(String fontName_, int fontSize_, int fontStyle_, RGB foreGround_) {
    super();
      this.fontData = new FontData(fontName_,fontSize_,fontStyle_);
      this.foreGround = foreGround_;
   }
View Full Code Here


      this.foreGround = foreGround_;
   }
  
   public SchedulerEditorFontDialog(String fontName_, int fontSize_, int fontType_) {
    super();
      this.fontData = new FontData(fontName_,fontSize_,SWT.NORMAL);
    this.foreGround = new RGB(0,0,0);
   }
View Full Code Here

   }
  
   public SchedulerEditorFontDialog(String fontData_) {
    super();
    this.foreGround = new RGB(0,0,0);
      this.fontData = new FontData(fontData_);
   }
View Full Code Here

   }
  
  public void readFontData() {
    String s = Options.getProperty("script_editor_font");
    if (s == null) {
     this.fontData = new FontData("Courier New",8,SWT.NORMAL);
      }else {
         this.fontData = new FontData(s);
      }
      
    s = Options.getProperty("script_editor_font_color");
    if (s == null) s = "";
       s = s.replaceAll("RGB.*\\{(.*)\\}", "$1");
View Full Code Here

          FontDialog fd = new FontDialog(s, SWT.NONE);
          fd.setText("Select Font");
          fd.setRGB(t.getForeground().getRGB());
          fd.setFontList(t.getFont().getFontData());

           FontData newFont = fd.open();
          if(newFont==null)
              return;
          t.setFont(new Font(d, newFont));
          t.setForeground(new Color(d, fd.getRGB()));
         
View Full Code Here

        if ( value != null )
        {
            if ( value.isEmpty() )
            {
                FontData[] fontData = Display.getDefault().getSystemFont().getFontData();
                FontData fontDataBoldItalic = new FontData( fontData[0].getName(), fontData[0].getHeight(), SWT.BOLD
                    | SWT.ITALIC );
                return BrowserCommonActivator.getDefault().getFont( new FontData[]
                    { fontDataBoldItalic } );
            }
        }
        if ( attribute != null && value == null )
        {
            if ( !attribute.isConsistent() )
            {
                FontData[] fontData = Display.getDefault().getSystemFont().getFontData();
                FontData fontDataBoldItalic = new FontData( fontData[0].getName(), fontData[0].getHeight(), SWT.BOLD
                    | SWT.ITALIC );
                return BrowserCommonActivator.getDefault().getFont( new FontData[]
                    { fontDataBoldItalic } );
            }
        }
View Full Code Here

  }
 
  public static double textAscent(String fontName, int fontSize,
      FontStyle... styles) {
    // TODO: optimize this
    FontData fd = new FontData(fontName, fontSize, FontStyle.toStyleMask(styles));
    Font f = new Font(device, fd);
    setGC();
    gc.setFont(f);
    double result = gc.getFontMetrics().getAscent();
    f.dispose();
View Full Code Here

  }

  public static double textDescent(String fontName, int fontSize,
      FontStyle... styles) {
    // TODO: optimize this
    FontData fd = new FontData(fontName, fontSize, FontStyle.toStyleMask(styles));
    Font f = new Font(device, fd);
    setGC();
    gc.setFont(f);
    double result = gc.getFontMetrics().getDescent();
    f.dispose();
View Full Code Here

  }

  public static double textWidth(String s, String fontName, int fontSize,
      FontStyle... styles) {
    // TODO: optimize this
    FontData fd = new FontData(fontName, fontSize, FontStyle.toStyleMask(styles));
    Font f = new Font(device, fd);
    setGC();
    gc.setFont(f);
    double result = gc.textExtent(s).x;
    f.dispose();
View Full Code Here

  public void setFont(String fontName, int fontSize, FontStyle... styles) {
    int styleMask = FontStyle.toStyleMask(styles);
    if(currentFontData != null && currentFontData.getName().equals(fontName) && currentFontData.getHeight() == (int)fontSize && currentFontData.getStyle() == styleMask){
      return;
    }
    FontData fd = new FontData(fontName, (int) fontSize, styleMask );
    currentFontData = fd;
    //if(fd.equals(this.fontData)) return;
    this.fontData = fd;
    disposeIfNessary(currentFont);
    currentFont = new Font(device, fd);
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.FontData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.