diff options
author | Owen Taylor <otaylor@src.gnome.org> | 2002-06-04 00:20:51 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-06-04 00:20:51 +0000 |
commit | ffcea1aa2e1c0f8a46b26bf90444942c421418ba (patch) | |
tree | dc6fb251146c49ea7422e05660e4568a8e724e46 /pango/pangoft2.c | |
parent | 8de41bc064a69ead1e38ca8c8b6483bb34b98d64 (diff) | |
download | pango-ffcea1aa2e1c0f8a46b26bf90444942c421418ba.tar.gz |
on Jun 3 18:56:09 2002 Owen Taylor <otaylor@redhat.com>
Xft2 and fontconfig conversion, based largely on a patch
from Keith Packard.
* configure.in acconfig.h: Add checks for fontconfig, switch
Xft checks to switch for Xft2 using pkg-config.
* pangoxft.pc.in pangoxft.pc.in
modules/{arabic,basic,hebrew,indic,tamil}/Makefile.am
pango/Makefile.am: Reflect new Xft/fontconfig dependencies.
* pango/pangoxft-private.h pango/pangoxft-fontmap.c
modules/arabic/arabic-xft.c modules/indic/indic-xft.c:
Switch over to using Xft2 and fontconfig.
* pango/pangoft2.c pango/pangoft2-fontmap.c pango/pangoft2-private.h
pango/pango/Makefile.am: Remove usage of mini-xft in
favor of fontconfig.
* pango/pango-ot.h pango/opentype/pango-ot-info.c pango/pangoxft.h
modules/arabic/arabic-{xft,ft2}.c modules/indic/indic-xft.c:
Attach OpenType information directly to the FT_Face
structure using FT_Generic.
* modules/tamil/Makefile.am modules/tamil/tamil-xft.c
configure.in: Remove this module, no longer needed.
* pango/pangoxft-font.c (pango_xft_real_render): Coalesce
calls to Xft rendering functions.
Diffstat (limited to 'pango/pangoft2.c')
-rw-r--r-- | pango/pangoft2.c | 61 |
1 files changed, 35 insertions, 26 deletions
diff --git a/pango/pangoft2.c b/pango/pangoft2.c index aa5066cb..cd60be74 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -95,7 +95,7 @@ static GType pango_ft2_font_get_type (void); PangoFT2Font * _pango_ft2_font_new (PangoFontMap *fontmap, - MiniXftPattern *pattern) + FcPattern *pattern) { PangoFT2Font *ft2font; double d; @@ -112,7 +112,7 @@ _pango_ft2_font_new (PangoFontMap *fontmap, ft2font->description = _pango_ft2_font_desc_from_pattern (pattern, TRUE); ft2font->face = NULL; - if (MiniXftPatternGetDouble (pattern, XFT_PIXEL_SIZE, 0, &d) == MiniXftResultMatch) + if (FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &d) == FcResultMatch) ft2font->size = d*PANGO_SCALE; _pango_ft2_font_map_add (ft2font->fontmap, ft2font); @@ -136,48 +136,47 @@ pango_ft2_font_get_face (PangoFont *font) PangoFT2Font *ft2font = (PangoFT2Font *)font; FT_Face face; FT_Error error; - MiniXftPattern *pattern; - char *filename; + FcPattern *pattern; + FcChar8 *filename; int id; pattern = ft2font->font_pattern; if (!ft2font->face) { - if (MiniXftPatternGetString (pattern, XFT_FILE, 0, &filename) != MiniXftResultMatch) + if (FcPatternGetString (pattern, FC_FILE, 0, &filename) != FcResultMatch) goto bail0; - if (MiniXftPatternGetInteger (pattern, XFT_INDEX, 0, &id) != MiniXftResultMatch) + if (FcPatternGetInteger (pattern, FC_INDEX, 0, &id) != FcResultMatch) goto bail0; error = FT_New_Face (_pango_ft2_font_map_get_library (ft2font->fontmap), - filename, id, &ft2font->face); + (char *) filename, id, &ft2font->face); if (error) { - MiniXftPattern *sans; - MiniXftPattern *matched; - MiniXftResult result; - char *filename2 = NULL; + FcPattern *sans; + FcPattern *matched; + FcResult result; + FcChar8 *filename2 = NULL; gchar *name; bail0: - sans = MiniXftPatternBuild (0, - XFT_FAMILY, MiniXftTypeString, "sans", - XFT_ENCODING, MiniXftTypeString, "glyphs-fontspecific", - XFT_SIZE, MiniXftTypeDouble, (double)pango_font_description_get_size (ft2font->description)/PANGO_SCALE, - NULL); + sans = FcPatternBuild (NULL, + FC_FAMILY, FcTypeString, "sans", + FC_SIZE, FcTypeDouble, (double)pango_font_description_get_size (ft2font->description)/PANGO_SCALE, + NULL); - matched = MiniXftFontMatch ((Display *)1, 0, sans, &result); + matched = FcFontMatch (0, sans, &result); - if (MiniXftPatternGetString (matched, XFT_FILE, 0, &filename2) != MiniXftResultMatch) + if (FcPatternGetString (matched, FC_FILE, 0, &filename2) != FcResultMatch) goto bail1; - if (MiniXftPatternGetInteger (matched, XFT_INDEX, 0, &id) != MiniXftResultMatch) + if (FcPatternGetInteger (matched, FC_INDEX, 0, &id) != FcResultMatch) goto bail1; error = FT_New_Face (_pango_ft2_font_map_get_library (ft2font->fontmap), - filename2, id, &ft2font->face); + (char *) filename2, id, &ft2font->face); if (error) @@ -194,8 +193,8 @@ pango_ft2_font_get_face (PangoFont *font) g_free (name); } - MiniXftPatternDestroy (sans); - MiniXftPatternDestroy (matched); + FcPatternDestroy (sans); + FcPatternDestroy (matched); } ft2font->face->generic.data = 0; } @@ -219,6 +218,16 @@ pango_ft2_font_get_face (PangoFont *font) return face; } +static double pango_ft2_resolution = 75.0; + +void +pango_ft2_default_substitute (FcPattern *pattern) +{ + FcValue v; + if (FcPatternGet (pattern, FC_DPI, 0, &v) == FcResultNoMatch) + FcPatternAddDouble (pattern, FC_DPI, pango_ft2_resolution); +} + /** * pango_ft2_get_context: * @dpi_x: the horizontal dpi of the target device @@ -244,7 +253,7 @@ pango_ft2_get_context (double dpi_x, double dpi_y) pango_module_register (&_pango_included_ft2_modules[i]); } - MiniXftSetDPI (dpi_y); + pango_ft2_resolution = dpi_y; result = pango_context_new (); pango_context_set_font_map (result, pango_ft2_font_map_for_display ()); @@ -738,7 +747,7 @@ pango_ft2_font_finalize (GObject *object) } pango_font_description_free (ft2font->description); - MiniXftPatternDestroy (ft2font->font_pattern); + FcPatternDestroy (ft2font->font_pattern); g_object_unref (G_OBJECT (ft2font->fontmap)); @@ -793,11 +802,11 @@ pango_ft2_font_get_coverage (PangoFont *font, PangoLanguage *language) { PangoFT2Font *ft2font = (PangoFT2Font *)font; - char *filename = NULL; + FcChar8 *filename = NULL; FT_Face face; PangoCoverage *coverage; - MiniXftPatternGetString (ft2font->font_pattern, XFT_FILE, 0, &filename); + FcPatternGetString (ft2font->font_pattern, FC_FILE, 0, &filename); coverage = _pango_ft2_font_map_get_coverage (ft2font->fontmap, filename); |