diff options
author | Behdad Esfahbod <pango@behdad.org> | 2005-07-23 19:24:48 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2005-07-23 19:24:48 +0000 |
commit | d5142f02455703ea61bd11f308ef844e9b20ebbd (patch) | |
tree | eee87660e4825754892fd64e65499bfc138aa78b /pango | |
parent | 1470d761b0faf8de46ff38163272a9a6af6c5e64 (diff) | |
download | pango-d5142f02455703ea61bd11f308ef844e9b20ebbd.tar.gz |
New function added.
2005-07-23 Behdad Esfahbod <pango@behdad.org>
* pango/pango-utils.c, pango/pango-utils.h (pango_is_zerowidth): New
function added.
* modules/basic/basic-common.h, modules/basic/basic-fc.c,
modules/basic/basic-win32.c, modules/basic/basic-x.c,
modules/hangul/hangul-fc.c, modules/arabic/arabic-fc.c,
modules/indic/indic-fc.c, modules/indic/indic-ot.h,
modules/syriac/syriac-fc.c: Use the new pango_is_zerowidth function.
(#306639, Behnam Esfahbod)
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-utils.c | 34 | ||||
-rw-r--r-- | pango/pango-utils.h | 8 |
2 files changed, 40 insertions, 2 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c index b8a367e8..18ef8924 100644 --- a/pango/pango-utils.c +++ b/pango/pango-utils.c @@ -1714,3 +1714,37 @@ pango_find_base_dir (const gchar *text, return dir; } + +/** + * pango_is_zero_width: + * @ch: a unicode character + * + * Checks @ch to see if it is a zero-width character that should not be + * normally rendered on the screen. + * + * Return value: %TRUE if @ch is a zero-width character, %FALSE otherwise + */ +gboolean +pango_is_zero_width (gunichar ch) +{ +/* Zero Width characters: + * + * 200B ZERO WIDTH SPACE + * 200C ZERO WIDTH NON-JOINER + * 200D ZERO WIDTH JOINER + * 200E LEFT-TO-RIGHT MARK + * 200F RIGHT-TO-LEFT MARK + * 2028 LINE SEPARATOR + * 202A LEFT-TO-RIGHT EMBEDDING + * 202B RIGHT-TO-LEFT EMBEDDING + * 202C POP DIRECTIONAL FORMATTING + * 202D LEFT-TO-RIGHT OVERRIDE + * 202E RIGHT-TO-LEFT OVERRIDE + * FEFF ZERO WIDTH NO-BREAK SPACE + */ + return (ch & ~(gunichar)0x003F == 0x2000 && ( + (ch >= 0x200B && ch <= 0x200F) || + ch == 0x2028 || + (ch >= 0x202A && ch <= 0x202E) + )) || ch == 0xFEFF; +} diff --git a/pango/pango-utils.h b/pango/pango-utils.h index 20b828e4..4db1a23b 100644 --- a/pango/pango-utils.h +++ b/pango/pango-utils.h @@ -86,8 +86,7 @@ G_CONST_RETURN char * pango_get_lib_subdirectory (void); #endif /* PANGO_ENABLE_BACKEND */ -/* A couple of routines from fribidi that we either wrap or - * provide ourselves. +/* A routine from fribidi that we either wrap or provide ourselves. */ gboolean pango_log2vis_get_embedding_levels (gunichar *str, int len, @@ -96,6 +95,11 @@ gboolean pango_log2vis_get_embedding_levels (gunichar *str, G_CONST_RETURN char *pango_language_get_sample_string (PangoLanguage *language); +/* Unicode characters that are zero-width and should not be rendered + * normally. + */ +G_GNUC_CONST gboolean pango_is_zero_width (gunichar ch); + G_END_DECLS #endif /* __PANGO_UTILS_H__ */ |