Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO]New freetype subpixel font rendering for lcd monitors
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3 ... 24, 25, 26 ... 28, 29, 30  Next  
This topic is locked: you cannot edit posts or make replies.    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
aliquid
n00b
n00b


Joined: 14 Mar 2008
Posts: 37

PostPosted: Fri Sep 26, 2008 8:28 am    Post subject: Reply with quote

From cairo 1.8.0 release announcement:
Quote:
Note also that the code that had been in cairo 1.7.x calling into
freetype's optional lcd_filter function was removed from cairo before
the 1.8.0 release. We do expect this code to come back in some form in
the future.

Sad, but no lcd font rendering for now.

Edit:
Here's a reason:
Quote:
Remove all lcd_filter code.
We reverted the public API for setting lcd_filter font options back in 1b42bc8033bc , but we had left the implementation which would examine fontconfig and Xft properties for the option, and which would call into freetype for subpixel glyph rasterization. However, I recently realized, (and the test suite had been trying to tell me for a while), that this approach would cause a regression for users who were previously using sub-pixel text, but without sub-pixel rendering built directly into freetype. That's not acceptable, so all the code is coming out for now.
Back to top
View user's profile Send private message
ocin
Guru
Guru


Joined: 01 Jan 2006
Posts: 500

PostPosted: Fri Sep 26, 2008 5:55 pm    Post subject: Reply with quote

font ebuilds are in "devnull" now too.

Last edited by ocin on Mon Oct 06, 2008 7:44 pm; edited 2 times in total
Back to top
View user's profile Send private message
kokoko3k
n00b
n00b


Joined: 06 May 2005
Posts: 72

PostPosted: Mon Sep 29, 2008 7:19 am    Post subject: Reply with quote

mwhitlock wrote:
kokoko3k wrote:
What about kde4 and/or qt4?
As far as i know, qt4 doesn't use cairo nor Xft.

I have the Last.fm player installed, and it uses Qt4, and its fonts look identical to those of the rest of my system, so I would guess that Qt4 refrains from messing with the glyphs it receives from FreeType, which means they remain properly filtered for LCD.


That's not true for me, as you can check here:
http://www.hdimage.org/images/mycnapq2qgewjs07d36y_zool1.png
qtconfig from qt-3.3.8-r4 on the left (which uses xft), qtconfig from qt-4.3.4-r1- on the right, both uses Lucida Sans Unicode, but they look different.
My .fonts.conf, nothing special:
Code:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="font" >
  <edit mode="assign" name="rgba" >
   <const>rgb</const>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>true</bool>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hintstyle" >
   <const>hintmedium</const>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="rgba" >
   <const>rgb</const>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>true</bool>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hintstyle" >
   <const>hintslight</const>
  </edit>
 </match>
 <match target="font" >
  <test compare="more" name="weight" >
   <const>medium</const>
  </test>
  <edit mode="assign" name="hintstyle" >
   <const>hintfull</const>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="antialias" >
   <bool>true</bool>
  </edit>
 </match>
</fontconfig>


By the way, i used: http://ogmrip.sourceforge.net/misc/gentoo-lcd-filtering.tar.bz2
Back to top
View user's profile Send private message
mwhitlock
Tux's lil' helper
Tux's lil' helper


Joined: 07 Aug 2006
Posts: 75
Location: Weare, NH

PostPosted: Mon Sep 29, 2008 10:21 am    Post subject: Reply with quote

kokoko3k wrote:
mwhitlock wrote:
I have the Last.fm player installed, and it uses Qt4, and its fonts look identical to those of the rest of my system, so I would guess that Qt4 refrains from messing with the glyphs it receives from FreeType, which means they remain properly filtered for LCD.

That's not true for me, as you can check here:
http://www.hdimage.org/images/mycnapq2qgewjs07d36y_zool1.png
qtconfig from qt-3.3.8-r4 on the left (which uses xft), qtconfig from qt-4.3.4-r1- on the right, both uses Lucida Sans Unicode, but they look different.

My comparison shot: http://img407.imageshack.us/my.php?image=qtcomparisonal0.png
You are right that they aren't identical. However, I think the Qt4 rendering looks better in my case. I think Qt4 looks worse in your case. Of course, this is all subjective.
Back to top
View user's profile Send private message
natros
n00b
n00b


Joined: 26 Sep 2003
Posts: 70

PostPosted: Mon Sep 29, 2008 7:49 pm    Post subject: Reply with quote

just to make clear about qt4 font rendering
http://labs.trolltech.com/blogs/2008/09/01/subpixel-antialiasing-on-x11/
_________________
-=[abit ip35 pro core2quad q6600 (oc 3.0 ghz) 8 gb ram 2x320 raid0 ext4 xfx8800gt 512mb]=-
Back to top
View user's profile Send private message
kokoko3k
n00b
n00b


Joined: 06 May 2005
Posts: 72

PostPosted: Wed Oct 01, 2008 3:14 pm    Post subject: Reply with quote

Glad to read your link.
I think sroedal is talking about a bug i submitted some months ago to trolltech, i totally missed it, thanks.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed Oct 01, 2008 3:24 pm    Post subject: Reply with quote

Regarding the cairo bug with qt4, try this patch from my Fedora 9 font packages:
Code:
-    if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)
+    options->base.hint_style = CAIRO_HINT_STYLE_DEFAULT;
+
+    if (other->base.hint_style != CAIRO_HINT_STYLE_DEFAULT)

Taken from bug 11838 and bug 13335.

Edit: Qt4 is broken and doesn't use Cairo anyway. But this patch is useful to make Gnome respect ~/.fonts.conf :)


Last edited by PaulBredbury on Fri Oct 10, 2008 4:14 pm; edited 2 times in total
Back to top
View user's profile Send private message
octoploid
n00b
n00b


Joined: 21 Oct 2006
Posts: 65

PostPosted: Wed Oct 01, 2008 5:58 pm    Post subject: Reply with quote

aliquid wrote:
From cairo 1.8.0 release announcement:
Quote:
Note also that the code that had been in cairo 1.7.x calling into
freetype's optional lcd_filter function was removed from cairo before
the 1.8.0 release. We do expect this code to come back in some form in
the future.

Sad, but no lcd font rendering for now.

Edit:
Here's a reason:
Quote:
Remove all lcd_filter code.
We reverted the public API for setting lcd_filter font options back in 1b42bc8033bc , but we had left the implementation which would examine fontconfig and Xft properties for the option, and which would call into freetype for subpixel glyph rasterization. However, I recently realized, (and the test suite had been trying to tell me for a while), that this approach would cause a regression for users who were previously using sub-pixel text, but without sub-pixel rendering built directly into freetype. That's not acceptable, so all the code is coming out for now.


Well, I just reverted the revert and cairo 1.8.0 is working fine here.

(this is what I did:
Code:

git clone git://anongit.freedesktop.org/git/cairo
cd cairo
git revert 5d887ad5dca5af0f8216830d1b04d08a5aba9bee
git format-patch -k -m --stdout origin > cairo.patch

And than added "epatch cairo.patch" to the cairo-1.8.0.ebuild...)
_________________
Myself and mine gymnastic ever
Back to top
View user's profile Send private message
mwhitlock
Tux's lil' helper
Tux's lil' helper


Joined: 07 Aug 2006
Posts: 75
Location: Weare, NH

PostPosted: Fri Oct 03, 2008 7:12 am    Post subject: Reply with quote

octoploid wrote:
Well, I just reverted the revert and cairo 1.8.0 is working fine here.

Thanks for the instructions, octoploid.

If anyone else wants the patch without needing to emerge git, here it is: http://www.mattwhitlock.com/cairo-1.8.0-lcdfilter.patch

Also, you don't have to hack the cairo-1.8.0 ebuild. You can just manually do the patch after the unpack phase but before compilation:
Code:
ebuild /usr/portage/x11-libs/cairo/cairo-1.8.0.ebuild unpack
( cd /var/tmp/portage/x11-libs/cairo-1.8.0/work/cairo-1.8.0/ && patch -p1 < ~/cairo-1.8.0-lcdfilter.patch )
ebuild /usr/portage/x11-libs/cairo/cairo-1.8.0.ebuild merge

EDIT: Cairo 1.8.0 with this patch looks terrible. Do I need to do something with my ~/.fonts.conf?

EDIT #2: Apparently, "lcddefault" is not the default for the "lcdfilter" option. How counter-intuitive! It appears that "lcdlegacy" is the value used for the "lcdfilter" option if the option is absent. I added the following to my ~/.fonts.conf:
Code:
<match target="font">
 <edit mode="assign" name="lcdfilter">
  <const>lcddefault</const>
 </edit>
</match>
and now my cairo-1.8.0 looks identical to cairo-1.6.4-r1 with bi3l's patch.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Oct 03, 2008 11:43 am    Post subject: Reply with quote

mwhitlock wrote:
Apparently, "lcddefault" is not the default for the "lcdfilter" option. How counter-intuitive!

Yep. Happily, Ubuntu does the sensible thing:
Quote:
* add debian/patches/06_ubuntu_lcddefault.patch: set lcddefault as default for the lcd-filter now that Cairo prefers lcdlegacy. This is needed to restore our previous behavior.

Although I prefer adding a single line to /etc/X11/Xresources:
Code:
Xft.lcdfilter: lcddefault
Back to top
View user's profile Send private message
manwe_
Guru
Guru


Joined: 01 Feb 2006
Posts: 564
Location: Kraków/Cracow, Poland

PostPosted: Fri Oct 03, 2008 3:05 pm    Post subject: Reply with quote

Yesterday I was working on OS X and have to say, fonts are looking great on Mac. Is there any way to config Gentoo to display fonts similiar? This is my system now [Segoe UI, 10pt]:
http://img125.imageshack.us/img125/218/segoegentoorf7.png

And this is small comparison between XP and OS X I've found:
http://images.damieng.com/blog/WindowsAt11.png
http://images.damieng.com/blog/MacAt13.png

I just luv this boldness.
Back to top
View user's profile Send private message
bi3l
Apprentice
Apprentice


Joined: 06 Feb 2003
Posts: 268
Location: France

PostPosted: Fri Oct 03, 2008 9:53 pm    Post subject: Reply with quote

I've updated fontconfig-2.6.0 according to fontconfig_2.6.0-1ubuntu4.diff which includes the lcddefault patch, and cairo-1.8.0 so that it applies the lcdfilter patch from mwhitlock. I've also added EAPI="1" to the freetype and fontconfig ebuilds.

The tarball is here: http://ogmrip.sourceforge.net/misc/gentoo-lcd-filtering.tar.bz2
Back to top
View user's profile Send private message
solshark
n00b
n00b


Joined: 24 Mar 2007
Posts: 17

PostPosted: Fri Oct 03, 2008 10:11 pm    Post subject: Reply with quote

bi3l wrote:
I've updated fontconfig-2.6.0 according to fontconfig_2.6.0-1ubuntu4.diff which includes the lcddefault patch, and cairo-1.8.0 so that it applies the lcdfilter patch from mwhitlock. I've also added EAPI="1" to the freetype and fontconfig ebuilds.

The tarball is here: http://ogmrip.sourceforge.net/misc/gentoo-lcd-filtering.tar.bz2


Thx for your great job!
_________________
my russian blog: http://solshark.i-seo.biz
Back to top
View user's profile Send private message
mwhitlock
Tux's lil' helper
Tux's lil' helper


Joined: 07 Aug 2006
Posts: 75
Location: Weare, NH

PostPosted: Fri Oct 03, 2008 11:42 pm    Post subject: Reply with quote

manwe_ wrote:
Yesterday I was working on OS X and have to say, fonts are looking great on Mac. Is there any way to config Gentoo to display fonts similiar?

libXft at 12pt (101 dpi): http://img521.imageshack.us/my.php?image=libxftat12ptjm2.png

I personally think it looks better than both Windows and Mac.

My FreeType config is:
hinting=false
hintstyle=hintnone
antialias=true
rgba=rgb
lcdfilter=lcddefault
Back to top
View user's profile Send private message
manwe_
Guru
Guru


Joined: 01 Feb 2006
Posts: 564
Location: Kraków/Cracow, Poland

PostPosted: Sun Oct 05, 2008 4:38 pm    Post subject: Reply with quote

mwhitlock wrote:
libXft at 12pt (101 dpi): http://img521.imageshack.us/my.php?image=libxftat12ptjm2.png
I personally think it looks better than both Windows and Mac.

8O I've similiar config, and can't get look like this. The only difference is screen DPI [93x92]. Could DPI be a problem?
Code:
# cat /etc/fonts/local.font
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="font" >
  <edit mode="assign" name="rgba" >     <const>rgb</const> </edit>
  <edit mode="assign" name="hinting" >  <bool>false</bool>  </edit>
  <edit mode="assign" name="antialias"> <bool>true</bool> </edit>
  <edit mode="assign" name="autohint" > <bool>false</bool> </edit>
  <edit mode="assign" name="hintstyle"> <const>hintnone</const> </edit>
  <edit mode="assign" name="lcdfilter"> <const>lcddefault</const> </edit>
 </match>
</fontconfig>

# ls -1 /etc/fonts/conf.d/
10-antialias.conf@
10-sub-pixel-rgb.conf@
20-fix-globaladvance.conf@
30-metric-aliases.conf@
30-urw-aliases.conf@
40-nonlatin.conf@
45-latin.conf@
49-sansserif.conf@
50-user.conf@
51-local.conf@
53-monospace-lcd-filter.conf@
57-dejavu.conf@
60-latin.conf@
60-liberation.conf@
65-fonts-persian.conf@
65-nonlatin.conf@
69-unifont.conf@
80-delicious.conf@
90-synthetic.conf@




Another thing is, cairo-1.8.0 from "lcd-filtering" looks worse [thinner] than 1.6.4-r1. Example: http://img353.imageshack.us/img353/6162/screenshot2008100518193yy5.png It might look like small differece, but with whole screen of code cairo-1.8.0 looks just awful.
Back to top
View user's profile Send private message
bi3l
Apprentice
Apprentice


Joined: 06 Feb 2003
Posts: 268
Location: France

PostPosted: Sun Oct 05, 2008 4:44 pm    Post subject: Reply with quote

Can you reinstall fontconfig and see if your display is better ?
Back to top
View user's profile Send private message
manwe_
Guru
Guru


Joined: 01 Feb 2006
Posts: 564
Location: Kraków/Cracow, Poland

PostPosted: Sun Oct 05, 2008 8:18 pm    Post subject: Reply with quote

bi3l wrote:
reinstall fontconfig and see if your display is better ?

It's not. I've upgraded to cairo-1.8.0, reemerged fontconfig-2.6.0-r2 and fonts are still thinner. I've tried even to reemerge freetype-2.3.7 and libXft-2.1.13 but it didn't help either.
Back to top
View user's profile Send private message
bi3l
Apprentice
Apprentice


Joined: 06 Feb 2003
Posts: 268
Location: France

PostPosted: Sun Oct 05, 2008 8:35 pm    Post subject: Reply with quote

After emerging fontconfig, did you change your /etc/fonts/conf.d ? Because you should at least have 11-lcd-filter-lcddefault.conf (it changes the lcd filter to default instead of legacy). Here is my /etc/fonts/conf.d:
Code:
10-antialias.conf
10-autohint.conf
10-hinting.conf
10-hinting-medium.conf
10-no-sub-pixel.conf
10-sub-pixel-rgb.conf
11-lcd-filter-lcddefault.conf
20-fix-globaladvance.conf
20-unhint-small-vera.conf
25-unhint-nonlatin.conf
30-metric-aliases.conf
30-urw-aliases.conf
40-nonlatin.conf
45-latin.conf
49-sansserif.conf
50-user.conf
51-local.conf
53-monospace-lcd-filter.conf
59-dejavu.conf
60-latin.conf
65-fonts-persian.conf
65-nonlatin.conf
69-unifont.conf
80-delicious.conf
90-synthetic.conf
Back to top
View user's profile Send private message
manwe_
Guru
Guru


Joined: 01 Feb 2006
Posts: 564
Location: Kraków/Cracow, Poland

PostPosted: Sun Oct 05, 2008 9:57 pm    Post subject: Reply with quote

I did't but looks like emerge did. Because right now I have:
Code:
10-antialias.conf
10-hinting.conf
10-hinting-medium.conf
10-sub-pixel-rgb.conf
11-lcd-filter-lcddefault.conf
20-fix-globaladvance.conf
20-unhint-small-vera.conf
30-metric-aliases.conf
30-urw-aliases.conf
40-nonlatin.conf
45-latin.conf
49-sansserif.conf
50-user.conf
51-local.conf
53-monospace-lcd-filter.conf
57-dejavu.conf
60-latin.conf
60-liberation.conf
65-fonts-persian.conf
65-nonlatin.conf
69-unifont.conf
80-delicious.conf
90-synthetic.conf
Back to top
View user's profile Send private message
nihues
n00b
n00b


Joined: 20 May 2003
Posts: 47
Location: Balneário Camboriú / SC

PostPosted: Mon Oct 06, 2008 1:50 am    Post subject: Reply with quote

do you had enabled it?

Code:
eselect fontconfig enable 5


if 5 is the number before 11-lcd-filter-lcddefault.conf

then restart X
Back to top
View user's profile Send private message
acevery
n00b
n00b


Joined: 03 Nov 2005
Posts: 53
Location: Amoy, China

PostPosted: Tue Oct 07, 2008 6:29 am    Post subject: Reply with quote

bi3l wrote:
I've updated fontconfig-2.6.0 according to fontconfig_2.6.0-1ubuntu4.diff which includes the lcddefault patch, and cairo-1.8.0 so that it applies the lcdfilter patch from mwhitlock. I've also added EAPI="1" to the freetype and fontconfig ebuilds.

The tarball is here: http://ogmrip.sourceforge.net/misc/gentoo-lcd-filtering.tar.bz2


Great works!
Thanks :D
Back to top
View user's profile Send private message
swimmer
Veteran
Veteran


Joined: 15 Jul 2002
Posts: 1291
Location: Netherlands

PostPosted: Tue Oct 07, 2008 10:02 am    Post subject: Reply with quote

Time indeed to thank you bi3l - your efforts are very much appreciated!!!

Greetz
swimmer
Back to top
View user's profile Send private message
manwe_
Guru
Guru


Joined: 01 Feb 2006
Posts: 564
Location: Kraków/Cracow, Poland

PostPosted: Tue Oct 07, 2008 10:04 am    Post subject: Reply with quote

nihues wrote:
do you had enabled it?

Code:
eselect fontconfig enable 5

Like I've said, looks like reemerging fontconfig [when bi3l suggested] enabled 11-lcd-filter-lcddefault.conf by itself, because I don't remember doin' it. Before that my config looked like this http://forums.gentoo.org/viewtopic-p-5238170.html#5238170 , and now looks like this http://forums.gentoo.org/viewtopic-p-5238520.html#5238520 . X was also restarted [or to be precise, tested on new session -- :1 ].

-- update:
Config <edit mode="assign" name="lcdfilter"> <const>lcddefault</const> </edit> accepts only lcdnone, lcddefault, lcdlight and lcdlegacy [any other value throws error], but fonts look doesn't change. Somehow Cairo sees this value, but ignores it.
Back to top
View user's profile Send private message
GoofyX
n00b
n00b


Joined: 23 Feb 2005
Posts: 51
Location: Thessaloniki, Greece

PostPosted: Tue Oct 07, 2008 2:46 pm    Post subject: Reply with quote

bi3l wrote:
After emerging fontconfig, did you change your /etc/fonts/conf.d ? Because you should at least have 11-lcd-filter-lcddefault.conf (it changes the lcd filter to default instead of legacy).

Where do I find that file?
_________________
... Morpheus: What is "real"? How do you define "real"? If you 're talking about what you can feel, what you can smell, what you can taste and see, then "real" is simply electrical signals interpreted by your brain...
Back to top
View user's profile Send private message
bi3l
Apprentice
Apprentice


Joined: 06 Feb 2003
Posts: 268
Location: France

PostPosted: Tue Oct 07, 2008 2:49 pm    Post subject: Reply with quote

In /etc/fonts/conf.d. It should be a link to /etc/fonts/conf.avail/11-lcd-filter-lcddefault.conf.
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies.    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3 ... 24, 25, 26 ... 28, 29, 30  Next
Page 25 of 30

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum