diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2006-02-05 03:11:58 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2006-02-05 03:11:58 +0000 |
commit | 6cddbd51fe9e616847a17be379149822c88104bf (patch) | |
tree | 1bcecc7d9210c334829b439ef515585ebe297624 | |
parent | 8adcead819b6bb6781f0b01c6b17175b2918af8f (diff) | |
download | pango-6cddbd51fe9e616847a17be379149822c88104bf.tar.gz |
Change PANGO_GLYPH_EMPTY to 0x0FFFFFFF, to not overlap with
2006-02-04 Behdad Esfahbod <behdad@gnome.org>
* pango/pango-types.h: Change PANGO_GLYPH_EMPTY to 0x0FFFFFFF, to
not overlap with PANGO_GLYPH_UNKNOWN_FLAG (0x10000000).
Define PANGO_GET_UNKNOWN_GLYPH(wc) that simply returns
wc|PANGO_GLYPH_UNKNOWN_FLAG.
* docs/pango-sections.txt, docs/tmpl/glyphs.sgml: Document new
symbols.
* modules/*/*.c: Use PANGO_GET_UNKNOWN_GLYPH instead of various
backend-specific functions.
* pango/pangofc-font.c, pango/pangoft.c, pango/pangoxft-font.c,
* pango/pangowin32.c, pango/pangox.c: Suggest using
PANGO_GET_UNKNOWN_GLYPH in docs.
* pango/pangofc-font.h: Deprecate pango_fc_font_get_unknown_glyph().
* pango/pangowin32.h: Deprecate pango_win32_get_unknown_glyph().
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | docs/pango-sections.txt | 3 | ||||
-rw-r--r-- | docs/tmpl/glyphs.sgml | 30 | ||||
-rw-r--r-- | examples/viewer-x.c | 5 | ||||
-rw-r--r-- | modules/arabic/arabic-fc.c | 4 | ||||
-rw-r--r-- | modules/basic/basic-fc.c | 4 | ||||
-rw-r--r-- | modules/basic/basic-win32.c | 6 | ||||
-rw-r--r-- | modules/basic/basic-x.c | 4 | ||||
-rw-r--r-- | modules/hangul/hangul-fc.c | 2 | ||||
-rw-r--r-- | modules/hebrew/hebrew-fc.c | 4 | ||||
-rw-r--r-- | modules/indic/indic-fc.c | 2 | ||||
-rw-r--r-- | modules/khmer/khmer-fc.c | 2 | ||||
-rw-r--r-- | modules/syriac/syriac-fc.c | 4 | ||||
-rw-r--r-- | modules/thai/thai-fc.c | 4 | ||||
-rw-r--r-- | modules/tibetan/tibetan-fc.c | 2 | ||||
-rw-r--r-- | pango/pango-types.h | 5 | ||||
-rw-r--r-- | pango/pangofc-font.c | 8 | ||||
-rw-r--r-- | pango/pangofc-font.h | 3 | ||||
-rw-r--r-- | pango/pangoft2.c | 8 | ||||
-rw-r--r-- | pango/pangowin32.c | 4 | ||||
-rw-r--r-- | pango/pangowin32.h | 2 | ||||
-rw-r--r-- | pango/pangox.c | 10 | ||||
-rw-r--r-- | pango/pangoxft-font.c | 4 |
23 files changed, 104 insertions, 37 deletions
@@ -1,5 +1,26 @@ 2006-02-04 Behdad Esfahbod <behdad@gnome.org> + * pango/pango-types.h: Change PANGO_GLYPH_EMPTY to 0x0FFFFFFF, to + not overlap with PANGO_GLYPH_UNKNOWN_FLAG (0x10000000). + Define PANGO_GET_UNKNOWN_GLYPH(wc) that simply returns + wc|PANGO_GLYPH_UNKNOWN_FLAG. + + * docs/pango-sections.txt, docs/tmpl/glyphs.sgml: Document new + symbols. + + * modules/*/*.c: Use PANGO_GET_UNKNOWN_GLYPH instead of various + backend-specific functions. + + * pango/pangofc-font.c, pango/pangoft.c, pango/pangoxft-font.c, + * pango/pangowin32.c, pango/pangox.c: Suggest using + PANGO_GET_UNKNOWN_GLYPH in docs. + + * pango/pangofc-font.h: Deprecate pango_fc_font_get_unknown_glyph(). + + * pango/pangowin32.h: Deprecate pango_win32_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. diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt index ce994e94..a960ea32 100644 --- a/docs/pango-sections.txt +++ b/docs/pango-sections.txt @@ -80,6 +80,9 @@ pango_matrix_rotate pango_matrix_concat pango_matrix_get_font_scale_factor PangoGlyph +PANGO_GLYPH_EMPTY +PANGO_GLYPH_UNKNOWN_FLAG +PANGO_GET_UNKNOWN_GLYPH PangoGlyphInfo PangoGlyphGeometry PangoGlyphUnit diff --git a/docs/tmpl/glyphs.sgml b/docs/tmpl/glyphs.sgml index 1232cd36..ebf5fafa 100644 --- a/docs/tmpl/glyphs.sgml +++ b/docs/tmpl/glyphs.sgml @@ -194,6 +194,36 @@ A #PangoGlyph represents a single glyph in the output form of a string. </para> +<!-- ##### MACRO PANGO_GLYPH_EMPTY ##### --> +<para> +The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a +special meaning, which is a zero-width empty glyph. This is useful for +example in shaper modules, to use as the glyph for various zero-width +Unicode characters (those passing pango_is_zero_width()). +</para> + + + +<!-- ##### MACRO PANGO_GLYPH_UNKNOWN_FLAG ##### --> +<para> +The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to +a #gunichar value of a valid Unicode character, to produce a #PangoGlyph +value, representing an unknown-character glyph for the respective #gunichar. +</para> + + + +<!-- ##### MACRO PANGO_GET_UNKNOWN_GLYPH ##### --> +<para> +Returns a #PangoGlyph value that means no glyph was found for @wc. +The way this unknown glyphs are rendered is backend specific. For example, +a box with the hexadecimal Unicode code-point of the character written in it +is what is done in the most common backends. +</para> + +@wc: a Unicode character + + <!-- ##### STRUCT PangoGlyphInfo ##### --> <para> The #PangoGlyphInfo structure represents a single glyph together with diff --git a/examples/viewer-x.c b/examples/viewer-x.c index 18cb9ff8..7327ab7f 100644 --- a/examples/viewer-x.c +++ b/examples/viewer-x.c @@ -90,6 +90,7 @@ main (int argc, char **argv) XSizeHints size_hints; unsigned int quit_keycode; unsigned int borders_keycode; + const char *title; g_type_init(); @@ -111,9 +112,11 @@ main (int argc, char **argv) XSelectInput (display, window, ExposureMask | KeyPressMask); XMapWindow (display, window); + title = get_options_string (); XmbSetWMProperties (display, window, - get_options_string (), + title, NULL, NULL, 0, NULL, NULL, NULL); + g_free (title); memset ((char *)&size_hints, 0, sizeof (XSizeHints)); size_hints.flags = PSize | PMaxSize; diff --git a/modules/arabic/arabic-fc.c b/modules/arabic/arabic-fc.c index 355646a7..50a0eb68 100644 --- a/modules/arabic/arabic-fc.c +++ b/modules/arabic/arabic-fc.c @@ -216,7 +216,7 @@ fallback_shape (PangoEngineShape *engine, index = pango_fc_font_get_glyph (fc_font, wc); if (!index) - index = pango_fc_font_get_unknown_glyph (fc_font, wc); + index = PANGO_GET_UNKNOWN_GLYPH ( wc); set_glyph (font, glyphs, i, p - text, index); } @@ -335,7 +335,7 @@ arabic_engine_shape (PangoEngineShape *engine, if (!index) { - pango_ot_buffer_add_glyph (buffer, pango_fc_font_get_unknown_glyph (fc_font, wc), + pango_ot_buffer_add_glyph (buffer, PANGO_GET_UNKNOWN_GLYPH ( wc), properties[i], p - text); } else diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c index 5b8d90bf..80694bad 100644 --- a/modules/basic/basic-fc.c +++ b/modules/basic/basic-fc.c @@ -174,7 +174,7 @@ fallback_shape (PangoEngineShape *engine, if (!index) { - index = pango_fc_font_get_unknown_glyph (fc_font, wc); + index = PANGO_GET_UNKNOWN_GLYPH ( wc); set_glyph (font, glyphs, i, p - text, index); } else @@ -390,7 +390,7 @@ basic_engine_shape (PangoEngineShape *engine, if (!index) { - pango_ot_buffer_add_glyph (buffer, pango_fc_font_get_unknown_glyph (fc_font, wc), + pango_ot_buffer_add_glyph (buffer, PANGO_GET_UNKNOWN_GLYPH ( wc), unknown_property, p - text); } else diff --git a/modules/basic/basic-win32.c b/modules/basic/basic-win32.c index 2b6c6017..fed595d3 100644 --- a/modules/basic/basic-win32.c +++ b/modules/basic/basic-win32.c @@ -849,10 +849,10 @@ itemize_shape_and_place (PangoFont *font, { PangoRectangle logical_rect; /* Should pass actual char that was not found to - * pango_win32_get_unknown_glyph(), but a bit hard to + * PANGO_GET_UNKNOWN_GLYPH(), but a bit hard to * find out that at this point, so cheat and use 0. */ - PangoGlyph unk = pango_win32_get_unknown_glyph (font, 0); + PangoGlyph unk = PANGO_GET_UNKNOWN_GLYPH (0); glyphs->glyphs[ng+glyphix].glyph = unk; pango_font_get_glyph_extents (font, unk, NULL, &logical_rect); @@ -1034,7 +1034,7 @@ basic_engine_shape (PangoEngineShape *engine, } } else - set_glyph (font, glyphs, i, p - text, pango_win32_get_unknown_glyph (font, wc)); + set_glyph (font, glyphs, i, p - text, PANGO_GET_UNKNOWN_GLYPH (wc)); } p = g_utf8_next_char (p); diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c index ffd07329..451ea6da 100644 --- a/modules/basic/basic-x.c +++ b/modules/basic/basic-x.c @@ -202,7 +202,7 @@ find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input) case '\r': case 0x2028: /* Line separator */ case 0x2029: /* Paragraph separator */ - return pango_x_font_get_unknown_glyph (font, wc); + return PANGO_GET_UNKNOWN_GLYPH (wc); break; } @@ -640,7 +640,7 @@ basic_engine_shape (PangoEngineShape *engine, } } else - set_glyph (font, glyphs, i, p - text, pango_x_font_get_unknown_glyph (font, wc)); + set_glyph (font, glyphs, i, p - text, PANGO_GET_UNKNOWN_GLYPH (wc)); } p = g_utf8_next_char (p); diff --git a/modules/hangul/hangul-fc.c b/modules/hangul/hangul-fc.c index 0b12c94a..7c169a9d 100644 --- a/modules/hangul/hangul-fc.c +++ b/modules/hangul/hangul-fc.c @@ -128,7 +128,7 @@ set_glyph_tone (PangoFont *font, PangoGlyphString *glyphs, int i, #define find_char(font,wc) \ pango_fc_font_get_glyph((PangoFcFont *)font, wc) #define get_unknown_glyph(font,wc) \ - pango_fc_font_get_unknown_glyph((PangoFcFont *)font, wc) + PANGO_GET_UNKNOWN_GLYPH ( wc) static void render_tone (PangoFont *font, gunichar tone, PangoGlyphString *glyphs, diff --git a/modules/hebrew/hebrew-fc.c b/modules/hebrew/hebrew-fc.c index b396fa92..454e00ca 100644 --- a/modules/hebrew/hebrew-fc.c +++ b/modules/hebrew/hebrew-fc.c @@ -76,7 +76,7 @@ get_cluster_glyphs(PangoFont *font, glyph_num[i] = pango_fc_font_get_glyph ((PangoFcFont *)font, wc); if (!glyph_num[i]) - glyph_num[i] = pango_fc_font_get_unknown_glyph ((PangoFcFont *)font, wc); + glyph_num[i] = PANGO_GET_UNKNOWN_GLYPH ( wc); glyph[i] = glyph_num[i]; @@ -356,7 +356,7 @@ hebrew_engine_shape (PangoEngineShape *engine, if (!index) { - pango_ot_buffer_add_glyph (buffer, pango_fc_font_get_unknown_glyph (fc_font, wc), + pango_ot_buffer_add_glyph (buffer, PANGO_GET_UNKNOWN_GLYPH ( wc), unknown_property, p - text); } else diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c index 4cfcf7ae..021d3ef8 100644 --- a/modules/indic/indic-fc.c +++ b/modules/indic/indic-fc.c @@ -278,7 +278,7 @@ set_glyphs (PangoFont *font, glyph = pango_fc_font_get_glyph (fc_font, wcs[i]); if (!glyph) - glyph = pango_fc_font_get_unknown_glyph (fc_font, wcs[i]); + glyph = PANGO_GET_UNKNOWN_GLYPH ( 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..2804741e 100644 --- a/modules/khmer/khmer-fc.c +++ b/modules/khmer/khmer-fc.c @@ -509,7 +509,7 @@ get_index (PangoFcFont *fc_font, gunichar wc) { PangoGlyph index = pango_fc_font_get_glyph (fc_font, wc); if (!index) - index = pango_fc_font_get_unknown_glyph (fc_font, wc); + index = PANGO_GET_UNKNOWN_GLYPH ( wc); return index; } diff --git a/modules/syriac/syriac-fc.c b/modules/syriac/syriac-fc.c index 876e725d..9cbbf511 100644 --- a/modules/syriac/syriac-fc.c +++ b/modules/syriac/syriac-fc.c @@ -208,7 +208,7 @@ fallback_shape (PangoEngineShape *engine, index = pango_fc_font_get_glyph (fc_font, wc); if (!index) - index = pango_fc_font_get_unknown_glyph (fc_font, wc); + index = PANGO_GET_UNKNOWN_GLYPH ( wc); set_glyph (font, glyphs, i, p - text, index); } @@ -309,7 +309,7 @@ syriac_engine_shape (PangoEngineShape *engine, if (!index) { - pango_ot_buffer_add_glyph (buffer, pango_fc_font_get_unknown_glyph (fc_font, wc), + pango_ot_buffer_add_glyph (buffer, PANGO_GET_UNKNOWN_GLYPH ( wc), properties[i], p - text); } else diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c index 9a038e8b..aaedbb3e 100644 --- a/modules/thai/thai-fc.c +++ b/modules/thai/thai-fc.c @@ -231,13 +231,13 @@ thai_make_glyph_uni (ThaiFontInfo *font_info, gunichar uc) if (result) return result; else - return pango_fc_font_get_unknown_glyph (fc_font, uc); + return PANGO_GET_UNKNOWN_GLYPH ( uc); } PangoGlyph thai_make_unknown_glyph (ThaiFontInfo *font_info, gunichar uc) { - return pango_fc_font_get_unknown_glyph ((PangoFcFont *)font_info->font, uc); + return PANGO_GET_UNKNOWN_GLYPH ( uc); } static void diff --git a/modules/tibetan/tibetan-fc.c b/modules/tibetan/tibetan-fc.c index 77a10ca7..50a0b046 100644 --- a/modules/tibetan/tibetan-fc.c +++ b/modules/tibetan/tibetan-fc.c @@ -474,7 +474,7 @@ get_index (PangoFcFont *fc_font, gunichar wc) { PangoGlyph index = pango_fc_font_get_glyph (fc_font, wc); if (!index) - index = pango_fc_font_get_unknown_glyph (fc_font, wc); + index = PANGO_GET_UNKNOWN_GLYPH ( wc); return index; } diff --git a/pango/pango-types.h b/pango/pango-types.h index c93daf4d..7d12dac0 100644 --- a/pango/pango-types.h +++ b/pango/pango-types.h @@ -45,8 +45,9 @@ typedef struct _PangoLanguage PangoLanguage; */ typedef guint32 PangoGlyph; -#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000) -#define PANGO_GLYPH_EMPTY ((PangoGlyph)0xFFFFFFFF) +#define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF) +#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000) +#define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG) /* A rectangle. Used to store logical and physical extents of glyphs, * runs, strings, etc. diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index a14dd43a..5bea0e81 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -632,6 +632,8 @@ pango_fc_font_get_glyph (PangoFcFont *font, * Returns the index of a glyph suitable for drawing @wc as an * unknown character. * + * Use PANGO_GET_UNKNOWN_GLYPH() instead. + * * Return value: a glyph index into @font. * * Since: 1.4 @@ -640,12 +642,10 @@ PangoGlyph pango_fc_font_get_unknown_glyph (PangoFcFont *font, gunichar wc) { - g_return_val_if_fail (PANGO_IS_FC_FONT (font), 0); - - if (PANGO_FC_FONT_GET_CLASS (font)->get_unknown_glyph) + if (font && 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; + return PANGO_GET_UNKNOWN_GLYPH (wc); } void diff --git a/pango/pangofc-font.h b/pango/pangofc-font.h index 198fb7c6..7b5bc4a3 100644 --- a/pango/pangofc-font.h +++ b/pango/pangofc-font.h @@ -96,6 +96,7 @@ struct _PangoFcFont * @get_unknown_glyph: Gets the glyph that should be used to * display an unknown-glyph indication for the specified * Unicode character. + * May be %NULL. * @shutdown: Performs any font-specific shutdown code that * needs to be done when pango_fc_font_map_shutdown is called. * May be %NULL. @@ -132,8 +133,10 @@ gboolean pango_fc_font_has_char (PangoFcFont *font, gunichar wc); guint pango_fc_font_get_glyph (PangoFcFont *font, gunichar wc); +#ifndef PANGO_DISABLE_DEPRECATED PangoGlyph pango_fc_font_get_unknown_glyph (PangoFcFont *font, gunichar wc); +#endif /* PANGO_DISABLE_DEPRECATED */ void pango_fc_font_kern_glyphs (PangoFcFont *font, PangoGlyphString *glyphs); diff --git a/pango/pangoft2.c b/pango/pangoft2.c index 901cd99a..be53cac4 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -470,10 +470,12 @@ 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, - * or %PANGO_GLYPH_EMPTY if no suitable glyph found. + * Return the index of a glyph suitable for drawing unknown characters with + * @font, or %PANGO_GLYPH_EMPTY if no suitable glyph found. * - * For most uses, pango_fc_font_get_unknown_glyph() should be used instead. + * If you want to draw an unknown-box for a character that is not covered + * by the font, + * use PANGO_GET_UNKNOWN_GLYPH() instead. * * Return value: a glyph index into @font, or %PANGO_GLYPH_EMPTY **/ diff --git a/pango/pangowin32.c b/pango/pangowin32.c index e3af31c7..28e60718 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -860,6 +860,8 @@ pango_win32_font_find_shaper (PangoFont *font, * * Returns the index of a glyph suitable for drawing @wc as an * unknown character. + * + * Use PANGO_GET_UNKNOWN_GLYPH() instead. * * Return value: a glyph index into @font **/ @@ -867,7 +869,7 @@ PangoGlyph pango_win32_get_unknown_glyph (PangoFont *font, gunichar wc) { - return wc | PANGO_GLYPH_UNKNOWN_FLAG; + return PANGO_GET_UNKNOWN_GLYPH (wc); } /** diff --git a/pango/pangowin32.h b/pango/pangowin32.h index 5a08f002..6f025d7a 100644 --- a/pango/pangowin32.h +++ b/pango/pangowin32.h @@ -69,8 +69,10 @@ void pango_win32_render_transformed (HDC hdc, /* For shape engines */ +#ifndef PANGO_DISABLE_DEPRECATED PangoGlyph pango_win32_get_unknown_glyph (PangoFont *font, gunichar wc); +#endif /* PANGO_DISABLE_DEPRECATED */ gint pango_win32_font_get_glyph_index(PangoFont *font, gunichar wc); diff --git a/pango/pangox.c b/pango/pangox.c index 06694713..0070c28b 100644 --- a/pango/pangox.c +++ b/pango/pangox.c @@ -1396,7 +1396,7 @@ pango_x_find_glyph (PangoFont *font, * @font: a #PangoFont. * * Returns the index of a glyph suitable for drawing unknown characters; - * you should generally use pango_x_font_get_unknown_glyph_instead, + * you should generally use PANGO_GET_UNKNOWN_GLYPH() instead, * since that may return a glyph that provides a better representation * of a particular char. (E.g., by showing hex digits, or a glyph * representive of a certain Unicode range.) @@ -1406,7 +1406,7 @@ pango_x_find_glyph (PangoFont *font, PangoGlyph pango_x_get_unknown_glyph (PangoFont *font) { - return PANGO_GLYPH_UNKNOWN_FLAG; + return PANGO_GET_UNKNOWN_GLYPH (0); } /** @@ -1744,13 +1744,13 @@ pango_x_fallback_shape (PangoFont *font, * Returns the index of a glyph suitable for drawing @wc as an * unknown character. * + * Use PANGO_GET_UNKNOWN_GLYPH() instead. + * * Return value: a glyph index into @font. */ PangoGlyph pango_x_font_get_unknown_glyph (PangoFont *font, gunichar wc) { - g_return_val_if_fail (PANGO_IS_FONT (font), 0); - - return PANGO_GLYPH_UNKNOWN_FLAG | wc; + return PANGO_GET_UNKNOWN_GLYPH (wc); } diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c index 2e96c1f4..3df873b6 100644 --- a/pango/pangoxft-font.c +++ b/pango/pangoxft-font.c @@ -511,7 +511,7 @@ pango_xft_font_get_display (PangoFont *font) * Returns the index of a glyph suitable for drawing @wc as an * unknown character. * - * Use pango_fc_font_get_unknown_glyph() instead. + * Use PANGO_GET_UNKNOWN_GLYPH() instead. * * Return value: a glyph index into @font. **/ @@ -519,7 +519,7 @@ PangoGlyph pango_xft_font_get_unknown_glyph (PangoFont *font, gunichar wc) { - g_return_val_if_fail (PANGO_XFT_IS_FONT (font), -1); + g_return_val_if_fail (PANGO_XFT_IS_FONT (font), PANGO_GLYPH_EMPTY); return pango_fc_font_get_unknown_glyph (PANGO_FC_FONT (font), wc); } |