summaryrefslogtreecommitdiff
path: root/pango/pangox-fontmap.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-08-22 02:06:46 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-08-22 02:06:46 +0000
commit9526e3432936ba82f20aed9b6e525288b7024ea2 (patch)
treecafa5e78eeb6d75c6e3d16c382bc0b1142fceebf /pango/pangox-fontmap.c
parent91d66774aa844a8df1ea0311d71b82059d8c3581 (diff)
downloadpango-9526e3432936ba82f20aed9b6e525288b7024ea2.tar.gz
Don't produce a warning unless loading all fonts fails, if loading all
Mon Aug 21 22:02:38 2000 Owen Taylor <otaylor@redhat.com> * pango/pango-context.c (load_font): Don't produce a warning unless loading all fonts fails, if loading all fonts fails, try with "Sans [style]", if that fails, try with "Sans", if that fails, exit - we are completely screwed. * pango/pangox-fontmap.c (pango_x_font_map_load_font): Equate PANGO_STYLE_OBLIQUE and PANGO_STYLE_ITALIC, but with a big penalty.
Diffstat (limited to 'pango/pangox-fontmap.c')
-rw-r--r--pango/pangox-fontmap.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c
index 4a92c816..a408e3e4 100644
--- a/pango/pangox-fontmap.c
+++ b/pango/pangox-fontmap.c
@@ -492,22 +492,37 @@ pango_x_font_map_load_font (PangoFontMap *fontmap,
if (family_entry)
{
PangoXFontEntry *best_match = NULL;
+ int best_distance = G_MAXINT;
tmp_list = family_entry->font_entries;
while (tmp_list)
{
PangoXFontEntry *font_entry = tmp_list->data;
- if (font_entry->description.style == description->style &&
- font_entry->description.variant == description->variant &&
+ if (font_entry->description.variant == description->variant &&
font_entry->description.stretch == description->stretch)
{
- int distance = abs(font_entry->description.weight - description->weight);
- int old_distance = best_match ? abs(best_match->description.weight - description->weight) : G_MAXINT;
-
- if (distance < old_distance)
+ if (font_entry->description.style == description->style)
+ {
+ int distance = abs(font_entry->description.weight - description->weight);
+ if (distance < best_distance)
+ {
+ best_match = font_entry;
+ best_distance = distance;
+ }
+ }
+ else if (font_entry->description.style != PANGO_STYLE_NORMAL &&
+ description->style != PANGO_STYLE_NORMAL)
{
- best_match = font_entry;
+ /* Equate oblique and italic, but with a big penalty
+ */
+ int distance = PANGO_SCALE * 1000 + abs(font_entry->description.weight - description->weight);
+
+ if (distance < best_distance)
+ {
+ best_match = font_entry;
+ best_distance = distance;
+ }
}
}