Firefox 4 with enabled system-cairo. For Subpixel rendering

Hi
When installed my lovely distro openSUSE 11.4 , i was bad, because firefox 4 has bad font smoothing. I corrected this problem and post in my Subpixel repo.
Index of /repositories/home:/muzlocker:/firefox/openSUSE_11.4

Too i create repository with ubuntu subpixel patches :
Index of /repositories/home:/muzlocker/openSUSE_11.4
Index of /repositories/home:/muzlocker/openSUSE_11.3

Now , my font smoothing very good for me :slight_smile:

And this is awesome!

This wouldn’t happen to be using Microsofts patented subpixel colour filter, would it? (The one Ubuntu uses)

Hi Muzlocker,

This does not seem to work for me :frowning: I am using above repos you have created… This has selected some weired sans-serif font. I am not sure how to change the default sans-serif font. Can you help me please?

Here are the snapshots of Yast and how sans-serif looks in firefox:
http://thumbnails41.imagebam.com/12337/c161ba123363811.jpg](http://www.imagebam.com/image/c161ba123363811)

http://thumbnails39.imagebam.com/12337/e165eb123363831.jpg](http://www.imagebam.com/image/e165eb123363831)
https://picasaweb.google.com/lh/photo/KMszH8bnUnKZZmeo_MVQ2fDfRW0ePjbLqShWo3IScLg?feat=directlink](https://lh4.googleusercontent.com/_Cw48jxWz6bw/TXy_oZveo3I/AAAAAAAABZI/YPyeWqE1jwU/s144/firefox.jpg)

Hi!

Went to /home/[user_name]/.fonts.conf and configured it according my gtk settings.

These are my settings:

Code:

<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>hintslight</const>
</edit>
</match>
<match target=“font”>
<edit mode=“assign” name=“antialias”>
<bool>true</bool>
</edit>
</match>
</fontconfig>

P.S I not like oxygen qt theme.I using qtcurve and slight smoothing for my fonts

hey thanks muzlocker :slight_smile:

I copied http://www.infinality.net/files/local.conf to my /etc/fonts and made few changes to it. This solved my problem. Thanks again :slight_smile:

Screenshot with firefox and with dolphin please!

Dolphin http://thumbnails34.imagebam.com/12339/798225123389912.jpg](http://www.imagebam.com/image/798225123389912)
Firefox http://thumbnails28.imagebam.com/12339/182f11123389812.jpg](http://www.imagebam.com/image/182f11123389812)

Mmmm strange , I’m loving the rendering out of the box and finding this “beta” a vast improvement on the old which was becoming almost unworkable for me. This baby flies!

Hi muzlocker - could you add the 32-Bit compat version for libfreetype6-2.4.4-87.1.x86_64.rpm to your repo?
Just like libcairo2-1.10.2-7.2.x86_64.rpm and libcairo2-32bit-1.10.2-7.2.x86_64.rpm
Thx!

Well, will soon be ready

Wow, that was fast!
Thx again!
Mike

Thank you muzlocker, this is really impressive.

Hi muzlocker,
Could you please include the “respect-fontconfig” patch to you cairo build ?

https://bugs.freedesktop.org/show_bug.cgi?id=11838
https://bugs.freedesktop.org/attachment.cgi?id=42713

Ok all is done

Patch respect-fontconfig not working

What do you mean by not working ?

how did you get your firefox like that? i’ve added your repo and said change system files to the ones in there but it hasn’t changed anything…? the 4.0 firefox just looks really dated. prefer the look you have there instead of the rather dull layout.

this is how mine looks, really old looking :frowning:

http://img849.imageshack.us/img849/571/snapshot1d.png

please help me :slight_smile:

thanks!

Patch #1 (cairo-respect-fontconfig.patch):

  • /usr/bin/patch -s -p1 --fuzz=0
  • /bin/cat /usr/src/packages/SOURCES/cairo-respect-fontconfig.patch
    1 out of 1 hunk FAILED – saving rejects to file src/cairo-ft-font.c.rej
    error: Bad exit status from /var/tmp/rpm-tmp.FJ9MrO (%prep)

I have used this patch with your source package

Could you try the modified package

http://olivn.trollprod.org/cairo-1.10.2-7.299.src.rpm


--- cairo-1.10.2.orig/src/cairo-ft-font.c	2011-01-30 11:05:56.709210029 +0000
+++ cairo-1.10.2/src/cairo-ft-font.c	2011-01-30 11:42:31.169860095 +0000
@@ -1578,6 +1578,7 @@
 #ifdef FC_HINT_STYLE
     int hintstyle;
 #endif
+    int lcd_filter;
 
     _cairo_font_options_init_default (&ft_options.base);
     ft_options.load_flags = FT_LOAD_DEFAULT;
@@ -1587,81 +1588,125 @@
 #define FC_EMBEDDED_BITMAP "embeddedbitmap"
 #endif
 
+#ifndef FcUndefined
+#define FcUndefined -1
+#endif
     /* Check whether to force use of embedded bitmaps */
     if (FcPatternGetBool (pattern,
 			  FC_EMBEDDED_BITMAP, 0, &bitmap) != FcResultMatch)
-	bitmap = FcFalse;
+	bitmap = FcUndefined;
 
-    /* disable antialiasing if requested */
-    if (FcPatternGetBool (pattern,
-			  FC_ANTIALIAS, 0, &antialias) != FcResultMatch)
-	antialias = FcTrue;
-    
-    if (antialias) {
-	cairo_subpixel_order_t subpixel_order;
-	int lcd_filter;
-
-	/* disable hinting if requested */
-	if (FcPatternGetBool (pattern,
-			      FC_HINTING, 0, &hinting) != FcResultMatch)
-	    hinting = FcTrue;
-
-	if (FcPatternGetInteger (pattern,
-				 FC_RGBA, 0, &rgba) != FcResultMatch)
-	    rgba = FC_RGBA_UNKNOWN;
+    if (FcPatternGetInteger (pattern, 
+			     FC_RGBA, 0, &rgba) != FcResultMatch)
+	rgba = FC_RGBA_UNKNOWN;
+
+    /* Checking if antialias property was delivered from FontConfig */
+    if (FcPatternGetBool (pattern, FC_ANTIALIAS, 0, &antialias) != FcResultMatch)
+    	antialias = FcUndefined;
+
+    /* 
+     * There are several cases of FontConfig setting we have to deal with
+     *   a) antialias == true, rgba == rgb/bgr/vrgb/vbgr      
+     *   b) antialias == true, rgba == none                   
+     *   c) antialias == true, rgba undefined                 
+     *   d) antialias == false                                
+     *   e) antialias == undefined, rgba == rgb/bgr/vrgb/vbgr  
+     *   f) antialias == undefined, rgba == none               
+     *   g) antialias == undefined, rgba undefined            
+     * 
+     * They are processed in following manner:
+     * a-c) antialias is defined and is true 
+     *   In such case we have to decide what type of antialias to select: GRAY or SUBPIXEL.
+     *   This is done based on the subpixel_order property.
+     *   - CAIRO_ANTIALIAS_GRAY when rgba is FC_RGBA_NONE
+     *   - CAIRO_ANTIALIAS_SUBPIXEL otherwise (if the rgba is rgb/bgr/vrgb/vbgr 
+     *     or subpixel wasn't defined in FC at all)
+     *
+     * d) antialias property is defined and is false
+     *   In such case we set the CAIRO_ANTIALIAS_NONE
+     *
+     * e-g) antialias property is not defined        
+     *   - the subpixel_order was specified in FC - very unlikely scenario, 
+     *     but in such case we are assuming antialiasing should be switched on.
+     *     Type of antialias is set it to CAIRO_ANTIALIAS_GRAY or CAIRO_ANTIALIAS_SUBPIXEL 
+     *     based on the rgba type.
+     *   - the subpixel_order was not specified as well - we are setting CAIRO_ANTIALIAS_DEFAULT
+     */
+    if ( (antialias == FcTrue) || 
+	 ( (antialias == FcUndefined) && (rgba != FC_RGBA_UNKNOWN) ) ) {
+        if (rgba == FC_RGBA_NONE) {
+            ft_options.base.antialias = CAIRO_ANTIALIAS_GRAY;
+	    ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
+        } else {
+            ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
+	    /* ft_options.base.subpixel_order will be set later */
+        } 
+    } else if (antialias == FcFalse) {
+	ft_options.base.antialias = CAIRO_ANTIALIAS_NONE;
+	ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
+    } /* Antialias property not defined in Fontconfig and rgba is not set.
+       * Not doing anything - staying with CAIRO_ANTIALIAS_DEFAULT */
 
+    if ( ft_options.base.antialias == CAIRO_ANTIALIAS_SUBPIXEL ) {
 	switch (rgba) {
 	case FC_RGBA_RGB:
-	    subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
+	    ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
 	    break;
 	case FC_RGBA_BGR:
-	    subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
+	    ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
 	    break;
 	case FC_RGBA_VRGB:
-	    subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
+	    ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
 	    break;
 	case FC_RGBA_VBGR:
-	    subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
+	    ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
 	    break;
 	case FC_RGBA_UNKNOWN:
 	case FC_RGBA_NONE:
 	default:
-	    subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
+	    ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
 	    break;
 	}
+    }
 
-	if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) {
-	    ft_options.base.subpixel_order = subpixel_order;
-	    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
-	}
-
-	if (FcPatternGetInteger (pattern,
-				 FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch)
-	{
-	    switch (lcd_filter) {
-	    case FC_LCD_NONE:
-		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE;
-		break;
-	    case FC_LCD_DEFAULT:
-		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5;
-		break;
-	    case FC_LCD_LIGHT:
-		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3;
-		break;
-	    case FC_LCD_LEGACY:
-		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
-		break;
-	    }
+    if (FcPatternGetInteger (pattern, FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch) {
+	switch (lcd_filter) {
+	case FC_LCD_NONE:
+	    ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE;
+	    break;
+	case FC_LCD_DEFAULT:
+	    ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5;
+	    break;
+	case FC_LCD_LIGHT:
+	    ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3;
+	    break;
+	case FC_LCD_LEGACY:
+	    ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
+	    break;
 	}
-
-#ifdef FC_HINT_STYLE
-	if (FcPatternGetInteger (pattern,
-				 FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
-	    hintstyle = FC_HINT_FULL;
-
-	if (!hinting)
-	    hintstyle = FC_HINT_NONE;
-
+    } /* No LCD_FILTER property in FontConfig - staying with default CAIRO_LCD_FILTER_DEFAULT. */
+        
+    /* 
+     * Processing hinting information
+     * Hinting should be processed also when no antialias information delivered from FontConfig 
+     */
+    if (FcPatternGetBool (pattern, FC_HINTING, 0, &hinting) != FcResultMatch)
+        hinting = FcUndefined;
+
+    /* 
+     * If hininng is forced off, setting CAIRO_HINT_STYLE_NONE
+     * If hinting is not forced off, processing hintstyle and setting appropiate style
+     * If hinting is not forced off nor hintstyle defined, 
+     *   staing with the default CAIRO_HINT_STYLE_DEFAUT
+     *   defined by _cairo_font_options_init_default
+     */
+    if (hinting == FcFalse) 
+        ft_options.base.hint_style = CAIRO_HINT_STYLE_NONE;
+
+#ifdef FC_HINT_STYLE    
+    if ( (hinting != FcFalse) &&
+	 (FcPatternGetInteger (pattern, 
+			       FC_HINT_STYLE, 0, &hintstyle) == FcResultMatch) ) {
 	switch (hintstyle) {
 	case FC_HINT_NONE:
 	    ft_options.base.hint_style = CAIRO_HINT_STYLE_NONE;
@@ -1677,46 +1722,39 @@
 	    ft_options.base.hint_style = CAIRO_HINT_STYLE_FULL;
 	    break;
 	}
-#else /* !FC_HINT_STYLE */
-	if (!hinting) {
-	    ft_options.base.hint_style = CAIRO_HINT_STYLE_NONE;
-	}
+    }
 #endif /* FC_HINT_STYLE */
 
-	/* Force embedded bitmaps off if no hinting requested */
-	if (ft_options.base.hint_style == CAIRO_HINT_STYLE_NONE)
-	  bitmap = FcFalse;
-
-	if (!bitmap)
-	    ft_options.load_flags |= FT_LOAD_NO_BITMAP;
+    /* Force embedded bitmaps off if no hinting requested */
+    if (ft_options.base.hint_style == CAIRO_HINT_STYLE_NONE)
+        bitmap = FcFalse;
 
-    } else {
-	ft_options.base.antialias = CAIRO_ANTIALIAS_NONE;
-    }
+    if (bitmap == FcFalse)
+	ft_options.load_flags |= FT_LOAD_NO_BITMAP;
 
     /* force autohinting if requested */
     if (FcPatternGetBool (pattern,
 			  FC_AUTOHINT, 0, &autohint) != FcResultMatch)
-	autohint = FcFalse;
+	autohint = FcUndefined;
 
-    if (autohint)
+    if (autohint == FcTrue)
 	ft_options.load_flags |= FT_LOAD_FORCE_AUTOHINT;
 
     if (FcPatternGetBool (pattern,
 			  FC_VERTICAL_LAYOUT, 0, &vertical_layout) != FcResultMatch)
-	vertical_layout = FcFalse;
+	vertical_layout = FcUndefined;
 
-    if (vertical_layout)
+    if (vertical_layout == FcTrue)
 	ft_options.load_flags |= FT_LOAD_VERTICAL_LAYOUT;
 
 #ifndef FC_EMBOLDEN
 #define FC_EMBOLDEN "embolden"
 #endif
-    if (FcPatternGetBool (pattern,
+    if (FcPatternGetBool (pattern, 
 			  FC_EMBOLDEN, 0, &embolden) != FcResultMatch)
-	embolden = FcFalse;
-
-    if (embolden)
+	embolden = FcUndefined;
+    
+    if (embolden == FcTrue)
 	ft_options.extra_flags |= CAIRO_FT_OPTIONS_EMBOLDEN;
 
     *ret = ft_options;
@@ -1736,31 +1774,38 @@
     if (load_flags & FT_LOAD_NO_HINTING)
 	other->base.hint_style = CAIRO_HINT_STYLE_NONE;
 
-    if (other->base.antialias == CAIRO_ANTIALIAS_NONE ||
-	options->base.antialias == CAIRO_ANTIALIAS_NONE) {
-	options->base.antialias = CAIRO_ANTIALIAS_NONE;
-	options->base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
-    }
-
-    if (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL &&
-	(options->base.antialias == CAIRO_ANTIALIAS_DEFAULT ||
-	 options->base.antialias == CAIRO_ANTIALIAS_GRAY)) {
-	options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
-	options->base.subpixel_order = other->base.subpixel_order;
+    /* If others structure defines settings for antialiasing, we are processing them */
+    if (other->base.antialias != CAIRO_ANTIALIAS_DEFAULT) {
+	if ( other->base.antialias == CAIRO_ANTIALIAS_NONE ) {
+	    /* Force antialias off */
+	    options->base.antialias = CAIRO_ANTIALIAS_NONE;
+	    options->base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
+	} else { 
+	    /* Force antialias on */
+
+	    /* If antialias==CAIRO_ANTIALIAS_SUBPIXEL is set, 
+	     * but the subpixel_order is set to CAIRO_SUBPIXEL_ORDER_DEFAULT, 
+	     * we have to determine what type of antialiasing will be used based
+	     * on current subpixel order */	    
+	    if ( (other->base.subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) &&
+	         (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL) ) {
+		if (options->base.subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) 
+		    options->base.antialias = CAIRO_ANTIALIAS_GRAY;
+		else
+		    options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
+	    } else {
+		options->base.subpixel_order = other->base.subpixel_order;
+		options->base.antialias = other->base.antialias;
+	    }
+	}
     }
-
-    if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)
+	
+    if (other->base.hint_style != CAIRO_HINT_STYLE_DEFAULT)
 	options->base.hint_style = other->base.hint_style;
 
-    if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
-	options->base.hint_style = CAIRO_HINT_STYLE_NONE;
-
-    if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT)
+    if (other->base.lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
 	options->base.lcd_filter = other->base.lcd_filter;
 
-    if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE)
-	options->base.lcd_filter = CAIRO_LCD_FILTER_NONE;
-
     if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
 	if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
 	    load_flags |= FT_LOAD_NO_HINTING;