diff options
author | Owen Taylor <otaylor@redhat.com> | 2000-12-20 04:41:36 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-12-20 04:41:36 +0000 |
commit | 6ffa65f461d8a78d9190c0d9903a9ecd7273774a (patch) | |
tree | f4245e3e7e13771b62224fbdf473edd96d7e7765 /pango/pangoxft-fontmap.c | |
parent | 1a603d00f370167b75a965416080f45824d5b515 (diff) | |
download | pango-6ffa65f461d8a78d9190c0d9903a9ecd7273774a.tar.gz |
Since Xft may only be available statically without shlib deps, check for
Tue Dec 19 22:47:16 2000 Owen Taylor <otaylor@redhat.com>
* configure.in pango-config.in pangoxft.pc.in
modules/basic/Makefile.am: Since Xft may only be available
statically without shlib deps, check for FreeType libs explicitly
and include them when linking, otherwise things won't work. Also,
define FREETYPE_CFLAGS from freetype-config --cflags.
* modules/basic/basic-xft.c pango/pangoxft-font{,map}.c: Fool
Xft into not converting glyph indices by loading the
face unencoded then calling FT_Set_Charmap ourselves.
* pango/Makefile.am pango/pango-ot.h pango/opentype/* :Add start
of opentype handling - most of the actually meat of the code here
is the OpenType layout code from FreeType 1 ported to freetype2
and adapted slighlty for our purposes. Also, includes a
incomplete OpenType-table-dumping code useful for figuring
out what is going on.
* pango/pangoxft.h pango/pangoxft-font.h: Add calls for
getting FT_Face and PangoOTInfo from PangoXftFont.
* modules/arabic/{Makefile.am,arabic-ot.[ch],arabic-xft.c}:
Initial support for rendering Arabic with OpenType fonts.
Diffstat (limited to 'pango/pangoxft-fontmap.c')
-rw-r--r-- | pango/pangoxft-fontmap.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c index 03695f1b..df1e31f7 100644 --- a/pango/pangoxft-fontmap.c +++ b/pango/pangoxft-fontmap.c @@ -23,6 +23,8 @@ #include "pangoxft.h" #include "pangoxft-private.h" +#include "X11/Xft/XftFreetype.h" + #define PANGO_TYPE_XFT_FONT_MAP (pango_xft_font_map_get_type ()) #define PANGO_XFT_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_XFT_FONT_MAP, PangoXftFontMap)) #define PANGO_XFT_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_XFT_FONT_MAP, PangoXftFontMapClass)) @@ -295,6 +297,7 @@ pango_xft_font_map_list_fonts (PangoFontMap *fontmap, fontset = XftListFonts (xfontmap->display, xfontmap->screen, XFT_ENCODING, XftTypeString, "iso10646-1", XFT_FAMILY, XftTypeString, family, + XFT_CORE, XftTypeBool, False, NULL, XFT_FAMILY, XFT_STYLE, @@ -304,6 +307,7 @@ pango_xft_font_map_list_fonts (PangoFontMap *fontmap, else fontset = XftListFonts (xfontmap->display, xfontmap->screen, XFT_ENCODING, XftTypeString, "iso10646-1", + XFT_CORE, XftTypeBool, False, NULL, XFT_FAMILY, XFT_STYLE, @@ -337,6 +341,7 @@ pango_xft_font_map_list_families (PangoFontMap *fontmap, int i; fontset = XftListFonts (xfontmap->display, xfontmap->screen, + XFT_CORE, XftTypeBool, False, XFT_ENCODING, XftTypeString, "iso10646-1", NULL, XFT_FAMILY, @@ -402,7 +407,12 @@ pango_xft_font_map_load_font (PangoFontMap *fontmap, else weight = XFT_WEIGHT_BLACK; + /* To fool Xft into not munging glyph indices, we open it as glyphs-fontspecific + * then set the encoding ourself + */ xft_font = XftFontOpen (xfontmap->display, xfontmap->screen, + XFT_ENCODING, XftTypeString, "glyphs-fontspecific", + XFT_CORE, XftTypeBool, False, XFT_FAMILY, XftTypeString, description->family_name, XFT_WEIGHT, XftTypeInteger, weight, XFT_SLANT, XftTypeInteger, slant, @@ -410,11 +420,39 @@ pango_xft_font_map_load_font (PangoFontMap *fontmap, NULL); if (xft_font) - font = _pango_xft_font_new (fontmap, description, xft_font); + { + FT_Face face; + FT_Error error; + + int charmap; + + g_assert (!xft_font->core); + + face = xft_font->u.ft.font->face; + + for (charmap = 0; charmap < face->num_charmaps; charmap++) + if (face->charmaps[charmap]->encoding == ft_encoding_unicode) + break; + + if (charmap == face->num_charmaps) + goto error; + + error = FT_Set_Charmap(face, face->charmaps[charmap]); + + if (error) + goto error; + + font = _pango_xft_font_new (fontmap, description, xft_font); + } else return NULL; return (PangoFont *)font; + + error: + + XftFontClose (xfontmap->display, xft_font); + return NULL; } void @@ -496,4 +534,5 @@ _pango_xft_font_map_get_info (PangoFontMap *fontmap, *display = xfontmap->display; if (screen) *screen = xfontmap->screen; + } |