summaryrefslogtreecommitdiff
path: root/pango/pangoxft-font.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-08-19 18:10:28 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-08-19 18:10:28 +0000
commit2378ff9771db2606e11b27cba5bd802463699d41 (patch)
treebfb35594c26becacae1c3aa1d72395335c10edd8 /pango/pangoxft-font.c
parent2c1bc52c9d3429c34a26ad643eff8f84c339034e (diff)
downloadpango-2378ff9771db2606e11b27cba5bd802463699d41.tar.gz
Delete the FC_PATTERN out of the result of FcFontRenderPrepare(), because
Mon Aug 19 14:07:02 2002 Owen Taylor <otaylor@redhat.com> * pango/pangofc-fontmap.cI (pango_fc_font_map_get_patterns): Delete the FC_PATTERN out of the result of FcFontRenderPrepare(), because it makes identical fonts look like not identical fonts. * pango/pangofc-fontmap.cI (uniquify_pattern): pango/pangoft-fontmap.c pango/pangoxft-fontmap.c: Use a hash table to uniquify the patterns we cache to save memory and speed lookups. * pango/pangoxft-font.c (pango_xft_font_get_font): Split into a public wrappper (with g_return_if_fail()) around a static internal function (without check). * pango/pangoxft-fontmap.c (_pango_xft_font_map_get_info): Remove checked cast, since it was showing up high on profiles.
Diffstat (limited to 'pango/pangoxft-font.c')
-rw-r--r--pango/pangoxft-font.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index bd388787..2d072757 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -69,6 +69,7 @@ static void pango_xft_font_get_glyph_extents (PangoFont
static PangoFontMetrics * pango_xft_font_get_metrics (PangoFont *font,
PangoLanguage *language);
+static XftFont *xft_font_get_font (PangoFont *font);
GType
pango_xft_font_get_type (void)
@@ -171,7 +172,7 @@ get_mini_font (PangoFont *font)
xfont->mini_font = pango_font_map_load_font (xfont->fontmap, NULL, desc);
pango_font_description_free (desc);
- mini_xft = pango_xft_font_get_font (xfont->mini_font);
+ mini_xft = xft_font_get_font (xfont->mini_font);
for (i = 0 ; i < 16 ; i++)
{
@@ -257,7 +258,7 @@ pango_xft_real_render (Display *display,
gint y)
{
PangoXftFont *xfont = PANGO_XFT_FONT (font);
- XftFont *xft_font = pango_xft_font_get_font (font);
+ XftFont *xft_font = xft_font_get_font (font);
int i;
int x_off = 0;
#define N_XFT_LOCAL 1024
@@ -301,7 +302,7 @@ pango_xft_real_render (Display *display,
int j, k;
PangoFont *mini_font = get_mini_font (font);
- XftFont *mini_xft = pango_xft_font_get_font (mini_font);
+ XftFont *mini_xft = xft_font_get_font (mini_font);
glyph &= ~PANGO_XFT_UNKNOWN_FLAG;
@@ -450,7 +451,7 @@ pango_xft_font_get_metrics (PangoFont *font,
if (xfont->fontmap)
{
- xft_font = pango_xft_font_get_font (font);
+ xft_font = xft_font_get_font (font);
_pango_xft_font_map_get_info (xfont->fontmap, &display, NULL);
context = pango_xft_get_context (display, 0);
@@ -562,7 +563,7 @@ pango_xft_font_get_glyph_extents (PangoFont *font,
PangoRectangle *logical_rect)
{
PangoXftFont *xfont = (PangoXftFont *)font;
- XftFont *xft_font = pango_xft_font_get_font (font);
+ XftFont *xft_font = xft_font_get_font (font);
XGlyphInfo extents;
Display *display;
@@ -700,24 +701,14 @@ load_fallback_font (PangoXftFont *xfont)
xfont->xft_font = xft_font;
}
-/**
- * pango_xft_font_get_font:
- * @font: a #PangoFont.
- *
- * Returns the XftFont of a font.
- *
- * Returns: the XftFont associated to @font.
- **/
-XftFont *
-pango_xft_font_get_font (PangoFont *font)
+static XftFont *
+xft_font_get_font (PangoFont *font)
{
PangoXftFont *xfont;
Display *display;
int screen;
- g_return_val_if_fail (PANGO_XFT_IS_FONT (font), NULL);
-
- xfont = PANGO_XFT_FONT (font);
+ xfont = (PangoXftFont *)font;
if (xfont->xft_font == NULL)
{
@@ -738,6 +729,22 @@ pango_xft_font_get_font (PangoFont *font)
}
/**
+ * pango_xft_font_get_font:
+ * @font: a #PangoFont.
+ *
+ * Returns the XftFont of a font.
+ *
+ * Returns: the XftFont associated to @font.
+ **/
+XftFont *
+pango_xft_font_get_font (PangoFont *font)
+{
+ g_return_val_if_fail (PANGO_XFT_IS_FONT (font), NULL);
+
+ return xft_font_get_font (font);
+}
+
+/**
* pango_xft_font_get_display:
* @font: a #PangoFont.
*
@@ -793,7 +800,7 @@ pango_xft_font_lock_face (PangoFont *font)
g_return_val_if_fail (PANGO_XFT_IS_FONT (font), NULL);
- xft_font = pango_xft_font_get_font (font);
+ xft_font = xft_font_get_font (font);
return XftLockFace (xft_font);
}
@@ -813,7 +820,7 @@ pango_xft_font_unlock_face (PangoFont *font)
g_return_if_fail (PANGO_XFT_IS_FONT (font));
- xft_font = pango_xft_font_get_font (font);
+ xft_font = xft_font_get_font (font);
XftUnlockFace (xft_font);
}
@@ -838,7 +845,7 @@ pango_xft_font_get_glyph (PangoFont *font,
g_return_val_if_fail (PANGO_XFT_IS_FONT (font), 0);
- xft_font = pango_xft_font_get_font (font);
+ xft_font = xft_font_get_font (font);
return XftCharIndex (NULL, xft_font, wc);
}
@@ -860,7 +867,7 @@ pango_xft_font_has_char (PangoFont *font,
g_return_val_if_fail (PANGO_XFT_IS_FONT (font), 0);
- xft_font = pango_xft_font_get_font (font);
+ xft_font = xft_font_get_font (font);
return XftCharExists (NULL, xft_font, wc);
}