summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-07-26 23:12:54 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-07-26 23:12:54 +0000
commitcb4479a9348f90c2b8cbbdc2de8d1d88eb788d34 (patch)
treed6e793712350429cc28fced7f201457fd1656765 /pango
parentc613cb2ce4eb5940c2c414deff5544bb90ae9303 (diff)
downloadpango-cb4479a9348f90c2b8cbbdc2de8d1d88eb788d34.tar.gz
Patch from Theppitak Karoonboonyanan that factors out common code from
Fri Jul 26 18:48:49 2002 Owen Taylor <otaylor@redhat.com> * configure.in modules/thai/Makefile.am modules/thai/thai-shaper.[ch] modules/thai/thai-xft.c modules/thai/thai-x.c: Patch from Theppitak Karoonboonyanan that factors out common code from thai-x.c and adds a new Xft shaper for Thai. (#78346) * pango/pangoxft.h pango/pangoxft-font.c: Add pango_xft_font_has_char() to optimize for cases where we don't actually need to load the font. * pango/pangoxft.h: Document pango_xft_font_get_glyph(). * modules/basic/basic-xft.c (basic_engine_shape): Clean up an unused variable warning.
Diffstat (limited to 'pango')
-rw-r--r--pango/pangoxft-font.c40
-rw-r--r--pango/pangoxft.h5
2 files changed, 42 insertions, 3 deletions
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index 4f82bb8e..9f505a7e 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -841,8 +841,21 @@ pango_xft_font_unlock_face (PangoFont *font)
XftUnlockFace (xft_font);
}
+/**
+ * pango_xft_font_get_glyph:
+ * @font: a #PangoFont for the Xft backend
+ * @wc: Unicode codepoint to look up
+ *
+ * Gets the glyph index for a given unicode codepoint
+ * for @font. If you only want to determine
+ * whether the font has the glyph, use pango_xft_font_has_char().
+ *
+ * Return value: the glyph index, or 0, if the unicode
+ * codepoint doesn't exist in the font.
+ **/
guint
-pango_xft_font_get_glyph (PangoFont *font, gunichar wc)
+pango_xft_font_get_glyph (PangoFont *font,
+ gunichar wc)
{
XftFont *xft_font;
@@ -850,5 +863,28 @@ pango_xft_font_get_glyph (PangoFont *font, gunichar wc)
xft_font = pango_xft_font_get_font (font);
- return XftCharIndex (0, xft_font, wc);
+ return XftCharIndex (NULL, xft_font, wc);
}
+
+/**
+ * pango_xft_font_has_char:
+ * @font: a #PangoFont for the Xft backend
+ * @wc: Unicode codepoint to look up
+ *
+ * Determines whether @font has a glyph for the codepoint @wc.
+ *
+ * Return value: %TRUE if @font has the requested codepoint.
+ **/
+gboolean
+pango_xft_font_has_char (PangoFont *font,
+ gunichar wc)
+{
+ XftFont *xft_font;
+
+ g_return_val_if_fail (PANGO_XFT_IS_FONT (font), 0);
+
+ xft_font = pango_xft_font_get_font (font);
+
+ return XftCharExists (NULL, xft_font, wc);
+}
+
diff --git a/pango/pangoxft.h b/pango/pangoxft.h
index 24f14b7e..2fa381f8 100644
--- a/pango/pangoxft.h
+++ b/pango/pangoxft.h
@@ -80,7 +80,10 @@ GType pango_xft_font_get_type (void);
XftFont * pango_xft_font_get_font (PangoFont *font);
FT_Face pango_xft_font_lock_face (PangoFont *font);
void pango_xft_font_unlock_face (PangoFont *font);
-guint pango_xft_font_get_glyph (PangoFont *font, gunichar wc);
+guint pango_xft_font_get_glyph (PangoFont *font,
+ gunichar wc);
+gboolean pango_xft_font_has_char (PangoFont *font,
+ gunichar wc);
Display * pango_xft_font_get_display (PangoFont *font);
PangoGlyph pango_xft_font_get_unknown_glyph (PangoFont *font,
gunichar wc);