Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » textExtent resets FontMetrics in 3.6.0(textExtent resets FontMetrics in 3.6.0)
textExtent resets FontMetrics in 3.6.0 [message #545347] Wed, 07 July 2010 09:40
Keith Willenson is currently offline Keith Willenson
Messages: 9
Registered: July 2009
Junior Member
I just upgraded to Eclipse 3.6.0 and my code started behaving strangely.

Diagnostics are show only when data is "12" so diagnostics are not excessive. I do not know how to get this to repeat in a small sample. The code is from SiteElement.drawLineText

 if (data.compareTo("12") == 0)
    {
      System.out.println("SiteElement.drawLineText b pixelHeight " +  gc.getFontMetrics().getHeight()); //$NON-NLS-1$
      System.out.printin("SiteElement.drawLineText b font " +  gc.getFont()); //$NON-NLS-1$
      System.out.println("SiteElement.drawLineText b metrics " +  gc.getFontMetrics()); //$NON-NLS-1$
    }

    org.eclipse.swt.graphics.Point dataSize = gc.textExtent(data);

    if (data.compareTo("12") == 0)
    {
     System.out.println("SiteElement.drawLineText b2 pixelHeight " +  gc.getFontMetrics().getHeight()); //$NON-NLS-1$
     System.out.println("SiteElement.drawLineText b2 font " +  gc.getFont()); //$NON-NLS-1$
      System.out.println("SiteElement.drawLineText b2 metrics " +  gc.getFontMetrics()); //$NON-NLS-1$
    }


First drawing pass (to screen)

SiteElement.drawLabel gc GC {-100595411}
SiteElement.drawLabel font.fontData 1|Times New Roman|26.25|1|WINDOWS|1|-35|0|0|0|700|0|0|0|1|0|0|0|0|Times New Roman
SiteElement.drawLabel pixelHeight 40
SiteElement.drawText pixelHeight 40
SiteElement.drawLineText top pixelHeight 40
SiteElement.drawLineText b pixelHeight 40
SiteElement.drawLineText b font Font {1544167548}
SiteElement.drawLineText b metrics org.eclipse.swt.graphics.FontMetrics@2fa
SiteElement.drawLineText b2 pixelHeight 40
SiteElement.drawLineText b2 font Font {1544167548}
SiteElement.drawLineText b2 metrics SiteElement.drawLineText b2 metrics org.eclipse.swt.graphics.FontMetrics@2fa
SiteElement.drawLineText c pixelHeight 40
SiteElement.drawLineText gc GC {-100595411}



Second drawing pass (to image buffer)

SiteElement.drawLabel gc GC {-1174337614}
SiteElement.drawLabel font.fontData 1|Times New Roman|26.25|1|WINDOWS|1|-35|0|0|0|700|0|0|0|1|0|0|0|0|Times New Roman
SiteElement.drawLabel pixelHeight 40
SiteElement.drawText pixelHeight 40
SiteElement.drawLineText top pixelHeight 40
SiteElement.drawLineText b pixelHeight 40
SiteElement.drawLineText b font Font {-536206755}
SiteElement.drawLineText b metrics org.eclipse.swt.graphics.FontMetrics@2fa
SiteElement.drawLineText b2 pixelHeight 16
SiteElement.drawLineText b2 font Font {-536206755}
SiteElement.drawLineText b2 metrics org.eclipse.swt.graphics.FontMetrics@289
SiteElement.drawLineText c pixelHeight 16
SiteElement.drawLineText gc GC {-1174337614}


You can see that in the second pass, after gc.getTextExtent(), gc does not change, gc.getFont() does not change, but gc.getFontMetrics () does change.
Previous Topic:One Framework to bind them All ?!
Next Topic:Drop problem with ListViewer
Goto Forum:
  


Current Time: Sun Apr 20 04:23:56 EDT 2014

Powered by FUDForum. Page generated in 0.01515 seconds