mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-22 15:19:16 +02:00
Add g_unichar_iszerowidth(). (#347645)
2007-01-03 Behdad Esfahbod <behdad@gnome.org> * glib/glib.symbols: * glib/gunicode.h: * glib/guniprop.c: Add g_unichar_iszerowidth(). (#347645) svn path=/trunk/; revision=5202
This commit is contained in:
parent
048efdfbd5
commit
a0c60a62d6
@ -1,3 +1,9 @@
|
|||||||
|
2007-01-03 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
|
* glib/glib.symbols:
|
||||||
|
* glib/gunicode.h:
|
||||||
|
* glib/guniprop.c: Add g_unichar_iszerowidth(). (#347645)
|
||||||
|
|
||||||
2007-01-03 Behdad Esfahbod <behdad@gnome.org>
|
2007-01-03 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
* glib/gutils.h: Fix bug in g_bit_nth_lsf (#371631) and use
|
* glib/gutils.h: Fix bug in g_bit_nth_lsf (#371631) and use
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
2007-01-03 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
|
* glib/glib-sections.txt: Add g_unichar_iszerowidth.
|
||||||
|
|
||||||
|
* glib/tmpl/glib-unused.sgml:
|
||||||
|
* glib/tmpl/keyfile.sgml:
|
||||||
|
* glib/tmpl/macros_misc.sgml:
|
||||||
|
* glib/tmpl/messages.sgml:
|
||||||
|
* glib/tmpl/unicode.sgml:
|
||||||
|
Template changes.
|
||||||
|
|
||||||
2007-01-02 Matthias Clasen <mclasen@redhat.com>
|
2007-01-02 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/running.sgml: Remove C99ism from example.
|
* glib/running.sgml: Remove C99ism from example.
|
||||||
|
@ -2264,6 +2264,7 @@ g_unichar_istitle
|
|||||||
g_unichar_isdefined
|
g_unichar_isdefined
|
||||||
g_unichar_iswide
|
g_unichar_iswide
|
||||||
g_unichar_iswide_cjk
|
g_unichar_iswide_cjk
|
||||||
|
g_unichar_iszerowidth
|
||||||
g_unichar_toupper
|
g_unichar_toupper
|
||||||
g_unichar_tolower
|
g_unichar_tolower
|
||||||
g_unichar_totitle
|
g_unichar_totitle
|
||||||
|
@ -203,6 +203,15 @@ error domains.
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### MACRO G_HAVE_GNUC_VISIBILITY ##### -->
|
||||||
|
<para>
|
||||||
|
This macro is defined as 1 if the the compiler supports ELF visibility
|
||||||
|
attributes (currently only <command>gcc</command>).
|
||||||
|
</para>
|
||||||
|
|
||||||
|
Since: 2.6
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO G_HOOK_DEFERRED_DESTROY ##### -->
|
<!-- ##### MACRO G_HOOK_DEFERRED_DESTROY ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -504,6 +504,8 @@ Flags which influence the parsing.
|
|||||||
@key_file:
|
@key_file:
|
||||||
@group_name:
|
@group_name:
|
||||||
@key:
|
@key:
|
||||||
|
@list:
|
||||||
|
@length:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_key_file_set_locale_string_list ##### -->
|
<!-- ##### FUNCTION g_key_file_set_locale_string_list ##### -->
|
||||||
@ -515,6 +517,8 @@ Flags which influence the parsing.
|
|||||||
@group_name:
|
@group_name:
|
||||||
@key:
|
@key:
|
||||||
@locale:
|
@locale:
|
||||||
|
@list:
|
||||||
|
@length:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_key_file_set_boolean_list ##### -->
|
<!-- ##### FUNCTION g_key_file_set_boolean_list ##### -->
|
||||||
|
@ -297,16 +297,6 @@ See the GNU C documentation for details.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO G_HAVE_GNUC_VISIBILITY ##### -->
|
|
||||||
<para>
|
|
||||||
This macro is defined as 1 if the the compiler supports ELF visibility
|
|
||||||
attributes (currently only <command>gcc</command>).
|
|
||||||
</para>
|
|
||||||
|
|
||||||
Since: 2.6
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO G_GNUC_INTERNAL ##### -->
|
<!-- ##### MACRO G_GNUC_INTERNAL ##### -->
|
||||||
<para>
|
<para>
|
||||||
Expands to the GNU C <literal>visibility(hidden)</literal> attribute if the
|
Expands to the GNU C <literal>visibility(hidden)</literal> attribute if the
|
||||||
|
@ -146,6 +146,8 @@ A convenience function/macro to log a normal message.
|
|||||||
|
|
||||||
@...:
|
@...:
|
||||||
|
|
||||||
|
@...:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO g_warning ##### -->
|
<!-- ##### MACRO g_warning ##### -->
|
||||||
<para>
|
<para>
|
||||||
@ -189,6 +191,8 @@ variable (see <ulink url="glib-running.html">Running GLib Applications</ulink>).
|
|||||||
|
|
||||||
@...:
|
@...:
|
||||||
|
|
||||||
|
@...:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO g_critical ##### -->
|
<!-- ##### MACRO g_critical ##### -->
|
||||||
<para>
|
<para>
|
||||||
@ -237,6 +241,8 @@ the %G_DEBUG environment variable (see
|
|||||||
|
|
||||||
@...:
|
@...:
|
||||||
|
|
||||||
|
@...:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO g_error ##### -->
|
<!-- ##### MACRO g_error ##### -->
|
||||||
<para>
|
<para>
|
||||||
@ -280,6 +286,8 @@ assertion failure.
|
|||||||
|
|
||||||
@...:
|
@...:
|
||||||
|
|
||||||
|
@...:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO g_debug ##### -->
|
<!-- ##### MACRO g_debug ##### -->
|
||||||
<para>
|
<para>
|
||||||
@ -316,6 +324,8 @@ A convenience function/macro to log a debug message.
|
|||||||
|
|
||||||
@...:
|
@...:
|
||||||
|
|
||||||
|
@...:
|
||||||
|
|
||||||
@...:
|
@...:
|
||||||
@Since: 2.6
|
@Since: 2.6
|
||||||
|
|
||||||
|
@ -201,6 +201,15 @@ will correctly interpret surrogate pairs.</footnote>.
|
|||||||
@Returns:
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ##### FUNCTION g_unichar_iszerowidth ##### -->
|
||||||
|
<para>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
|
||||||
|
@c:
|
||||||
|
@Returns:
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_unichar_toupper ##### -->
|
<!-- ##### FUNCTION g_unichar_toupper ##### -->
|
||||||
<para>
|
<para>
|
||||||
|
|
||||||
|
@ -232,13 +232,11 @@ than to write one yourself using g_enum_register_static().
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
@name: A nul-terminated string used as the name of the new type.
|
@name: A nul-terminated string used as the name of the new type.
|
||||||
@_static_values:
|
|
||||||
@Returns: The new type identifier.
|
|
||||||
<!-- # Unused Parameters # -->
|
|
||||||
@const_static_values: An array of #GEnumValue structs for the possible
|
@const_static_values: An array of #GEnumValue structs for the possible
|
||||||
enumeration values. The array is terminated by a struct with all
|
enumeration values. The array is terminated by a struct with all
|
||||||
members being 0. GObject keeps a reference to the data, so it cannot
|
members being 0. GObject keeps a reference to the data, so it cannot
|
||||||
be stack-allocated.
|
be stack-allocated.
|
||||||
|
@Returns: The new type identifier.
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_flags_register_static ##### -->
|
<!-- ##### FUNCTION g_flags_register_static ##### -->
|
||||||
@ -252,12 +250,10 @@ than to write one yourself using g_flags_register_static().
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
@name: A nul-terminated string used as the name of the new type.
|
@name: A nul-terminated string used as the name of the new type.
|
||||||
@_static_values:
|
|
||||||
@Returns: The new type identifier.
|
|
||||||
<!-- # Unused Parameters # -->
|
|
||||||
@const_static_values: An array of #GFlagsValue structs for the possible
|
@const_static_values: An array of #GFlagsValue structs for the possible
|
||||||
flags values. The array is terminated by a struct with all members being 0.
|
flags values. The array is terminated by a struct with all members being 0.
|
||||||
GObject keeps a reference to the data, so it cannot be stack-allocated.
|
GObject keeps a reference to the data, so it cannot be stack-allocated.
|
||||||
|
@Returns: The new type identifier.
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_enum_complete_type_info ##### -->
|
<!-- ##### FUNCTION g_enum_complete_type_info ##### -->
|
||||||
@ -286,8 +282,6 @@ my_enum_complete_type_info (GTypePlugin *plugin,
|
|||||||
|
|
||||||
@g_enum_type: the type identifier of the type being completed
|
@g_enum_type: the type identifier of the type being completed
|
||||||
@info: the #GTypeInfo struct to be filled in
|
@info: the #GTypeInfo struct to be filled in
|
||||||
@_values:
|
|
||||||
<!-- # Unused Parameters # -->
|
|
||||||
@const_values: An array of #GEnumValue structs for the possible
|
@const_values: An array of #GEnumValue structs for the possible
|
||||||
enumeration values. The array is terminated by a struct with all
|
enumeration values. The array is terminated by a struct with all
|
||||||
members being 0.
|
members being 0.
|
||||||
@ -302,8 +296,6 @@ g_enumeration_complete_type_info() above.
|
|||||||
|
|
||||||
@g_flags_type: the type identifier of the type being completed
|
@g_flags_type: the type identifier of the type being completed
|
||||||
@info: the #GTypeInfo struct to be filled in
|
@info: the #GTypeInfo struct to be filled in
|
||||||
@_values:
|
|
||||||
<!-- # Unused Parameters # -->
|
|
||||||
@const_values: An array of #GFlagsValue structs for the possible
|
@const_values: An array of #GFlagsValue structs for the possible
|
||||||
enumeration values. The array is terminated by a struct with all
|
enumeration values. The array is terminated by a struct with all
|
||||||
members being 0.
|
members being 0.
|
||||||
|
@ -164,13 +164,11 @@ not be unloaded.
|
|||||||
|
|
||||||
@module: a #GTypeModule
|
@module: a #GTypeModule
|
||||||
@name: name for the type
|
@name: name for the type
|
||||||
@_static_values:
|
|
||||||
@Returns: the new or existing type ID
|
|
||||||
@Since: 2.6
|
|
||||||
<!-- # Unused Parameters # -->
|
|
||||||
@const_static_values: an array of #GEnumValue structs for the possible
|
@const_static_values: an array of #GEnumValue structs for the possible
|
||||||
enumeration values. The array is terminated by a struct with all
|
enumeration values. The array is terminated by a struct with all
|
||||||
members being 0.
|
members being 0.
|
||||||
|
@Returns: the new or existing type ID
|
||||||
|
@Since: 2.6
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### FUNCTION g_type_module_register_flags ##### -->
|
<!-- ##### FUNCTION g_type_module_register_flags ##### -->
|
||||||
@ -187,13 +185,11 @@ not be unloaded.
|
|||||||
|
|
||||||
@module: a #GTypeModule
|
@module: a #GTypeModule
|
||||||
@name: name for the type
|
@name: name for the type
|
||||||
@_static_values:
|
|
||||||
@Returns: the new or existing type ID
|
|
||||||
@Since: 2.6
|
|
||||||
<!-- # Unused Parameters # -->
|
|
||||||
@const_static_values: an array of #GFlagsValue structs for the possible
|
@const_static_values: an array of #GFlagsValue structs for the possible
|
||||||
flags values. The array is terminated by a struct with all
|
flags values. The array is terminated by a struct with all
|
||||||
members being 0.
|
members being 0.
|
||||||
|
@Returns: the new or existing type ID
|
||||||
|
@Since: 2.6
|
||||||
|
|
||||||
|
|
||||||
<!-- ##### MACRO G_DEFINE_DYNAMIC_TYPE ##### -->
|
<!-- ##### MACRO G_DEFINE_DYNAMIC_TYPE ##### -->
|
||||||
@ -212,7 +208,6 @@ See G_DEFINE_DYNAMIC_TYPE_EXTENDED() for an example.
|
|||||||
@t_n: The name of the new type, in lowercase, with words
|
@t_n: The name of the new type, in lowercase, with words
|
||||||
separated by '_'.
|
separated by '_'.
|
||||||
@T_P: The #GType of the parent type.
|
@T_P: The #GType of the parent type.
|
||||||
|
|
||||||
@Since: 2.14
|
@Since: 2.14
|
||||||
|
|
||||||
|
|
||||||
@ -286,6 +281,6 @@ gtk_gadget_register_type (GTypeModule *type_module)
|
|||||||
@TYPE_PARENT: The #GType of the parent type.
|
@TYPE_PARENT: The #GType of the parent type.
|
||||||
@flags: #GTypeFlags to pass to g_type_register_static()
|
@flags: #GTypeFlags to pass to g_type_register_static()
|
||||||
@CODE: Custom code that gets inserted in the *_get_type() function.
|
@CODE: Custom code that gets inserted in the *_get_type() function.
|
||||||
|
|
||||||
@Since: 2.14
|
@Since: 2.14
|
||||||
|
|
||||||
|
|
||||||
|
@ -1256,6 +1256,7 @@ g_unichar_isupper G_GNUC_CONST
|
|||||||
g_unichar_iswide G_GNUC_CONST
|
g_unichar_iswide G_GNUC_CONST
|
||||||
g_unichar_iswide_cjk G_GNUC_CONST
|
g_unichar_iswide_cjk G_GNUC_CONST
|
||||||
g_unichar_isxdigit G_GNUC_CONST
|
g_unichar_isxdigit G_GNUC_CONST
|
||||||
|
g_unichar_iszerowidth G_GNUC_CONST
|
||||||
g_unichar_tolower G_GNUC_CONST
|
g_unichar_tolower G_GNUC_CONST
|
||||||
g_unichar_totitle G_GNUC_CONST
|
g_unichar_totitle G_GNUC_CONST
|
||||||
g_unichar_toupper G_GNUC_CONST
|
g_unichar_toupper G_GNUC_CONST
|
||||||
|
@ -215,6 +215,7 @@ gboolean g_unichar_istitle (gunichar c) G_GNUC_CONST;
|
|||||||
gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST;
|
gboolean g_unichar_isdefined (gunichar c) G_GNUC_CONST;
|
||||||
gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST;
|
gboolean g_unichar_iswide (gunichar c) G_GNUC_CONST;
|
||||||
gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST;
|
gboolean g_unichar_iswide_cjk(gunichar c) G_GNUC_CONST;
|
||||||
|
gboolean g_unichar_iszerowidth(gunichar c) G_GNUC_CONST;
|
||||||
|
|
||||||
/* More <ctype.h> functions. These convert between the three cases.
|
/* More <ctype.h> functions. These convert between the three cases.
|
||||||
* See the Unicode book to understand title case. */
|
* See the Unicode book to understand title case. */
|
||||||
|
@ -85,6 +85,11 @@
|
|||||||
OR (G_UNICODE_COMBINING_MARK, \
|
OR (G_UNICODE_COMBINING_MARK, \
|
||||||
OR (G_UNICODE_ENCLOSING_MARK, 0))))
|
OR (G_UNICODE_ENCLOSING_MARK, 0))))
|
||||||
|
|
||||||
|
#define ISZEROWIDTHTYPE(Type) IS ((Type), \
|
||||||
|
OR (G_UNICODE_NON_SPACING_MARK, \
|
||||||
|
OR (G_UNICODE_ENCLOSING_MARK, \
|
||||||
|
OR (G_UNICODE_FORMAT, 0))))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_unichar_isalnum:
|
* g_unichar_isalnum:
|
||||||
* @c: a Unicode character
|
* @c: a Unicode character
|
||||||
@ -351,6 +356,40 @@ g_unichar_isdefined (gunichar c)
|
|||||||
return TYPE (c) != G_UNICODE_UNASSIGNED;
|
return TYPE (c) != G_UNICODE_UNASSIGNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_unichar_iszerowidth:
|
||||||
|
* @c: a Unicode character
|
||||||
|
*
|
||||||
|
* Determines if a given character typically takes zero width when rendered.
|
||||||
|
* The return value is %TRUE for all non-spacing and enclosing marks
|
||||||
|
* (e.g., combining accents), format characters, zero-width
|
||||||
|
* space, but not U+00AD SOFT HYPHEN.
|
||||||
|
*
|
||||||
|
* A typical use of this function is with one of g_unichar_iswide() or
|
||||||
|
* g_unichar_iswide_cjk() to determine the number of cells a string occupies
|
||||||
|
* when displayed on a grid display (terminals). However, note that not all
|
||||||
|
* terminals support zero-width rendering of zero-width marks.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the character has zero width
|
||||||
|
*
|
||||||
|
* Since: 2.14
|
||||||
|
**/
|
||||||
|
gboolean
|
||||||
|
g_unichar_iszerowidth (gunichar c)
|
||||||
|
{
|
||||||
|
if (G_UNLIKELY (c == 0x00AD))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (ISZEROWIDTHTYPE (c)))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (G_UNLIKELY ((c >= 0x1160 && c < 0x1200) ||
|
||||||
|
c == 0x200B))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* g_unichar_iswide:
|
* g_unichar_iswide:
|
||||||
* @c: a Unicode character
|
* @c: a Unicode character
|
||||||
|
Loading…
x
Reference in New Issue
Block a user