farshadmohajeri / extpascal

Automatically exported from code.google.com/p/extpascal
49 stars 28 forks source link

CharsToPixels patch #69

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,
I have found that TExtObject.CharsToPixels was not 100% accurate and change it 
to this:

  Result := JSExpression('%s * %.2f', [ExtUtilTextMetrics.GetWidth('g'), Chars * 1.1]);

which I believe is more realistic. This led me to find a bug in formatting 
float values (also done in LinesToPixels and other places) which the attached 
patch fixes. This is for D2009+, it probably needs to be tweaked for other 
platforms.

P.S. The patch also contains an unrelated change, the definition of 
TExtObjectClass which is generally helpful to some and does no harm to others.

Original issue reported on code.google.com by nando.dessena on 29 Sep 2011 at 10:30

Attachments: