summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog71
-rw-r--r--modules/arabic/arabic-fc.c4
-rw-r--r--modules/basic/basic-atsui.c2
-rw-r--r--modules/basic/basic-fc.c4
-rw-r--r--modules/basic/basic-win32.c4
-rw-r--r--modules/basic/basic-x.c10
-rw-r--r--modules/hangul/hangul-fc.c24
-rw-r--r--modules/hebrew/hebrew-fc.c4
-rw-r--r--modules/indic/indic-fc.c4
-rw-r--r--modules/khmer/khmer-fc.c2
-rw-r--r--modules/syriac/syriac-fc.c4
-rw-r--r--modules/thai/thai-fc.c2
-rw-r--r--modules/tibetan/tibetan-fc.c2
-rw-r--r--pango/fonts.c9
-rw-r--r--pango/pango-engine-private.h6
-rw-r--r--pango/pango-types.h3
-rw-r--r--pango/pangocairo-fcfont.c20
-rw-r--r--pango/pangocairo-font.c6
-rw-r--r--pango/pangocairo-private.h2
-rw-r--r--pango/pangocairo-render.c32
-rw-r--r--pango/pangofc-decoder.c6
-rw-r--r--pango/pangofc-font.c10
-rw-r--r--pango/pangoft2-render.c5
-rw-r--r--pango/pangoft2.c11
-rw-r--r--pango/pangowin32.c24
-rw-r--r--pango/pangox.c20
-rw-r--r--pango/pangoxft-font.c44
-rw-r--r--pango/pangoxft-private.h2
-rw-r--r--pango/pangoxft-render.c6
-rw-r--r--pango/shape.c15
30 files changed, 205 insertions, 153 deletions
diff --git a/ChangeLog b/ChangeLog
index 4290e401..4459242f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
2006-02-02 Behdad Esfahbod <behdad@gnome.org>
+ * modules/arabic/arabic-fc.c, modules/basic/basic-atsui.c,
+ modules/basic/basic-fc.c, modules/basic/basic-win32.c,
+ modules/basic/basic-x.c, modules/hangul/hangul-fc.c,
+ modules/hebrew/hebrew-fc.c, modules/indic/indic-fc.c,
+ modules/khmer/khmer-fc.c, modules/syriac/syriac-fc.c,
+ modules/thai/thai-fc.c, modules/tibetan/tibetan-fc.c,
+ pango/fonts.c, pango/pango-engine-private.h pango/pango-types.h,
+ pango/pangocairo-fcfont.c, pango/pangocairo-font.c,
+ pango/pangocairo-private.h, pango/pangocairo-render.c,
+ pango/pangofc-decoder.c, pango/pangofc-font.c,
+ pango/pangoft2-render.c, pango/pangoft2.c pango/pangowin32.c,
+ pango/pangox.c, pango/pangoxft-font.c pango/pangoxft-private.h,
+ pango/pangoxft-render.c, pango/shape.c: Use PANGO_GLYPH_NULL for
+ when no glyph should be drawn. Use PANGO_GLYPH_UNKNOWN_FLAG for
+ all backends to mark unknown flags. There's no need for
+ pango_font_get_unknown_glyph() anymore, since all backends know
+ how to handle PANGO_GLYPH_UNKNOWN_FLAG gracefully. We may add
+ that in the future however. (fixes bug #73147, closes bug #329524)
+
+2006-02-02 Behdad Esfahbod <behdad@gnome.org>
+
* pango/pango-utils.c (read_config_file): Fix GKeyFile transition.
2006-02-01 Behdad Esfahbod <behdad@gnome.org>
@@ -75,14 +96,14 @@
2006-01-31 Behdad Esfahbod <behdad@gnome.org>
- * pango/fonts.c, pango/glyphstring.c pango/pango-attributes.c
- pango/pango-color.c, pango/pango-context.c
- pango/pango-coverage.c, pango/pango-fontset.c
- pango/pango-glyph-item.c, pango/pango-item.c
- pango/pango-layout.c, pango/pango-ot-buffer.c
- pango/pango-ot-info.c, pango/pango-ot-ruleset.c
- pango/pango-script.c, pango/pango-tabs.c pango/pango-utils.c
- pango/pangocairo-fcfontmap.c, pango/pangocairo-fontmap.c
+ * pango/fonts.c, pango/glyphstring.c pango/pango-attributes.c,
+ pango/pango-color.c, pango/pango-context.c,
+ pango/pango-coverage.c, pango/pango-fontset.c,
+ pango/pango-glyph-item.c, pango/pango-item.c,
+ pango/pango-layout.c, pango/pango-ot-buffer.c,
+ pango/pango-ot-info.c, pango/pango-ot-ruleset.c,
+ pango/pango-script.c, pango/pango-tabs.c pango/pango-utils.c,
+ pango/pangocairo-fcfontmap.c, pango/pangocairo-fontmap.c,
pango/pangox-fontcache.c, pango/pangoxft-render.c:
Improve documentation for functions allocating memory,
on how the object should be freed.
@@ -126,27 +147,27 @@
2006-01-29 Behdad Esfahbod <behdad@gnome.org>
- * modules/arabic/arabic-fc.c, modules/basic/basic-fc.c
- modules/hebrew/hebrew-fc.c, modules/indic/indic-fc.c
- modules/khmer/khmer-fc.c, modules/syriac/syriac-fc.c
- modules/thai/thai-ot.c, modules/thai/thai-shaper.c
+ * modules/arabic/arabic-fc.c, modules/basic/basic-fc.c,
+ modules/hebrew/hebrew-fc.c, modules/indic/indic-fc.c,
+ modules/khmer/khmer-fc.c, modules/syriac/syriac-fc.c,
+ modules/thai/thai-ot.c, modules/thai/thai-shaper.c,
modules/tibetan/tibetan-fc.c: If locking font face failed,
do not assert, just return zero glyphs with an implicit
warning.
- * pango/fonts.c, pango/glyphstring.c pango/modules.c
- pango/pango-color.c, pango/pango-context.c
- pango/pango-coverage.c, pango/pango-fontmap.c
- pango/pango-glyph-item.c, pango/pango-item.c
- pango/pango-layout.c, pango/pango-markup.c
- pango/pango-ot-buffer.c, pango/pango-script.c
- pango/pango-tabs.c, pango/pango-utils.c
- pango/pangoatsui-fontmap.c, pango/pangocairo-fcfont.c
- pango/pangocairo-fcfontmap.c, pango/pangocairo-fontmap.c
- pango/pangocairo-win32font.c, pango/pangofc-font.c
- pango/pangofc-fontmap.c, pango/pangoft2-fontmap.c
- pango/pangoft2-render.c, pango/pangoft2.c
- pango/pangowin32-fontcache.c, pango/pangoxft-font.c
+ * pango/fonts.c, pango/glyphstring.c pango/modules.c,
+ pango/pango-color.c, pango/pango-context.c,
+ pango/pango-coverage.c, pango/pango-fontmap.c,
+ pango/pango-glyph-item.c, pango/pango-item.c,
+ pango/pango-layout.c, pango/pango-markup.c,
+ pango/pango-ot-buffer.c, pango/pango-script.c,
+ pango/pango-tabs.c, pango/pango-utils.c,
+ pango/pangoatsui-fontmap.c, pango/pangocairo-fcfont.c,
+ pango/pangocairo-fcfontmap.c, pango/pangocairo-fontmap.c,
+ pango/pangocairo-win32font.c, pango/pangofc-font.c,
+ pango/pangofc-fontmap.c, pango/pangoft2-fontmap.c,
+ pango/pangoft2-render.c, pango/pangoft2.c,
+ pango/pangowin32-fontcache.c, pango/pangoxft-font.c,
pango/pangoxft-render.c, pango/break.c pango/ellipsize.c:
Use g_slice for allocating all types. Also, change some
g_error's to g_critical's...
diff --git a/modules/arabic/arabic-fc.c b/modules/arabic/arabic-fc.c
index d72aebc1..84663d45 100644
--- a/modules/arabic/arabic-fc.c
+++ b/modules/arabic/arabic-fc.c
@@ -209,13 +209,13 @@ fallback_shape (PangoEngineShape *engine,
if (pango_is_zero_width (wc))
{
- set_glyph (font, glyphs, i, p - text, 0);
+ set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_NULL);
}
else
{
index = pango_fc_font_get_glyph (fc_font, wc);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
index = pango_fc_font_get_unknown_glyph (fc_font, wc);
set_glyph (font, glyphs, i, p - text, index);
diff --git a/modules/basic/basic-atsui.c b/modules/basic/basic-atsui.c
index 08391d6a..72d83db4 100644
--- a/modules/basic/basic-atsui.c
+++ b/modules/basic/basic-atsui.c
@@ -160,7 +160,7 @@ basic_engine_shape (PangoEngineShape *engine,
if (pango_is_zero_width (wc))
{
- set_glyph (font, glyphs, i, p - text, 0);
+ set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_NULL);
}
else
{
diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c
index c260f42b..f73f1a56 100644
--- a/modules/basic/basic-fc.c
+++ b/modules/basic/basic-fc.c
@@ -166,13 +166,13 @@ fallback_shape (PangoEngineShape *engine,
if (pango_is_zero_width (wc))
{
- set_glyph (font, glyphs, i, p - text, 0);
+ set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_NULL);
}
else
{
index = pango_fc_font_get_glyph (fc_font, wc);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
{
index = pango_fc_font_get_unknown_glyph (fc_font, wc);
set_glyph (font, glyphs, i, p - text, index);
diff --git a/modules/basic/basic-win32.c b/modules/basic/basic-win32.c
index 58624293..433eb21a 100644
--- a/modules/basic/basic-win32.c
+++ b/modules/basic/basic-win32.c
@@ -1003,12 +1003,12 @@ basic_engine_shape (PangoEngineShape *engine,
if (pango_is_zero_width (wc))
{
- set_glyph (font, glyphs, i, p - text, 0);
+ set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_NULL);
}
else
{
index = find_char (font, wc);
- if (index)
+ if (index != PANGO_GLYPH_NULL)
{
set_glyph (font, glyphs, i, p - text, index);
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c
index 0ff0f863..1e0a66a0 100644
--- a/modules/basic/basic-x.c
+++ b/modules/basic/basic-x.c
@@ -284,7 +284,7 @@ find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input)
}
}
- return 0;
+ return PANGO_GLYPH_NULL;
}
static void
@@ -610,12 +610,12 @@ basic_engine_shape (PangoEngineShape *engine,
if (pango_is_zero_width (wc))
{
- set_glyph (font, glyphs, i, p - text, 0);
+ set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_NULL);
}
else
{
index = find_char (cache, font, wc, input);
- if (index)
+ if (index != PANGO_GLYPH_NULL)
{
set_glyph (font, glyphs, i, p - text, index);
@@ -640,7 +640,7 @@ basic_engine_shape (PangoEngineShape *engine,
}
}
else
- set_glyph (font, glyphs, i, p - text, pango_x_get_unknown_glyph (font));
+ set_glyph (font, glyphs, i, p - text, pango_x_font_get_unknown_glyph (font, wc));
}
p = g_utf8_next_char (p);
@@ -680,7 +680,7 @@ basic_engine_covers (PangoEngineShape *engine,
g_unichar_to_utf8 (wc, buf);
- return find_char (cache, font, wc, buf) ? PANGO_COVERAGE_EXACT : PANGO_COVERAGE_NONE;
+ return find_char (cache, font, wc, buf) != PANGO_GLYPH_NULL ? PANGO_COVERAGE_EXACT : PANGO_COVERAGE_NONE;
}
static void
diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c
index 991b305f..5d3e0f73 100644
--- a/modules/hangul/hangul-fc.c
+++ b/modules/hangul/hangul-fc.c
@@ -138,7 +138,7 @@ render_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs,
index = find_char (font, tone);
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- if (index)
+ if (index != PANGO_GLYPH_NULL)
{
set_glyph_tone (font, glyphs, *n_glyphs, cluster_offset, index);
}
@@ -146,7 +146,7 @@ render_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs,
{
/* fall back : HTONE1(0x302e) => middle-dot, HTONE2(0x302f) => colon */
index = find_char (font, tone == HTONE1 ? 0x00b7 : 0x003a);
- if (index)
+ if (index != PANGO_GLYPH_NULL)
{
set_glyph_tone (font, glyphs, *n_glyphs, cluster_offset, index);
}
@@ -167,11 +167,11 @@ render_isolated_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs,
/* Find a base character to render the mark on
*/
int index = find_char (font, 0x25cc); /* DOTTED CIRCLE */
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
index = find_char (font, 0x25cb); /* WHITE CIRCLE, in KSC-5601 */
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
index = find_char (font, ' '); /* Space */
- if (!index) /* Unknown glyph box with 0000 in it */
+ if (index == PANGO_GLYPH_NULL) /* Unknown glyph box with 0000 in it */
index = find_char (font, get_unknown_glyph (font, 0));
/* Add the base character
@@ -217,7 +217,7 @@ render_syllable (PangoFont *font, gunichar *text, int length,
wc = S_FROM_LV(text[0], text[1]);
index = find_char (font, wc);
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
set_glyph (font, glyphs, *n_glyphs, cluster_offset,
get_unknown_glyph (font, wc));
else
@@ -236,7 +236,7 @@ render_syllable (PangoFont *font, gunichar *text, int length,
continue;
index = find_char (font, text[i]);
- if (index)
+ if (index != PANGO_GLYPH_NULL)
{
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
@@ -250,9 +250,9 @@ render_syllable (PangoFont *font, gunichar *text, int length,
for (j = 0; j < 3 && (__jamo_to_ksc5601[jindex][j] != 0); j++)
{
wc = __jamo_to_ksc5601[jindex][j] - KSC_JAMOBASE + UNI_JAMOBASE;
- index = (wc >= 0x3131) ? find_char (font, wc) : 0;
+ index = (wc >= 0x3131) ? find_char (font, wc) : PANGO_GLYPH_NULL;
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
set_glyph (font, glyphs, *n_glyphs, cluster_offset,
get_unknown_glyph (font, index));
else
@@ -264,7 +264,7 @@ render_syllable (PangoFont *font, gunichar *text, int length,
{
index = find_char (font, 0x3164);
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
set_glyph (font, glyphs, *n_glyphs, cluster_offset,
get_unknown_glyph (font, index));
else
@@ -287,12 +287,12 @@ render_basic (PangoFont *font, gunichar wc,
index = find_char (font, wc);
pango_glyph_string_set_size (glyphs, *n_glyphs + 1);
- if (index)
+ if (index != PANGO_GLYPH_NULL)
set_glyph (font, glyphs, *n_glyphs, cluster_offset, index);
else
{
if (pango_is_zero_width (wc))
- set_glyph (font, glyphs, *n_glyphs, cluster_offset, 0);
+ set_glyph (font, glyphs, *n_glyphs, cluster_offset, PANGO_GLYPH_NULL);
else
set_glyph (font, glyphs, *n_glyphs, cluster_offset,
get_unknown_glyph (font, wc));
diff --git a/modules/hebrew/hebrew-fc.c b/modules/hebrew/hebrew-fc.c
index 9ffe289c..fd12d983 100644
--- a/modules/hebrew/hebrew-fc.c
+++ b/modules/hebrew/hebrew-fc.c
@@ -348,13 +348,13 @@ hebrew_engine_shape (PangoEngineShape *engine,
if (pango_is_zero_width (wc)) /* Zero-width characters */
{
- pango_ot_buffer_add_glyph (buffer, 0, unknown_property, p - text);
+ pango_ot_buffer_add_glyph (buffer, PANGO_GLYPH_NULL, unknown_property, p - text);
}
else
{
index = pango_fc_font_get_glyph (fc_font, wc);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
{
pango_ot_buffer_add_glyph (buffer, pango_fc_font_get_unknown_glyph (fc_font, wc),
unknown_property, p - text);
diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c
index 3e3ec23e..187067cb 100644
--- a/modules/indic/indic-fc.c
+++ b/modules/indic/indic-fc.c
@@ -272,12 +272,12 @@ set_glyphs (PangoFont *font,
if (pango_is_zero_width (wcs[i]) &&
(!process_zwj || wcs[i] != 0x200D))
- glyph = 0;
+ glyph = PANGO_GLYPH_NULL;
else
{
glyph = pango_fc_font_get_glyph (fc_font, wcs[i]);
- if (!glyph)
+ if (glyph == PANGO_GLYPH_NULL)
glyph = pango_fc_font_get_unknown_glyph (fc_font, wcs[i]);
pango_ot_buffer_add_glyph (buffer, glyph, tags[i], i);
diff --git a/modules/khmer/khmer-fc.c b/modules/khmer/khmer-fc.c
index 75cebf87..ee585d31 100644
--- a/modules/khmer/khmer-fc.c
+++ b/modules/khmer/khmer-fc.c
@@ -508,7 +508,7 @@ static PangoGlyph
get_index (PangoFcFont *fc_font, gunichar wc)
{
PangoGlyph index = pango_fc_font_get_glyph (fc_font, wc);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
index = pango_fc_font_get_unknown_glyph (fc_font, wc);
return index;
}
diff --git a/modules/syriac/syriac-fc.c b/modules/syriac/syriac-fc.c
index 300ce5d3..60cadd36 100644
--- a/modules/syriac/syriac-fc.c
+++ b/modules/syriac/syriac-fc.c
@@ -201,13 +201,13 @@ fallback_shape (PangoEngineShape *engine,
if (pango_is_zero_width (wc))
{
- set_glyph (font, glyphs, i, p - text, 0);
+ set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_NULL);
}
else
{
index = pango_fc_font_get_glyph (fc_font, wc);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
index = pango_fc_font_get_unknown_glyph (fc_font, wc);
set_glyph (font, glyphs, i, p - text, index);
diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c
index 9a038e8b..46d77e71 100644
--- a/modules/thai/thai-fc.c
+++ b/modules/thai/thai-fc.c
@@ -228,7 +228,7 @@ thai_make_glyph_uni (ThaiFontInfo *font_info, gunichar uc)
PangoFcFont *fc_font = (PangoFcFont *)font_info->font;
result = pango_fc_font_get_glyph (fc_font, uc);
- if (result)
+ if (result != PANGO_GLYPH_NULL)
return result;
else
return pango_fc_font_get_unknown_glyph (fc_font, uc);
diff --git a/modules/tibetan/tibetan-fc.c b/modules/tibetan/tibetan-fc.c
index 77a10ca7..7294724b 100644
--- a/modules/tibetan/tibetan-fc.c
+++ b/modules/tibetan/tibetan-fc.c
@@ -473,7 +473,7 @@ static PangoGlyph
get_index (PangoFcFont *fc_font, gunichar wc)
{
PangoGlyph index = pango_fc_font_get_glyph (fc_font, wc);
- if (!index)
+ if (index == PANGO_GLYPH_NULL)
index = pango_fc_font_get_unknown_glyph (fc_font, wc);
return index;
}
diff --git a/pango/fonts.c b/pango/fonts.c
index 7bf49cbd..778366af 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -29,6 +29,7 @@
#include "pango-font.h"
#include "pango-fontmap.h"
#include "pango-utils.h"
+#include "pango-engine-private.h"
struct _PangoFontDescription
{
@@ -1178,15 +1179,15 @@ pango_font_get_glyph_extents (PangoFont *font,
{
ink_rect->x = 0;
ink_rect->y = 0;
- ink_rect->height = 12 * PANGO_SCALE;
- ink_rect->width = 12 * PANGO_SCALE;
+ ink_rect->height = PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE;
+ ink_rect->width = PANGO_UNKNOWN_GLYPH_WIDTH * PANGO_SCALE;
}
if (logical_rect)
{
logical_rect->x = 0;
logical_rect->y = 0;
- logical_rect->height = 12 * PANGO_SCALE;
- logical_rect->width = 12 * PANGO_SCALE;
+ logical_rect->height = PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE;
+ logical_rect->width = PANGO_UNKNOWN_GLYPH_WIDTH * PANGO_SCALE;
}
return;
}
diff --git a/pango/pango-engine-private.h b/pango/pango-engine-private.h
index d56a092f..676f2b11 100644
--- a/pango/pango-engine-private.h
+++ b/pango/pango-engine-private.h
@@ -40,6 +40,12 @@ PangoCoverageLevel _pango_engine_shape_covers (PangoEngineShape *engine,
PangoEngineShape *_pango_get_fallback_shaper (void);
+/* used for very rare and miserable situtations that we cannot even
+ * draw a hexbox
+ */
+#define PANGO_UNKNOWN_GLYPH_WIDTH 10
+#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
+
G_END_DECLS
#endif /* __PANGO_ENGINE_PRIVATE_H__ */
diff --git a/pango/pango-types.h b/pango/pango-types.h
index 6a198a60..2026102c 100644
--- a/pango/pango-types.h
+++ b/pango/pango-types.h
@@ -45,6 +45,9 @@ typedef struct _PangoLanguage PangoLanguage;
*/
typedef guint32 PangoGlyph;
+#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000)
+#define PANGO_GLYPH_NULL ((PangoGlyph)0xFFFFFFFF)
+
/* A rectangle. Used to store logical and physical extents of glyphs,
* runs, strings, etc.
*/
diff --git a/pango/pangocairo-fcfont.c b/pango/pangocairo-fcfont.c
index 38145711..49326088 100644
--- a/pango/pangocairo-fcfont.c
+++ b/pango/pangocairo-fcfont.c
@@ -346,13 +346,6 @@ pango_cairo_fc_font_get_glyph (PangoFcFont *font,
return entry->glyph;
}
-static PangoGlyph
-pango_cairo_fc_font_real_get_unknown_glyph (PangoFcFont *font,
- gunichar wc)
-{
- return wc | PANGO_CAIRO_UNKNOWN_FLAG;
-}
-
static void
pango_cairo_fc_font_glyph_extents_cache_init (PangoCairoFcFont *cffont)
{
@@ -445,12 +438,7 @@ pango_cairo_fc_font_get_glyph_extents (PangoFont *font,
if (cffont->glyph_extents_cache == NULL)
pango_cairo_fc_font_glyph_extents_cache_init (cffont);
- if (glyph & PANGO_CAIRO_UNKNOWN_FLAG)
- {
- _pango_cairo_get_glyph_extents_missing((PangoCairoFont *)font, glyph, ink_rect, logical_rect);
- return;
- }
- else if (!glyph)
+ if (glyph == PANGO_GLYPH_NULL)
{
if (ink_rect)
*ink_rect = cffont->font_extents;
@@ -458,6 +446,11 @@ pango_cairo_fc_font_get_glyph_extents (PangoFont *font,
*logical_rect = cffont->font_extents;
return;
}
+ else if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ {
+ _pango_cairo_get_glyph_extents_missing((PangoCairoFont *)font, glyph, ink_rect, logical_rect);
+ return;
+ }
entry = pango_cairo_fc_font_get_glyph_extents_cache_entry (cffont, glyph);
@@ -514,7 +507,6 @@ pango_cairo_fc_font_class_init (PangoCairoFcFontClass *class)
fc_font_class->lock_face = pango_cairo_fc_font_lock_face;
fc_font_class->unlock_face = pango_cairo_fc_font_unlock_face;
fc_font_class->get_glyph = pango_cairo_fc_font_get_glyph;
- fc_font_class->get_unknown_glyph = pango_cairo_fc_font_real_get_unknown_glyph;
fc_font_class->shutdown = pango_cairo_fc_font_shutdown;
#ifdef PROFILE_GLYPH_CACHE
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index c36711d1..7635b2d0 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -79,6 +79,7 @@ _pango_cairo_font_install (PangoCairoFont *font,
{
_pango_cairo_warning_history.font_install = TRUE;
g_critical ("_pango_cairo_font_install called with font == NULL, expect ugly output");
+ cairo_set_font_face (cr, NULL);
}
return;
}
@@ -133,6 +134,9 @@ _pango_cairo_get_hex_box_info (PangoCairoFont *cfont)
PangoFontDescription *mini_desc, *desc;
cairo_scaled_font_t *scaled_font, *scaled_mini_font;
+ if (!cfont)
+ return NULL;
+
hbi = (PangoCairoHexBoxInfo *) g_object_get_data (G_OBJECT (cfont), "hex_box_info");
if (hbi)
return hbi;
@@ -255,7 +259,7 @@ _pango_cairo_get_glyph_extents_missing (PangoCairoFont *cfont,
hbi = _pango_cairo_get_hex_box_info (cfont);
rows = hbi->rows;
- cols = ((glyph & ~PANGO_CAIRO_UNKNOWN_FLAG) > 0xffff ? 6 : 4) / rows;
+ cols = ((glyph & ~PANGO_GLYPH_UNKNOWN_FLAG) > 0xffff ? 6 : 4) / rows;
if (ink_rect)
{
diff --git a/pango/pangocairo-private.h b/pango/pangocairo-private.h
index 5f78b690..f4f74c51 100644
--- a/pango/pangocairo-private.h
+++ b/pango/pangocairo-private.h
@@ -27,8 +27,6 @@
G_BEGIN_DECLS
-#define PANGO_CAIRO_UNKNOWN_FLAG 0x10000000
-
#define PANGO_CAIRO_FONT_MAP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PANGO_TYPE_CAIRO_FONT_MAP, PangoCairoFontMapIface))
typedef struct _PangoCairoFontMapIface PangoCairoFontMapIface;
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 9d539260..ae2d853e 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -21,6 +21,7 @@
#include <config.h>
+#include "pango-engine-private.h"
#include "pangocairo-private.h"
typedef struct _PangoCairoRendererClass PangoCairoRendererClass;
@@ -74,17 +75,33 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
PangoCairoHexBoxInfo *hbi;
gunichar ch;
+ cairo_save (crenderer->cr);
+ cairo_get_current_point (crenderer->cr, &temp_x, &temp_y);
+
hbi = _pango_cairo_get_hex_box_info ((PangoCairoFont *)font);
+ if (!hbi)
+ {
+ cairo_rectangle (crenderer->cr,
+ cx + 1.5,
+ cy - 1.5,
+ (double)gi->geometry.width / PANGO_SCALE - 3.0,
+ PANGO_UNKNOWN_GLYPH_HEIGHT - 3.0);
+
+ if (!crenderer->do_path)
+ {
+ cairo_set_line_width (crenderer->cr, 1.0);
+ cairo_stroke (crenderer->cr);
+ }
- ch = gi->glyph & ~PANGO_CAIRO_UNKNOWN_FLAG;
+ goto done;
+ }
+
+ ch = gi->glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
rows = hbi->rows;
cols = (ch > 0xffff ? 6 : 4) / rows;
g_snprintf (buf, sizeof(buf), (ch > 0xffff) ? "%06X" : "%04X", ch);
- cairo_save (crenderer->cr);
- cairo_get_current_point (crenderer->cr, &temp_x, &temp_y);
-
cairo_rectangle (crenderer->cr,
cx + hbi->pad_x * 1.5,
cy + hbi->box_descent - hbi->pad_y * 0.5,
@@ -93,10 +110,8 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
if (!crenderer->do_path)
{
- cairo_save (crenderer->cr);
cairo_set_line_width (crenderer->cr, hbi->line_width);
cairo_stroke (crenderer->cr);
- cairo_restore (crenderer->cr);
}
_pango_cairo_font_install (PANGO_CAIRO_FONT (hbi->font), crenderer->cr);
@@ -122,6 +137,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
}
}
+done:
cairo_move_to (crenderer->cr, temp_x, temp_y);
cairo_restore (crenderer->cr);
}
@@ -160,12 +176,12 @@ pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
{
PangoGlyphInfo *gi = &glyphs->glyphs[i];
- if (gi->glyph)
+ if (gi->glyph != PANGO_GLYPH_NULL)
{
double cx = crenderer->x_offset + (double)(x + x_position + gi->geometry.x_offset) / PANGO_SCALE;
double cy = crenderer->y_offset + (double)(y + gi->geometry.y_offset) / PANGO_SCALE;
- if (gi->glyph & PANGO_CAIRO_UNKNOWN_FLAG)
+ if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
_pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
else
{
diff --git a/pango/pangofc-decoder.c b/pango/pangofc-decoder.c
index 77757b37..a2989528 100644
--- a/pango/pangofc-decoder.c
+++ b/pango/pangofc-decoder.c
@@ -70,8 +70,8 @@ pango_fc_decoder_get_charset (PangoFcDecoder *decoder,
* glyph is most convenient for it. (Usually whatever glyph is directly
* in the fonts character map table.)
*
- * Return value: the glyph index, or 0 if the glyph isn't covered
- * by the font.
+ * Return value: the glyph index, or %PANGO_GLYPH_NULL if the glyph isn't
+ * covered by the font.
*
* Since: 1.6
**/
@@ -80,7 +80,7 @@ pango_fc_decoder_get_glyph (PangoFcDecoder *decoder,
PangoFcFont *fcfont,
guint32 wc)
{
- g_return_val_if_fail (PANGO_IS_FC_DECODER (decoder), 0);
+ g_return_val_if_fail (PANGO_IS_FC_DECODER (decoder), PANGO_GLYPH_NULL);
return PANGO_FC_DECODER_GET_CLASS (decoder)->get_glyph (decoder, fcfont, wc);
}
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 953af1d6..8dafbcb0 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -82,6 +82,7 @@ pango_fc_font_class_init (PangoFcFontClass *class)
class->has_char = pango_fc_font_real_has_char;
class->get_glyph = pango_fc_font_real_get_glyph;
+ class->get_unknown_glyph = NULL;
object_class->finalize = pango_fc_font_finalize;
object_class->set_property = pango_fc_font_set_property;
@@ -517,7 +518,7 @@ pango_fc_font_real_get_glyph (PangoFcFont *font,
index = FcFreeTypeCharIndex (face, wc);
if (index > (FT_UInt)face->num_glyphs)
- index = 0;
+ index = PANGO_GLYPH_NULL;
PANGO_FC_FONT_UNLOCK_FACE (font);
@@ -599,7 +600,7 @@ pango_fc_font_has_char (PangoFcFont *font,
* for @font. If you only want to determine
* whether the font has the glyph, use pango_fc_font_has_char().
*
- * Return value: the glyph index, or 0, if the Unicode
+ * Return value: the glyph index, or %PANGO_GLYPH_NULL, if the Unicode
* character doesn't exist in the font.
*
* Since: 1.4
@@ -641,7 +642,10 @@ pango_fc_font_get_unknown_glyph (PangoFcFont *font,
{
g_return_val_if_fail (PANGO_IS_FC_FONT (font), 0);
- return PANGO_FC_FONT_GET_CLASS (font)->get_unknown_glyph (font, wc);
+ if (PANGO_FC_FONT_GET_CLASS (font)->get_unknown_glyph)
+ return PANGO_FC_FONT_GET_CLASS (font)->get_unknown_glyph (font, wc);
+
+ return PANGO_GLYPH_UNKNOWN_FLAG | (PangoGlyph)wc;
}
void
diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c
index 965e8f63..5aa1872e 100644
--- a/pango/pangoft2-render.c
+++ b/pango/pangoft2-render.c
@@ -150,6 +150,11 @@ pango_ft2_renderer_draw_glyph (PangoRenderer *renderer,
int iyoff = floor (y + 0.5);
int ix, iy;
+ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ glyph = PANGO_GLYPH_NULL;
+ if (glyph == PANGO_GLYPH_NULL)
+ return;
+
rendered_glyph = _pango_ft2_font_get_cache_glyph_data (font, glyph);
add_glyph_to_cache = FALSE;
if (rendered_glyph == NULL)
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index 17dde11e..dbacf724 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -296,6 +296,17 @@ pango_ft2_font_get_glyph_extents (PangoFont *font,
{
PangoFT2GlyphInfo *info;
+ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ glyph = PANGO_GLYPH_NULL;
+ if (glyph == PANGO_GLYPH_NULL)
+ {
+ if (ink_rect)
+ ink_rect->x = ink_rect->y = ink_rect->width = ink_rect->height = 0;
+ if (logical_rect)
+ logical_rect->x = logical_rect->y = logical_rect->width = logical_rect->height = 0;
+ return;
+ }
+
info = pango_ft2_font_get_glyph_info (font, glyph, TRUE);
if (ink_rect)
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index c72d81e1..77970285 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -31,8 +31,6 @@
#include "pangowin32.h"
#include "pangowin32-private.h"
-#define PANGO_WIN32_UNKNOWN_FLAG 0x10000000
-
#define CH_IS_UNIHAN_BMP(ch) ((ch) >= 0x3400 && (ch) <= 0x9FFF)
#define CH_IS_UNIHAN(ch) (CH_IS_UNIHAN_BMP (ch) || \
((ch) >= 0x20000 && (ch) <= 0x2A6DF) || \
@@ -313,11 +311,11 @@ pango_win32_render (HDC hdc,
* point zero (just spacing).
*/
while (i < glyphs->num_glyphs &&
- (glyphs->glyphs[i].glyph == 0 || cur_y_offset == glyphs->glyphs[i].geometry.y_offset))
+ (glyphs->glyphs[i].glyph == PANGO_GLYPH_NULL || cur_y_offset == glyphs->glyphs[i].geometry.y_offset))
{
- if (glyphs->glyphs[i].glyph == 0)
+ if (glyphs->glyphs[i].glyph == PANGO_GLYPH_NULL)
{
- /* Code point 0 glyphs should not be rendered, but their
+ /* PANGO_GLYPH_NULL glyphs should not be rendered, but their
* indicated width (set up by PangoLayout) should be taken
* into account.
*/
@@ -337,7 +335,7 @@ pango_win32_render (HDC hdc,
}
else
{
- if (glyphs->glyphs[i].glyph & PANGO_WIN32_UNKNOWN_FLAG)
+ if (glyphs->glyphs[i].glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
/* Glyph index is actually the char value that doesn't
* have any glyph (ORed with the flag). We should really
@@ -462,7 +460,7 @@ pango_win32_font_get_glyph_extents (PangoFont *font,
MAT2 m = {{0,1}, {0,0}, {0,0}, {0,1}};
PangoWin32GlyphInfo *info;
- if (glyph & PANGO_WIN32_UNKNOWN_FLAG)
+ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
glyph_index = glyph = 0;
info = g_hash_table_lookup (win32font->glyph_info, GUINT_TO_POINTER (glyph));
@@ -869,7 +867,7 @@ PangoGlyph
pango_win32_get_unknown_glyph (PangoFont *font,
gunichar wc)
{
- return wc | PANGO_WIN32_UNKNOWN_FLAG;
+ return wc | PANGO_GLYPH_UNKNOWN_FLAG;
}
/**
@@ -1383,7 +1381,7 @@ pango_win32_font_get_glyph_index (PangoFont *font,
cmap = font_get_cmap (font);
if (cmap == NULL)
- return 0;
+ return PANGO_GLYPH_NULL;
if (win32font->win32face->cmap_format == 4)
{
@@ -1396,10 +1394,10 @@ pango_win32_font_get_glyph_index (PangoFont *font,
guint16 ch = wc;
if (wc > 0xFFFF)
- return 0;
+ return PANGO_GLYPH_NULL;
if (!find_segment (cmap4, ch, &segment))
- return 0;
+ return PANGO_GLYPH_NULL;
id_range_offset = get_id_range_offset (cmap4);
id_delta = get_id_delta (cmap4);
@@ -1415,7 +1413,7 @@ pango_win32_font_get_glyph_index (PangoFont *font,
if (id)
glyph = (id_delta[segment] + id) %65536;
else
- glyph = 0;
+ glyph = PANGO_GLYPH_NULL;
}
}
else if (win32font->win32face->cmap_format == 12)
@@ -1423,7 +1421,7 @@ pango_win32_font_get_glyph_index (PangoFont *font,
struct format_12_cmap *cmap12 = cmap;
guint32 i;
- glyph = 0;
+ glyph = PANGO_GLYPH_NULL;
for (i = 0; i < cmap12->count; i++)
{
if (cmap12->groups[i*3+0] <= wc && wc <= cmap12->groups[i*3+1])
diff --git a/pango/pangox.c b/pango/pangox.c
index 881c92a1..fe85cd98 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -33,8 +33,6 @@
#include "pangox.h"
#include "pangox-private.h"
-#define PANGO_X_UNKNOWN_FLAG 0x10000000
-
#define PANGO_TYPE_X_FONT (pango_x_font_get_type ())
#define PANGO_X_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_X_FONT, PangoXFont))
#define PANGO_X_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_X_FONT, PangoXFontClass))
@@ -401,12 +399,12 @@ pango_x_render (Display *display,
* the ink rect here would be a noticeable speed hit.
* This is close enough.
*/
- if (!(glyph &&
+ if (!(glyph != PANGO_GLYPH_NULL &&
glyph_x >= -16384 && glyph_x <= 32767 &&
glyph_y >= -16384 && glyph_y <= 32767))
goto next_glyph;
- if (glyph & PANGO_X_UNKNOWN_FLAG)
+ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
PangoFontMetrics *metrics = pango_font_get_metrics (font,
pango_language_from_string ("en"));
@@ -425,7 +423,7 @@ pango_x_render (Display *display,
baseline = glyph_y;
stroke_thick = MAX ((int) (0.5 + 0.075 * (y2 - y1)), 1);
- wc = glyph & (~PANGO_X_UNKNOWN_FLAG);
+ wc = glyph & (~PANGO_GLYPH_UNKNOWN_FLAG);
switch (wc)
{
@@ -576,7 +574,7 @@ pango_x_font_get_glyph_extents (PangoFont *font,
XCharStruct *cs;
PangoXSubfontInfo *subfont;
- if (glyph & PANGO_X_UNKNOWN_FLAG)
+ if (glyph != PANGO_GLYPH_NULL && glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
PangoFontMetrics *metrics = pango_font_get_metrics (font,
pango_language_from_string ("en"));
@@ -584,7 +582,7 @@ pango_x_font_get_glyph_extents (PangoFont *font,
gdouble width_factor;
int w;
- wc = glyph & (~PANGO_X_UNKNOWN_FLAG);
+ wc = glyph & (~PANGO_GLYPH_UNKNOWN_FLAG);
switch (wc)
{
@@ -625,7 +623,7 @@ pango_x_font_get_glyph_extents (PangoFont *font,
}
}
- else if (glyph && pango_x_find_glyph (font, glyph, &subfont, &cs))
+ else if (glyph != PANGO_GLYPH_NULL && pango_x_find_glyph (font, glyph, &subfont, &cs))
{
if (ink_rect)
{
@@ -852,7 +850,7 @@ get_subfonts_foreach (PangoFont *font,
GSList **subfonts = data;
PangoGlyph glyph = glyph_info->glyph;
- if ((glyph & PANGO_X_UNKNOWN_FLAG) == 0)
+ if ((glyph & PANGO_GLYPH_UNKNOWN_FLAG) == 0)
{
PangoXSubfont subfont = PANGO_X_GLYPH_SUBFONT (glyph);
if (!g_slist_find (*subfonts, GUINT_TO_POINTER ((guint)subfont)))
@@ -1412,7 +1410,7 @@ pango_x_find_glyph (PangoFont *font,
PangoGlyph
pango_x_get_unknown_glyph (PangoFont *font)
{
- return PANGO_X_UNKNOWN_FLAG;
+ return PANGO_GLYPH_UNKNOWN_FLAG;
}
/**
@@ -1758,5 +1756,5 @@ pango_x_font_get_unknown_glyph (PangoFont *font,
{
g_return_val_if_fail (PANGO_IS_FONT (font), 0);
- return PANGO_X_UNKNOWN_FLAG | wc;
+ return PANGO_GLYPH_UNKNOWN_FLAG | wc;
}
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index 2e26dbad..c7004c0c 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -51,8 +51,6 @@ static gboolean pango_xft_font_real_has_char (PangoFcFont *font,
gunichar wc);
static guint pango_xft_font_real_get_glyph (PangoFcFont *font,
gunichar wc);
-static PangoGlyph pango_xft_font_real_get_unknown_glyph (PangoFcFont *font,
- gunichar wc);
static void pango_xft_font_real_shutdown (PangoFcFont *font);
static XftFont *xft_font_get_font (PangoFont *font);
@@ -74,7 +72,6 @@ pango_xft_font_class_init (PangoXftFontClass *class)
fc_font_class->unlock_face = pango_xft_font_real_unlock_face;
fc_font_class->has_char = pango_xft_font_real_has_char;
fc_font_class->get_glyph = pango_xft_font_real_get_glyph;
- fc_font_class->get_unknown_glyph = pango_xft_font_real_get_unknown_glyph;
fc_font_class->shutdown = pango_xft_font_real_shutdown;
}
@@ -209,7 +206,7 @@ get_glyph_extents_missing (PangoXftFont *xfont,
PangoFont *font = PANGO_FONT (xfont);
XftFont *xft_font = xft_font_get_font (font);
- gint cols = (glyph & ~PANGO_XFT_UNKNOWN_FLAG) > 0xffff ? 3 : 2;
+ gint cols = (glyph & ~PANGO_GLYPH_UNKNOWN_FLAG) > 0xffff ? 3 : 2;
_pango_xft_font_get_mini_font (xfont);
@@ -323,21 +320,7 @@ pango_xft_font_get_glyph_extents (PangoFont *font,
if (!fcfont->fontmap) /* Display closed */
goto fallback;
- if (glyph == (PangoGlyph)-1)
- glyph = 0;
-
- if (glyph & PANGO_XFT_UNKNOWN_FLAG)
- {
- get_glyph_extents_missing (xfont, glyph, ink_rect, logical_rect);
- }
- else if (glyph)
- {
- if (!fcfont->is_transformed)
- get_glyph_extents_xft (fcfont, glyph, ink_rect, logical_rect);
- else
- get_glyph_extents_raw (xfont, glyph, ink_rect, logical_rect);
- }
- else
+ if (glyph == PANGO_GLYPH_NULL)
{
fallback:
@@ -355,6 +338,18 @@ pango_xft_font_get_glyph_extents (PangoFont *font,
logical_rect->y = 0;
logical_rect->height = 0;
}
+ return;
+ }
+ else if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ {
+ get_glyph_extents_missing (xfont, glyph, ink_rect, logical_rect);
+ }
+ else
+ {
+ if (!fcfont->is_transformed)
+ get_glyph_extents_xft (fcfont, glyph, ink_rect, logical_rect);
+ else
+ get_glyph_extents_raw (xfont, glyph, ink_rect, logical_rect);
}
}
@@ -453,13 +448,6 @@ pango_xft_font_real_get_glyph (PangoFcFont *font,
return XftCharIndex (NULL, xft_font, wc);
}
-static PangoGlyph
-pango_xft_font_real_get_unknown_glyph (PangoFcFont *font,
- gunichar wc)
-{
- return wc | PANGO_XFT_UNKNOWN_FLAG;
-}
-
static void
pango_xft_font_real_shutdown (PangoFcFont *fcfont)
{
@@ -586,7 +574,7 @@ pango_xft_font_unlock_face (PangoFont *font)
*
* Use pango_fc_font_get_glyph() instead.
*
- * Return value: the glyph index, or 0, if the Unicode
+ * Return value: the glyph index, or %PANGO_GLYPH_NULL, if the Unicode
* character does not exist in the font.
*
* Since: 1.2
@@ -595,7 +583,7 @@ guint
pango_xft_font_get_glyph (PangoFont *font,
gunichar wc)
{
- g_return_val_if_fail (PANGO_XFT_IS_FONT (font), 0);
+ g_return_val_if_fail (PANGO_XFT_IS_FONT (font), PANGO_GLYPH_NULL);
return pango_fc_font_get_glyph (PANGO_FC_FONT (font), wc);
}
diff --git a/pango/pangoxft-private.h b/pango/pangoxft-private.h
index 6a8a08af..1a00860a 100644
--- a/pango/pangoxft-private.h
+++ b/pango/pangoxft-private.h
@@ -27,8 +27,6 @@
G_BEGIN_DECLS
-#define PANGO_XFT_UNKNOWN_FLAG 0x10000000
-
struct _PangoXftFont
{
PangoFcFont parent_instance;
diff --git a/pango/pangoxft-render.c b/pango/pangoxft-render.c
index 3df15245..3e089bdd 100644
--- a/pango/pangoxft-render.c
+++ b/pango/pangoxft-render.c
@@ -335,9 +335,9 @@ pango_xft_renderer_draw_glyphs (PangoRenderer *renderer,
int glyph_x = x + x_off + glyphs->glyphs[i].geometry.x_offset;
int glyph_y = y + glyphs->glyphs[i].geometry.y_offset;
- if (glyph)
+ if (glyph != PANGO_GLYPH_NULL)
{
- if (glyph & PANGO_XFT_UNKNOWN_FLAG)
+ if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
char buf[7];
int ys[3];
@@ -348,7 +348,7 @@ pango_xft_renderer_draw_glyphs (PangoRenderer *renderer,
PangoFont *mini_font = _pango_xft_font_get_mini_font (xfont);
XftFont *mini_xft_font = pango_xft_font_get_font (mini_font);
- glyph &= ~PANGO_XFT_UNKNOWN_FLAG;
+ glyph &= ~PANGO_GLYPH_UNKNOWN_FLAG;
ys[0] = glyph_y - PANGO_SCALE * xft_font->ascent + PANGO_SCALE * (((xft_font->ascent + xft_font->descent) - (xfont->mini_height * 2 + xfont->mini_pad * 5 + PANGO_SCALE / 2) / PANGO_SCALE) / 2);
ys[1] = ys[0] + 2 * xfont->mini_pad + xfont->mini_height;
diff --git a/pango/shape.c b/pango/shape.c
index 37fc34d2..2be23189 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -51,6 +51,7 @@ pango_shape (const gchar *text,
_pango_engine_shape_shape (analysis->shape_engine, analysis->font,
text, length, analysis, glyphs);
+ glyphs->num_glyphs = 0;
if (G_UNLIKELY (glyphs->num_glyphs == 0))
{
/* If a font has been correctly chosen, but no glyphs are output,
@@ -100,19 +101,27 @@ pango_shape (const gchar *text,
if (!glyphs->num_glyphs)
{
- /* If failed to get glyphs, put a whitespace glyph per character
+ /* If failed to get glyphs, put unknown glyphs for all characters
*/
+ const char *p = text;
pango_glyph_string_set_size (glyphs, g_utf8_strlen (text, length));
for (i = 0; i < glyphs->num_glyphs; i++)
{
- glyphs->glyphs[i].glyph = 0;
+ PangoRectangle logical_rect;
+ PangoGlyph glyph = g_utf8_get_char (p) | PANGO_GLYPH_UNKNOWN_FLAG;
+
+ pango_font_get_glyph_extents (analysis->font, glyph, NULL, &logical_rect);
+
+ glyphs->glyphs[i].glyph = glyph;
glyphs->glyphs[i].geometry.x_offset = 0;
glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->glyphs[i].geometry.width = 10 * PANGO_SCALE;
+ glyphs->glyphs[i].geometry.width = logical_rect.width;
glyphs->log_clusters[i] = i;
+
+ p = g_utf8_next_char (p);
}
}