const gchar *family;
gchar *name;
gint size;
+ gboolean is_absolute;
size = pango_font_description_get_size (description);
if (size < 0)
return NULL;
+ is_absolute = pango_font_description_get_size_is_absolute (description);
+
family = pango_font_description_get_family (description);
family = family ? family : "";
name = g_utf8_casefold (family, -1);
if (!find_best_match (font_family, description, &best_description, &best_face))
return NULL;
- pango_font_description_set_size (best_description, size);
+ if (is_absolute)
+ pango_font_description_set_absolute_size (best_description, size);
+ else
+ pango_font_description_set_size (best_description, size);
best_font = pango_atsui_font_map_lookup (atsuifontmap,
context,
PangoATSUIFont font;
PangoCairoFontPrivate cf_priv;
- double size;
- int absolute_size;
+ double size; /* Absolute size */
};
struct _PangoCairoATSUIFontClass
PangoCairoATSUIFont *cafont = (PangoCairoATSUIFont *) font;
desc = pango_font_describe (font);
- pango_font_description_set_absolute_size (desc, cafont->absolute_size);
+ pango_font_description_set_absolute_size (desc,
+ cafont->size * PANGO_SCALE);
return desc;
}
CFStringRef cfstr;
ATSFontRef font_ref;
CGFontRef font_id;
- double size;
+ double size, abs_size;
double dpi;
double m;
cairo_matrix_t font_matrix;
font_ref = ATSFontFindFromPostScriptName (cfstr, kATSOptionFlagsDefault);
CFRelease (cfstr);
+ abs_size = size = pango_units_to_double (pango_font_description_get_size (desc));
+
+ if (context)
+ {
+ dpi = pango_cairo_context_get_resolution (context);
+
+ if (dpi <= 0)
+ dpi = cafontmap->dpi;
+ }
+ else
+ dpi = cafontmap->dpi;
+
+ if (pango_font_description_get_size_is_absolute (desc))
+ size *= 72. / dpi;
+ else
+ abs_size *= dpi / 72.;
+
/* We synthesize italic in two cases. The first is when
* NSFontManager has handed out a face that it claims has italic but
* it doesn't. The other is when an italic face is requested that
NSString *nsname;
NSFont *nsfont, *converted_font;
- size = (double) pango_font_description_get_size (desc) / PANGO_SCALE;
-
nsname = [NSString stringWithUTF8String:postscript_name];
nsfont = [NSFont fontWithName:nsname size:size];
_pango_atsui_font_set_font_description (afont, desc);
_pango_atsui_font_set_face (afont, face);
- size = (double) pango_font_description_get_size (desc) / PANGO_SCALE;
_pango_atsui_font_set_cgfont (afont, font_id);
_pango_atsui_font_set_atsfont (afont, font_ref);
- if (context)
- {
- dpi = pango_cairo_context_get_resolution (context);
-
- if (dpi <= 0)
- dpi = cafontmap->dpi;
- }
- else
- dpi = cafontmap->dpi;
-
- cafont->absolute_size = pango_font_description_get_size (desc);
-
- if (!pango_font_description_get_size_is_absolute (desc))
- size *= dpi / 72.;
-
- cafont->size = size;
+ cafont->size = abs_size;
/* When synthesizing italics, apply a shear matrix matching what Cocoa
* does. Cairo quartz had transformed text wrong before 1.5.13, stay
else
cairo_matrix_init_identity (&font_matrix);
- cairo_matrix_scale (&font_matrix, size, size);
+ cairo_matrix_scale (&font_matrix, abs_size, abs_size);
_pango_cairo_font_private_initialize (&cafont->cf_priv,
(PangoCairoFont *) cafont,