summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-02-21 10:47:30 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-02-21 10:47:30 +0000
commite0babd9ed3f94843d2d8833592bd55895769c009 (patch)
tree764c7f23486a5d0ce9b4e86fc664870867402ebb
parentf3f321992201a5daa52bc44042858b2a9992b672 (diff)
downloadpango-e0babd9ed3f94843d2d8833592bd55895769c009.tar.gz
Bug 331723 – shapers should not crash on failures
2006-02-21 Behdad Esfahbod <behdad@gnome.org> Bug 331723 – shapers should not crash on failures * modules/*/*-fc.c: Return instead of g_return_if_fail when face == NULL. * pango/pango-engine.h (PangoEngineShape): Document that a shaper should return an empty glyph string on failure.
-rw-r--r--ChangeLog10
-rw-r--r--modules/arabic/arabic-fc.c3
-rw-r--r--modules/basic/basic-fc.c3
-rw-r--r--modules/hebrew/hebrew-fc.c3
-rw-r--r--modules/indic/indic-fc.c3
-rw-r--r--modules/khmer/khmer-fc.c3
-rw-r--r--modules/syriac/syriac-fc.c3
-rw-r--r--modules/thai/thai-ot.c6
-rw-r--r--modules/tibetan/tibetan-fc.c3
-rw-r--r--pango/pango-engine.h5
10 files changed, 32 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 185e4b2c..8b34e61b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2006-02-21 Behdad Esfahbod <behdad@gnome.org>
+ Bug 331723 – shapers should not crash on failures
+
+ * modules/*/*-fc.c: Return instead of g_return_if_fail when
+ face == NULL.
+
+ * pango/pango-engine.h (PangoEngineShape): Document that a shaper
+ should return an empty glyph string on failure.
+
+2006-02-21 Behdad Esfahbod <behdad@gnome.org>
+
* pango/fonts.c, pango/glyphstring.c, pango/pango-fontmap.c,
pango/pango-ot-buffer.c, pango/pangocairo-font.c, pango/pangoft2.c,
pango/pangoxft-font.c, pango/shape.c: Change g_critical to g_warning.
diff --git a/modules/arabic/arabic-fc.c b/modules/arabic/arabic-fc.c
index 0b3faefa..e6fc5ef4 100644
--- a/modules/arabic/arabic-fc.c
+++ b/modules/arabic/arabic-fc.c
@@ -274,7 +274,8 @@ arabic_engine_shape (PangoEngineShape *engine,
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_if_fail (face != NULL);
+ if (!face)
+ return;
ruleset = get_ruleset (face);
if (!ruleset)
diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c
index dc77ef00..626608be 100644
--- a/modules/basic/basic-fc.c
+++ b/modules/basic/basic-fc.c
@@ -344,7 +344,8 @@ basic_engine_shape (PangoEngineShape *engine,
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_if_fail (face != NULL);
+ if (!face)
+ return;
ruleset = get_ruleset (face);
if (!ruleset)
diff --git a/modules/hebrew/hebrew-fc.c b/modules/hebrew/hebrew-fc.c
index dcb45b40..8b6ae03c 100644
--- a/modules/hebrew/hebrew-fc.c
+++ b/modules/hebrew/hebrew-fc.c
@@ -312,7 +312,8 @@ hebrew_engine_shape (PangoEngineShape *engine,
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_if_fail (face != NULL);
+ if (!face)
+ return;
ruleset = get_ruleset (face);
if (!ruleset)
diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c
index 3011a66a..4947b5b5 100644
--- a/modules/indic/indic-fc.c
+++ b/modules/indic/indic-fc.c
@@ -344,7 +344,8 @@ indic_engine_shape (PangoEngineShape *engine,
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_if_fail (face != NULL);
+ if (!face)
+ return;
indic_shape_engine = (IndicEngineFc *) engine;
diff --git a/modules/khmer/khmer-fc.c b/modules/khmer/khmer-fc.c
index 9fd9bab5..82541e44 100644
--- a/modules/khmer/khmer-fc.c
+++ b/modules/khmer/khmer-fc.c
@@ -541,7 +541,8 @@ khmer_engine_shape (PangoEngineShape *engine,
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_if_fail (face != NULL);
+ if (!face)
+ return;
buffer = pango_ot_buffer_new (fc_font);
diff --git a/modules/syriac/syriac-fc.c b/modules/syriac/syriac-fc.c
index 1e10df3e..dab11efc 100644
--- a/modules/syriac/syriac-fc.c
+++ b/modules/syriac/syriac-fc.c
@@ -266,7 +266,8 @@ syriac_engine_shape (PangoEngineShape *engine,
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_if_fail (face != NULL);
+ if (!face)
+ return;
ruleset = get_ruleset (face);
if (!ruleset)
diff --git a/modules/thai/thai-ot.c b/modules/thai/thai-ot.c
index 23c20190..00b06380 100644
--- a/modules/thai/thai-ot.c
+++ b/modules/thai/thai-ot.c
@@ -76,7 +76,8 @@ thai_ot_get_ruleset (PangoFont *font)
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_val_if_fail (face != NULL, NULL);
+ if (!face)
+ return NULL;
info = pango_ot_info_get (face);
if (info != NULL)
@@ -148,7 +149,8 @@ lao_ot_get_ruleset (PangoFont *font)
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_val_if_fail (face != NULL, NULL);
+ if (!face)
+ return NULL;
info = pango_ot_info_get (face);
if (info != NULL)
diff --git a/modules/tibetan/tibetan-fc.c b/modules/tibetan/tibetan-fc.c
index 1781edca..b4348c05 100644
--- a/modules/tibetan/tibetan-fc.c
+++ b/modules/tibetan/tibetan-fc.c
@@ -506,7 +506,8 @@ tibetan_engine_shape (PangoEngineShape *engine,
fc_font = PANGO_FC_FONT (font);
face = pango_fc_font_lock_face (fc_font);
- g_return_if_fail (face != NULL);
+ if (!face)
+ return;
buffer = pango_ot_buffer_new (fc_font);
diff --git a/pango/pango-engine.h b/pango/pango-engine.h
index ae101a13..11bb4a8d 100644
--- a/pango/pango-engine.h
+++ b/pango/pango-engine.h
@@ -163,7 +163,10 @@ struct _PangoEngineShape
* of the output logical clusters;
* if no rendering is desired for a character, this may involve
* inserting glyphs with the #PangoGlyph ID #PANGO_GLYPH_EMPTY, which
- * is guaranteed never to render.
+ * is guaranteed never to render. If the shaping fails for any reason,
+ * the shaper should return with an empty (zero-size) glyph string.
+ * If the shaper has not set the size on the glyph string yet, simply
+ * returning signals the failure too.
* @covers: Returns the characters that this engine can cover
* with a given font for a given language. If not overridden, the default
* implementation simply returns the coverage information for the