Charles A. Landemaine
2007-Feb-12 13:59 UTC
[Fontconfig] Can we get fonts as sharp as Windows?
I was comparing my fonts in Unix with those of Windows. I can''t have fonts as sharp as Windows. Here''s the difference: http://img95.imageshack.us/img95/7598/fontsfj5.png The one on top is Trebuchet MS in Windows and the one at the bottom is the same font in Unix. Is it a fontconfig problem of a freetype problem? I''m using antialiasing, obviously. It seems that pixels that generate the round effects are grey (for Unix), while they are colorful (for Windows). How can I solve it? Thanks, -- Charles A. Landemaine.
"Charles A. Landemaine" <landemaine@gmail.com> ????????:> I was comparing my fonts in Unix with those of Windows. I can''t have > fonts as sharp as Windows. Here''s the difference: > > http://img95.imageshack.us/img95/7598/fontsfj5.png > > The one on top is Trebuchet MS in Windows and the one at the bottom is > the same font in Unix. Is it a fontconfig problem of a freetype > problem? I''m using antialiasing, obviously. > > It seems that pixels that generate the round effects are grey (for > Unix), while they are colorful (for Windows).You may need to recompile your freetype2 and enable subpixel hinting. Subpixel hinting is what makes the colours you see in your screen shot. It not compiled in by default because there may be patent problems. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ????????????? I ? Unicode
Charles A. Landemaine
2007-Feb-14 15:05 UTC
[Fontconfig] Re: Can we get fonts as sharp as Windows?
> You may need to recompile your freetype2 and enable subpixel hinting. > Subpixel hinting is what makes the colours you see in your > screen shot. > It not compiled in by default because there may be patent problems.Thanks Fabian, yes, I have freetype compiled with BCI and subpixel hinting is turnt on (I''m the author of this tutorial: http://osresources.com/3_13_en.html) Any other idea? -- Charles A. Landemaine.
"Charles A. Landemaine" <landemaine@gmail.com> ????????:>> You may need to recompile your freetype2 and enable subpixel hinting. >> Subpixel hinting is what makes the colours you see in your >> screen shot. >> It not compiled in by default because there may be patent problems. > > Thanks Fabian, yes, I have freetype compiled with BCI and subpixel > hinting is turnt onBCI (byte code interpreter) is not the same as subpixel hinting. If you don''t have subpixel hinting compiled in, you cannot get the coloured rendering. subpixel hinting is not compiled in by default anymore since freetype 2.3.0. Which version of freetype are you using? -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ????????????? I ? Unicode
Charles A. Landemaine
2007-Feb-15 07:54 UTC
[Fontconfig] Re: Can we get fonts as sharp as Windows?
Thanks Mike. I tried to compile Freetype with subpixel hinting support but I didn''t have this option. Any idea? -- Charles A. Landemaine.
"Charles A. Landemaine" <landemaine@gmail.com> ????????:> Thanks Mike. I tried to compile Freetype with subpixel hinting support > but I didn''t have this option. Any idea?So which version of freetype are you using? And which Linux distribution? If you have a freetype newer than 2.2.1, you need to define the option FT_CONFIG_OPTION_SUBPIXEL_RENDERING in freetype/config/ftoption.h as shown in the patch below. If you freetype is 2.2.1 or older, subpixel hinting is already compiled in. In that case (old freetype), you just need to enable it in your fontconfig setup. diff -ru freetype-2.2.1.20061013.orig/include/freetype/config/ftoption.h freetype-2.2.1.20061013/include/freetype/config/ftoption.h --- freetype-2.2.1.20061013.orig/include/freetype/config/ftoption.h 2006-09-26 23:55:44.000000000 +0200 +++ freetype-2.2.1.20061013/include/freetype/config/ftoption.h 2006-10-19 14:12:48.000000000 +0200 @@ -92,7 +92,7 @@ /* This is done to allow FreeType clients to run unmodified, forcing */ /* them to display normal gray-level anti-aliased glyphs. */ /* */ -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ +#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING /*************************************************************************/ -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ????????????? I ? Unicode
Charles A. Landemaine
2007-Feb-15 09:54 UTC
[Fontconfig] Re: Can we get fonts as sharp as Windows?
Thanks Mike, I do have Freetype 2.2.1 (on PC-BSD). And I also have this in my .fonts.conf file: <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <!-- PC-BSD - Fonts configurations v.12012006--> <!-- Make bold fonts less bold and more readable --> <match target="font" > <test name="weight" compare="more"> <int>100</int> </test> <edit mode="assign" name="weight" > <const>210</const> </edit> </match> <!-- Antialias any font by default with autohint enabled, hintfull --> <match target="font" > <edit mode="assign" name="antialias" > <bool>true</bool> </edit> <edit mode="assign" name="autohint" > <bool>true</bool> </edit> <edit mode="assign" name="hintstyle" > <const>hintfull</const> </edit> </match> <!-- Enable sub-pixel rendering--> <match target="font" > <test name="rgba" qual="all" > <const>unknown</const> </test> <edit mode="assign" name="rgba" > <const>rgb</const> </edit> </match> <!-- Fix deprecated monospace --> <match target="pattern" name="family" > <test name="family" qual="any" > <string>fixed</string> </test> <edit mode="assign" name="family" > <string>monospace</string> </edit> </match> <match target="pattern" name="family" > <test name="family" qual="any" > <string>console</string> </test> <edit mode="assign" name="family" > <string>monospace</string> </edit> </match> <match target="pattern" name="family" > <test name="family" qual="any" > <string>mono</string> </test> <edit mode="assign" name="family" > <string>monospace</string> </edit> </match> <!-- Fixed spacing for monospace --> <match target="pattern" name="family" > <test name="family" qual="any" > <string>monospace</string> </test> <edit mode="assign" name="spacing" > <int>10</int> </edit> </match> </fontconfig> Is this correct? Thanks again! -- Charles A. Landemaine.
"Charles A. Landemaine" <landemaine@gmail.com> ????????:> Thanks Mike, I do have Freetype 2.2.1 (on PC-BSD). And I also have > this in my .fonts.conf file:[...]> <!-- Enable sub-pixel rendering--> > > <match target="font" > > <test name="rgba" qual="all" > > <const>unknown</const> > </test> > <edit mode="assign" name="rgba" > > <const>rgb</const> > </edit> > </match>That looks OK. It switches on coloured rendering if your Xserver cannot find out whether you have an LCD monitor or not. If your Xserver can detect that you have an LCD monitor, "rgba" will not be "unknown", it will already be "rgb" when the above rule is read. When you have an LCD monitor connected via a digital cable to your computer, the Xserver usually can detect that it is a LCD monitor. If you use an analog cable, it cannot. To switch on subpixel hinting unconditionally you could just as well use the simpler rule: <match target="font" > <edit mode="assign" name="rgba" > <const>rgb</const> </edit> </match> Using that, do you still get only grayscale anti-aliasing and no colours? Is the value of rgba OK in the FC_DEBUG output? It should be 1 if you set it to rgb, for example: mfabian@magellan:~$ FC_DEBUG=4 xfd -fa sans 2>&1 | grep rgba Edit rgba Assign rgb; rgba: 1(i)(s) rgba: 1(i)(s) rgba: 1(i)(s) rgba: 1(i)(s) Edit rgba Assign rgb; rgba: 1(i)(w) rgba: 1(i)(w) rgba: 1(i)(w) rgba: 1(i)(w) rgba: 1(i)(w) rgba: 1(i)(w) mfabian@magellan:~$ -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ????????????? I ? Unicode
Charles A. Landemaine
2007-Feb-16 03:01 UTC
[Fontconfig] Re: Can we get fonts as sharp as Windows?
Thanks Mike, yes, I have color pixels to create rounded corners now, I recompiled Freetype2 actually but I see that if I remove this snippet, I still have subpixel hinting. Strange. The only way to disable it is to unset antialiasing. Is it possible that Freetype has subpixel hinting by default when you use antialiasing? I checked out in fonts.conf, local.conf and ~/.confs.conf, none of these files have a declaration for rgb anymore, but it''s still working. Any idea? -- Charles A. Landemaine.
"Charles A. Landemaine" <landemaine@gmail.com> ????????:> Thanks Mike, yes, I have color pixels to create rounded corners now, I > recompiled Freetype2 actually but I see that if I remove this snippet, > I still have subpixel hinting. Strange. The only way to disable it is > to unset antialiasing. Is it possible that Freetype has subpixel > hinting by default when you use antialiasing? I checked out in > fonts.conf, local.conf and ~/.confs.conf, none of these files have a > declaration for rgb anymore, but it''s still working. Any idea?Then you probably have an LCD screen which is connected with a digital cable. In that case rgba=rbg is set automagically by default. You can switch if of and use grayscale anti-aliasing setting rgba=none, i.e. by using the following rule in your ~/.fonts.conf: <match target="font" > <edit mode="assign" name="rgba" > <const>none</const> </edit> </match> Just try what you like better. -- Mike FABIAN <mfabian@suse.de> http://www.suse.de/~mfabian ????????????? I ? Unicode