summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-02-04 17:13:19 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-02-04 17:13:19 +0000
commit8adcead819b6bb6781f0b01c6b17175b2918af8f (patch)
tree204c6320b3725a06c132483dce21fcc70e1f6c73
parente14cca806c98818515054556df949c482519fc70 (diff)
downloadpango-8adcead819b6bb6781f0b01c6b17175b2918af8f.tar.gz
Move the FT_IS_SFNT(font) logic into pango_ft2_get_unknown glyph.
2006-02-04 Behdad Esfahbod <behdad@gnome.org> * pango/pangoft2.c, pango/pangoft2-render.c: Move the FT_IS_SFNT(font) logic into pango_ft2_get_unknown glyph.
-rw-r--r--ChangeLog5
-rw-r--r--pango/pangoft2-render.c10
-rw-r--r--pango/pangoft2.c21
3 files changed, 23 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index f70784db..7f2d0e33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-02-04 Behdad Esfahbod <behdad@gnome.org>
+
+ * pango/pangoft2.c, pango/pangoft2-render.c: Move the
+ FT_IS_SFNT(font) logic into pango_ft2_get_unknown glyph.
+
2006-02-03 Behdad Esfahbod <behdad@gnome.org>
* configure.in: AC_DEFINE the module version, such that
diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c
index 2a814861..30763d7b 100644
--- a/pango/pangoft2-render.c
+++ b/pango/pangoft2-render.c
@@ -241,13 +241,13 @@ pango_ft2_renderer_draw_glyph (PangoRenderer *renderer,
if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
- FT_Face face = pango_ft2_font_get_face (font);
- if (face && FT_IS_SFNT (face))
- glyph = pango_ft2_get_unknown_glyph (font);
- else
+ glyph = pango_ft2_get_unknown_glyph (font);
+ if (glyph == PANGO_GLYPH_EMPTY)
{
+ /* No unknown glyph found for the font, draw a box */
+
/* Since we only draw an empty box for FT2 renderer,
- * unify the rendered bitmaps in the cache.
+ * we unify the rendered bitmaps in the cache.
*/
glyph = PANGO_GLYPH_UNKNOWN_FLAG;
}
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index c20afdf5..901cd99a 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -316,11 +316,10 @@ pango_ft2_font_get_glyph_extents (PangoFont *font,
if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
- FT_Face face = pango_ft2_font_get_face (font);
- if (face && FT_IS_SFNT (face))
- glyph = pango_ft2_get_unknown_glyph (font);
- else
+ glyph = pango_ft2_get_unknown_glyph (font);
+ if (glyph == PANGO_GLYPH_EMPTY)
{
+ /* No unknown glyph found for the font, draw a box */
PangoFontMetrics *metrics = pango_font_get_metrics (font, NULL);
if (metrics)
@@ -471,16 +470,22 @@ pango_ft2_font_get_coverage (PangoFont *font,
* pango_ft2_get_unknown_glyph:
* @font: a #PangoFont
*
- * Return the index of a glyph suitable for drawing unknown characters.
+ * Return the index of a glyph suitable for drawing unknown characters,
+ * or %PANGO_GLYPH_EMPTY if no suitable glyph found.
*
- * Use pango_fc_font_get_unknown_glyph() instead.
+ * For most uses, pango_fc_font_get_unknown_glyph() should be used instead.
*
- * Return value: a glyph index into @font
+ * Return value: a glyph index into @font, or %PANGO_GLYPH_EMPTY
**/
PangoGlyph
pango_ft2_get_unknown_glyph (PangoFont *font)
{
- return 0;
+ FT_Face face = pango_ft2_font_get_face (font);
+ if (face && FT_IS_SFNT (face))
+ /* TrueType fonts have an 'unknown glyph' box on glyph index 0 */
+ return 0;
+ else
+ return PANGO_GLYPH_EMPTY;
}
typedef struct