Re: pango fonts default aliases --> gnome fonts?



On St, 2003-01-29 at 02:29, Chema Celorio wrote:
> > May I commit?
> 
> The patch does not seem correct.
> 
> The second element in each row is for FcPatternBuild so that fontconfig
> can find an alias. If we need a family name we should add another
> element to GPAliasInfo ->family and rename the current family to
> fc_family.

It's not needed as they are the same. I don't think we want to have
different family aliases to fontconfig ones, or do we?

> As Martin points out, "sans" is deprecated from fontconfig
> and "sans-serif" is the right string to look for.

Yeah, I've updated the patch to have two sets of aliases for the Sans
Serif fonts. [see my reply to Martin for explanation]

> Also, you want apps to
> look for capitalized family names to match the font names.

OK, they are capitalized now.

Modified patch attached.

Cheers
Radek

Index: gnome-fontmap.c
===================================================================
RCS file: /cvs/gnome/libgnomeprint/libgnomeprint/gnome-fontmap.c,v
retrieving revision 1.35
diff -u -p -r1.35 gnome-fontmap.c
--- gnome-fontmap.c	19 Jan 2003 23:39:37 -0000	1.35
+++ gnome-fontmap.c	29 Jan 2003 10:07:26 -0000
@@ -220,7 +220,7 @@ fcpattern_to_gp_font_entry (FcPattern *f
 }
 
 static GPFontEntry *
-fcpattern_to_gp_font_entry_alias (FcPattern *font, const gchar *name)
+fcpattern_to_gp_font_entry_alias (FcPattern *font, const gchar *name, const gchar *family)
 {
 	GPFontEntry *e;
 
@@ -230,6 +230,8 @@ fcpattern_to_gp_font_entry_alias (FcPatt
 
 	my_g_free (e->name);
 	e->name   = g_strdup (name);
+	my_g_free (e->familyname);
+	e->familyname = g_strdup (family);
 	e->is_alias = TRUE;
 	   
 	return e;
@@ -254,18 +256,24 @@ gp_fontmap_add_aliases (GPFontMap *map)
 	FcPattern *match_pattern, *result_pattern;
 	GPFontEntry *e;
 	GPAliasInfo aliases[] = {
-		{ "Sans Regular",          "sans-serif", FC_SLANT_ROMAN,  FC_WEIGHT_MEDIUM },
-		{ "Sans Bold",             "sans-serif", FC_SLANT_ROMAN,  FC_WEIGHT_BOLD },
-		{ "Sans Italic",           "sans-serif", FC_SLANT_ITALIC, FC_WEIGHT_MEDIUM },
-		{ "Sans Bold Italic",      "sans-serif", FC_SLANT_ITALIC, FC_WEIGHT_BOLD },
-		{ "Serif Regular",         "serif",      FC_SLANT_ROMAN,  FC_WEIGHT_MEDIUM },
-		{ "Serif Bold",            "serif",      FC_SLANT_ROMAN,  FC_WEIGHT_BOLD },
-		{ "Serif Italic",          "serif",      FC_SLANT_ITALIC, FC_WEIGHT_MEDIUM },
-		{ "Serif Bold Italic",     "serif",      FC_SLANT_ITALIC, FC_WEIGHT_BOLD },
-		{ "Monospace Regular",     "monospace",  FC_SLANT_ROMAN,  FC_WEIGHT_MEDIUM },
-		{ "Monospace Bold",        "monospace",  FC_SLANT_ROMAN,  FC_WEIGHT_BOLD },
-		{ "Monospace Italic",      "monospace",  FC_SLANT_ITALIC, FC_WEIGHT_MEDIUM },
-		{ "Monospace Bold Italic", "monospace",  FC_SLANT_ITALIC, FC_WEIGHT_BOLD },
+		{ "Sans Serif Regular",     "Sans Serif", FC_SLANT_ROMAN,  FC_WEIGHT_MEDIUM },
+		{ "Sans Serif Bold",        "Sans Serif", FC_SLANT_ROMAN,  FC_WEIGHT_BOLD },
+		{ "Sans Serif Italic",      "Sans Serif", FC_SLANT_ITALIC, FC_WEIGHT_MEDIUM },
+		{ "Sans Serif Bold Italic", "Sans Serif", FC_SLANT_ITALIC, FC_WEIGHT_BOLD },
+		{ "Serif Regular",          "Serif",      FC_SLANT_ROMAN,  FC_WEIGHT_MEDIUM },
+		{ "Serif Bold",             "Serif",      FC_SLANT_ROMAN,  FC_WEIGHT_BOLD },
+		{ "Serif Italic",           "Serif",      FC_SLANT_ITALIC, FC_WEIGHT_MEDIUM },
+		{ "Serif Bold Italic",      "Serif",      FC_SLANT_ITALIC, FC_WEIGHT_BOLD },
+		{ "Monospace Regular",      "Monospace",  FC_SLANT_ROMAN,  FC_WEIGHT_MEDIUM },
+		{ "Monospace Bold",         "Monospace",  FC_SLANT_ROMAN,  FC_WEIGHT_BOLD },
+		{ "Monospace Italic",       "Monospace",  FC_SLANT_ITALIC, FC_WEIGHT_MEDIUM },
+		{ "Monospace Bold Italic",  "Monospace",  FC_SLANT_ITALIC, FC_WEIGHT_BOLD },
+		/* Add also these fontconfig deprecated aliases as they are still used in Pango.
+		   Remove them once Pango stops using them. */
+		{ "Sans Regular",           "Sans", FC_SLANT_ROMAN,  FC_WEIGHT_MEDIUM },
+		{ "Sans Bold",              "Sans", FC_SLANT_ROMAN,  FC_WEIGHT_BOLD },
+		{ "Sans Italic",            "Sans", FC_SLANT_ITALIC, FC_WEIGHT_MEDIUM },
+		{ "Sans Bold Italic",       "Sans", FC_SLANT_ITALIC, FC_WEIGHT_BOLD },
 		{ NULL }
 	};
 	FcResult res;
@@ -293,7 +301,7 @@ gp_fontmap_add_aliases (GPFontMap *map)
 			continue;
 		}
 		
-		e = fcpattern_to_gp_font_entry_alias (result_pattern, aliases[i].name);
+		e = fcpattern_to_gp_font_entry_alias (result_pattern, aliases[i].name, aliases[i].family);
 		if (e) {
 			g_hash_table_insert (map->fontdict, e->name, e);
 			map->num_fonts++;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]