Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.FontMetrics


     */
    public static int getButtonWidth( Control control )
    {
        GC gc = new GC( control );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
        return width;
    }
View Full Code Here


  }

  public static Point computeWrapSize(GC gc, String text, int wHint) {
    BreakIterator wb = BreakIterator.getWordInstance();
    wb.setText(text);
    FontMetrics fm = gc.getFontMetrics();
    int lineHeight = fm.getHeight();

    int saved = 0;
    int last = 0;
    int height = lineHeight;
    int maxWidth = 0;
View Full Code Here

  public static void paintWrapText(GC gc, String text, Rectangle bounds,
      boolean underline) {
    BreakIterator wb = BreakIterator.getWordInstance();
    wb.setText(text);
    FontMetrics fm = gc.getFontMetrics();
    int lineHeight = fm.getHeight();
    int descent = fm.getDescent();

    int saved = 0;
    int last = 0;
    int y = bounds.y;
    int width = bounds.width;
View Full Code Here

            Point p= textWidget.getLocationAtOffset(lineEnd);

            Color c= gc.getForeground();
            gc.setForeground(color);

            FontMetrics metrics= gc.getFontMetrics();

            // baseline: where the dots are drawn
            int baseline= textWidget.getBaseline(offset);
            // descent: number of pixels that the box extends over baseline
            int descent= Math.min(2, textWidget.getLineHeight(offset) - baseline);
            // ascent: so much does the box stand up from baseline
            int ascent= metrics.getAscent();
            // leading: free space from line top to box upper line
            int leading= baseline - ascent;
            // height: height of the box
            int height= ascent + descent;

            int width= metrics.getAverageCharWidth();
            gc.drawRectangle(p.x, p.y + leading, width, height);
            int third= width/3;
            int dotsVertical= p.y + baseline - 1;
            gc.drawPoint(p.x + third, dotsVertical);
            gc.drawPoint(p.x + width - third, dotsVertical);
View Full Code Here

  public void paint(GC gc, Canvas canvas, Rectangle rectangle) {
    Image image= getImage(canvas.getDisplay());
    if (image != null) {
      ImageUtilities.drawImage(image, gc, canvas, rectangle, SWT.CENTER, SWT.TOP);
      if (fIsRangeIndication) {
        FontMetrics fontMetrics= gc.getFontMetrics();
        int delta= (fontMetrics.getHeight() - image.getBounds().height)/2;
        rectangle.y += delta;
        rectangle.height -= delta;
        drawRangeIndication(gc, canvas, rectangle);
      }
    }
View Full Code Here

     */
    public static Button createButton( Composite parent, String text, int span )
    {
        GC gc = new GC( parent );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        Button button = new Button( parent, SWT.PUSH );
        GridData gd = new GridData();
        gd.widthHint = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
View Full Code Here

     */
    public static int getButtonWidth( Control control )
    {
        GC gc = new GC( control );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
        return width;
    }
View Full Code Here

     */
    public static int getButtonWidth( Control control )
    {
        GC gc = new GC( control );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
        return width;
    }
View Full Code Here

     */
    public static int getButtonWidth( Control control )
    {
        GC gc = new GC( control );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
        return width;
    }
View Full Code Here

     */
    public static Button createButton( Composite parent, String text, int span )
    {
        GC gc = new GC( parent );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        Button button = new Button( parent, SWT.PUSH );
        GridData gd = new GridData();
        gd.widthHint = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH );
View Full Code Here

TOP

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

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.