DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2115
Version: 1.3-current


I think I see the problem.

When XFT is enabled, the pixel size of eg. the FL_COURIER font may be
quite different the actual font size requested by the user. eg. if
textsize() is set to 11, the actual pixel size of the font may be much
larger than 11.

Internally, I think Fl_Text_Editor is sometimes using the raw font size
value for pixel size, ie. not always using fl_height()/fl_measure().

To show the difference clearly; if I change the attached text-with-box.cxx
program to use courier with a font size of 11, eg. adding to main():

    test.labelfont(FL_COURIER);
    test.labelsize(11);

..and compile and run with XFT on vs. off, the result is attached
"text-with-box-courier.png", which shows a large difference in the font's
size, even though the requested size is 11 in both cases. With XFT on, the
font's bounding box is 14 pixels, vs. 10 when XFT is off.

Seems these docs for fl_height() may no longer be true:
http://fltk.org/documentation.php/doc-1.3/drawing.html#fl_height

..specifically the bit about "You can also just use the value of size
passed to fl_font()." With XFT fonts, the pixel size can apparently be
much larger than the font's size() value.

Fl_Text_Editor internally alternates between using fl_height() and the raw
font value to calculate font heights, probably getting the heights wrong in
the latter case.

The fix is likely to change everything to use fl_height(), fl_measure(),
and friends.

Also, the docs for fl_height() might need to be rescinded, as I don't
think that's true any longer.


Link: http://www.fltk.org/str.php?L2115
Version: 1.3-current

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to