[PATCH] FLTK Resources should call ::fltk::setfont before ::fltk::getwidth
If you point Dillo at <URL:http://starurchin.org/dillo/bugs/form_setfont.html> you'll see that the textareas are rendered with different widths despite having the same number of columns. The problem is that FltkResource objects don't call ::fltk::setfont before calling ::fltk::getwidth to calculate their width, so they use the font that was set by the previous header elements, even though those elements were properly closed in the HTML source. This patch adds the missing ::fltk::setfont calls to Fltk{Entry,Button,Multiline}Resource . I've looked at all other uses of ::fltk::getwidth. The ones in dw2-cur/dw/fltkplatform.cc are properly protected by calls to ::fltk::setfont , but the ones in dw2-cur/dw/fltkpreview.cc and dillo2-cur/src/dialog.cc are not. I can't tell if they need to be protected, perhaps the current FLTK font is always correct when they are called? Thoughts? Regards, Jeremy Henty
Hi Jeremy, On Sun, Dec 23, 2007 at 02:40:38PM +0000, Jeremy Henty wrote:
If you point Dillo at <URL:http://starurchin.org/dillo/bugs/form_setfont.html> you'll see that the textareas are rendered with different widths despite having the same number of columns.
I see. Good example.
The problem is that FltkResource objects don't call ::fltk::setfont before calling ::fltk::getwidth to calculate their width, so they use the font that was set by the previous header elements, even though those elements were properly closed in the HTML source.
OK.
This patch adds the missing ::fltk::setfont calls to Fltk{Entry,Button,Multiline}Resource .
Committed!
I've looked at all other uses of ::fltk::getwidth. The ones in dw2-cur/dw/fltkplatform.cc are properly protected by calls to ::fltk::setfont , but the ones in dw2-cur/dw/fltkpreview.cc and dillo2-cur/src/dialog.cc are not. I can't tell if they need to be protected, perhaps the current FLTK font is always correct when they are called? Thoughts?
Yes, they should be protected. AFAIS, every function sets its proper font, but doesn't restore the previous one. With regard to dialog: it'd be nice to set the font size considering prefs.font_factor. For fltkpreview.cc, it'd be good to at least add a commented statement because it clearly is in a state of flux (and ifdefed out). -- Cheers Jorge.-
On Sun, Dec 23, 2007 at 12:12:51PM -0300, Jorge Arellano Cid wrote:
For fltkpreview.cc, it'd be good to at least add a commented statement because it clearly is in a state of flux (and ifdefed out).
Heh, I hadn't noticed it was ifdefed! Here's a patch that moves the setfont() call to the top of the function and adds a comment explaining why it must be there. There's no change to the functionality since the interviewing code is commented out. Regards, Jeremy Henty
On Sun, Dec 23, 2007 at 05:33:49PM +0000, Jeremy Henty wrote:
On Sun, Dec 23, 2007 at 12:12:51PM -0300, Jorge Arellano Cid wrote:
For fltkpreview.cc, it'd be good to at least add a commented statement because it clearly is in a state of flux (and ifdefed out).
Heh, I hadn't noticed it was ifdefed! Here's a patch that moves the setfont() call to the top of the function and adds a comment explaining why it must be there. There's no change to the functionality since the interviewing code is commented out.
Committed. -- Cheers Jorge.-
On Sun, Dec 23, 2007 at 12:12:51PM -0300, Jorge Arellano Cid wrote:
With regard to dialog: it'd be nice to set the font size considering prefs.font_factor.
OK, here's a patch but I'm not sure how to test it. What's an easy way to get dillo-fltk to show a dialog? Last time I looked the https dpi dialogs failed to appear. Regards, Jeremy Henty
On Sun, Dec 23, 2007 at 06:49:06PM +0000, Jeremy Henty wrote:
On Sun, Dec 23, 2007 at 12:12:51PM -0300, Jorge Arellano Cid wrote:
With regard to dialog: it'd be nice to set the font size considering prefs.font_factor.
OK, here's a patch but I'm not sure how to test it. What's an easy way to get dillo-fltk to show a dialog? Last time I looked the https dpi dialogs failed to appear.
Just use "View source". Committed with a minor tweak. -- Cheers Jorge.-
participants (2)
-
jcid@dillo.org
-
onepoint@starurchin.org