Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.FontMetrics


    final RectangleInsets tickLabelInsets = this.getTickLabelInsets();
    double result = tickLabelInsets.getTop() + tickLabelInsets.getBottom();

    final Font tickLabelFont = this.getTickLabelFont();
    g2.setFont(tickLabelFont);
    final FontMetrics lm = g2.getFontMetrics();
    if (!this.isVerticalTickLabels()) {
      // all tick labels have the same width (equal to the height of
      // the font)...
      result += lm.getHeight();
    } else {
      // look at lower and upper bounds...
      final DateRange range = (DateRange) this.getRange();
      final Date lower = range.getLowerDate();
      final Date upper = range.getUpperDate();
View Full Code Here


    final Font tickLabelFont = this.getTickLabelFont();
    g2.setFont(tickLabelFont);
    // FontRenderContext frc = g2.getFontRenderContext();
    // LineMetrics lm = tickLabelFont.getLineMetrics("ABCxyz", frc);
    final FontMetrics lm = g2.getFontMetrics();
    if (this.isVerticalTickLabels()) {
      // all tick labels have the same width (equal to the height of
      // the font)...
      result += lm.getHeight();
    } else {
      // look at lower and upper bounds...
      final DateRange range = (DateRange) this.getRange();
      final Date lower = range.getLowerDate();
      final Date upper = range.getUpperDate();
View Full Code Here

       * annotations should never have been given the chance to
       * collapse.
       */
      if (!isCollapsed()) {
        // working with rectangle, so line height
        FontMetrics metrics = gc.getFontMetrics();
        if (metrics != null) {
          // do not draw annotations that only span one line and
          // mark them as not visible
          if ((rectangle.height / metrics.getHeight()) <= 1) {
            fIsVisible = false;
            return;
          }
        }
      }
View Full Code Here

    gd = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=104507
      GC gc = new GC(fHoverTable);
      gc.setFont(fHoverTable.getFont());
      FontMetrics fontMetrics = gc.getFontMetrics();
      gc.dispose();
    int heightHint = Dialog.convertHeightInCharsToPixels(fontMetrics, 7);
    gd.heightHint = heightHint;
   
    fHoverTable.setLayoutData(gd);
View Full Code Here

      final Rectangle drawArea, final boolean vertical) {
    final RectangleInsets insets = this.getTickLabelInsets();
    final Font font = this.getTickLabelFont();
    int maxHeight = 0;
    g2.setFont(font);
    final FontMetrics fm = g2.getFontMetrics();
    if (vertical) {
      for (final Iterator iter = ticks.iterator(); iter.hasNext();) {
        final ITick tick = (ITick) iter.next();
        final Point extent = g2.textExtent(tick.getText());
        maxHeight = Math.max(maxHeight, extent.x + insets.getTop()
            + insets.getBottom());
      }
    } else {
      maxHeight = fm.getHeight() + insets.getTop() + insets.getBottom();
    }
    return maxHeight;

  }
View Full Code Here

      final Rectangle drawArea, final boolean vertical) {
    final RectangleInsets insets = this.getTickLabelInsets();
    final Font font = this.getTickLabelFont();
    int maxWidth = 0;
    g2.setFont(font);
    final FontMetrics fm = g2.getFontMetrics();
    if (!vertical) {
      for (final Iterator iter = ticks.iterator(); iter.hasNext();) {
        final ITick tick = (ITick) iter.next();
        final Point extent = g2.textExtent(tick.getText());
        maxWidth = Math.max(maxWidth, extent.x + insets.getLeft()
            + insets.getRight());
      }
    } else {
      maxWidth = fm.getHeight() + insets.getTop() + insets.getBottom();
    }
    return maxWidth;

  }
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 composite, String text, int span )
    {
        GC gc = new GC( composite );
        gc.setFont( JFaceResources.getDialogFont() );
        FontMetrics fontMetrics = gc.getFontMetrics();
        gc.dispose();

        Button button = new Button( composite, 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 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.