On Sat, Jan 31, 2009 at 03:42:49PM +0000, imacarthur wrote: > > On 31 Jan 2009, at 14:46, cage wrote: > > I am having a strange problem with courier font in fltk (GNU/Linux).
CUT > > Is this a fltk bug or maybe it is my fault? > > > > Please feel free to ask for more information! CUT > Rendering of fonts on displays is an area that frequently throws up > difficulties, and there is a long (and often painful!) history of > people struggling with this. Indeed, one of the reasons PDF is the > way it is, is because there was such a need for a way to render > documents so they looked more or less the same wherever they were > rendered... > > Returning to your question, however: > > - What distro are you using? I am using Debian Lenny. > - Do you know what fonts it actually has installed? can I use xlsfont to get the list? > - What font mapping is the font server doing? No idea for that question... :-( > - Which version of fltk are you using? "1.1.9" fltk-config says > - Is fltk built with XFT support enabled? AFAIK yes because i have tried to rebuild the debian package from its source and the configure script says :"Graphics: X11+Xft+Xinerama" > Looking at your png, it is clear that the two rendering engines have > used completely different fonts to render the text in the images. > Consider the two "courier" examples; look at the letter "l", and see > that the glyphs are quite different. Then observe that the libplot > version has used a serif font, whereas the fltk version is not. Yes...for some reason i was sure that FL_COURIER was same sort of alias for the courier postscript font. Of course now i realize that this is not correct at all. > Similarly, the two Helvetica examples, on close inspection, are > clearly not the same font at all. > > Also, it appears very much as if the libplot version has made an > attempt at anti-aliasing, whist the fltk version has not (if fltk is > built with XFT enabled, I would expect it to be anti-aliased too.) As the libplot string has been transformed in a bitmap and then scaled in dimension maybe it can appear "fuzzy" but the original is not so blurred, so i think the rendering is ok from this point of view. > Is this a bug? No, probably not - if you use a catch-all name like > "courier", the font engine will search through the installed fonts to > find a font that it thinks is a suitable match, and use that. > However, it is not certain that any two renderer's will make the same > choice, so you can get quite different results. > If you specify the full name of the font file, to both renderer's, > you may be able to get results that are more similar. > > It is probably worth your while running the fltk font demo from the > test folder and checking to see which fonts you actually have - you > may be able to see which one the fltk rendering is falling back on > when you request "courier", and so forth. I have checked the font demo but, odd enought for me, i was not able to locate any helvetica font, instead i found a "courier pitch 10" font that match (near)exactly the courier postscript font! I wonder now which font remap FL_COURIER and FL_HELVETICA by default. Moreover If i run xlsfont the output produces a lot of adobe-helvetica and adobe-courier font that are not displayed by the fltk font demo. This is really a puzzle for me and i can see now i have a lot to learn from this subject! > Now, another thing that catches people out, is that fltk attempts to > specify font sizes in display pixels (since it is a display oriented > toolkit) but the majority of applications (even display oriented > ones) tend towards specifying font sizes in points (or some > interpretation thereof) so this can results in some noticeable > difference in size on the display - 12-points is seldom the same size > as 12-pixels... This is discussed in the fltk docs, IIRC. > And this will vary with display DPI and etc., of course. Some > experimentation my be required to find out what scaling works best > for your application. > > So, I think if you make the two toolkits select the same actual > underlying font, and adjust the sizes to suit, you will be able to > make the text more similar in the two outputs. But getting any two > different toolkits to render text in a pixel-identical way is *hard* > so you probably do not want to go there! > > Hope that helped, Yes! Thank you very much! Your reply was very exaustive! Now i have a way to solve the problem, i was totally missing the point before posting here! Thank you again. C. PS: now i am realizing that i am stressing too much my bad english, sorry for the orrible mess i am doing! :-) _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

