📄 glib-unicode-manipulation.html
字号:
<td> the type of the character.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2973111"></a><h3><a name="GUnicodeBreakType"></a>enum GUnicodeBreakType</h3><a class="indexterm" name="id2973122"></a><pre class="programlisting">typedef enum{ G_UNICODE_BREAK_MANDATORY, G_UNICODE_BREAK_CARRIAGE_RETURN, G_UNICODE_BREAK_LINE_FEED, G_UNICODE_BREAK_COMBINING_MARK, G_UNICODE_BREAK_SURROGATE, G_UNICODE_BREAK_ZERO_WIDTH_SPACE, G_UNICODE_BREAK_INSEPARABLE, G_UNICODE_BREAK_NON_BREAKING_GLUE, G_UNICODE_BREAK_CONTINGENT, G_UNICODE_BREAK_SPACE, G_UNICODE_BREAK_AFTER, G_UNICODE_BREAK_BEFORE, G_UNICODE_BREAK_BEFORE_AND_AFTER, G_UNICODE_BREAK_HYPHEN, G_UNICODE_BREAK_NON_STARTER, G_UNICODE_BREAK_OPEN_PUNCTUATION, G_UNICODE_BREAK_CLOSE_PUNCTUATION, G_UNICODE_BREAK_QUOTATION, G_UNICODE_BREAK_EXCLAMATION, G_UNICODE_BREAK_IDEOGRAPHIC, G_UNICODE_BREAK_NUMERIC, G_UNICODE_BREAK_INFIX_SEPARATOR, G_UNICODE_BREAK_SYMBOL, G_UNICODE_BREAK_ALPHABETIC, G_UNICODE_BREAK_PREFIX, G_UNICODE_BREAK_POSTFIX, G_UNICODE_BREAK_COMPLEX_CONTEXT, G_UNICODE_BREAK_AMBIGUOUS, G_UNICODE_BREAK_UNKNOWN, G_UNICODE_BREAK_NEXT_LINE, G_UNICODE_BREAK_WORD_JOINER} GUnicodeBreakType;</pre><p>These are the possible line break classifications.See <a href="http://www.unicode.org/unicode/reports/tr14/" target="_top">http://www.unicode.org/unicode/reports/tr14/</a>.</p></div><hr><div class="refsect2" lang="en"><a name="id2973178"></a><h3><a name="g-unichar-break-type"></a>g_unichar_break_type ()</h3><a class="indexterm" name="id2973189"></a><pre class="programlisting"><a href="glib-Unicode-Manipulation.html#GUnicodeBreakType">GUnicodeBreakType</a> g_unichar_break_type (<a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> c);</pre><p>Determines the break type of <em class="parameter"><code>c</code></em>. <em class="parameter"><code>c</code></em> should be a Unicode character(to derive a character from UTF-8 encoded text, use<a href="glib-Unicode-Manipulation.html#g-utf8-get-char"><code class="function">g_utf8_get_char()</code></a>). The break type is used to find word and linebreaks ("text boundaries"), Pango implements the Unicode boundaryresolution algorithms and normally you would use a function suchas <ahref="../pango/pango-Text-Processing.html#pango-break"><code class="function">pango_break()</code></a> instead of caring about break types yourself.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>c</code></em> :</span></td><td> a Unicode character</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the break type of <em class="parameter"><code>c</code></em></td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2973294"></a><h3><a name="g-unicode-canonical-ordering"></a>g_unicode_canonical_ordering ()</h3><a class="indexterm" name="id2973305"></a><pre class="programlisting">void g_unicode_canonical_ordering (<a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> *string, <a href="glib-Basic-Types.html#gsize">gsize</a> len);</pre><p>Computes the canonical ordering of a string in-place. This rearranges decomposed characters in the string according to their combining classes. See the Unicode manual for more information.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>string</code></em> :</span></td><td> a UCS-4 encoded string.</td></tr><tr><td><span class="term"><em class="parameter"><code>len</code></em> :</span></td><td> the maximum length of <em class="parameter"><code>string</code></em> to use.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2973386"></a><h3><a name="g-unicode-canonical-decomposition"></a>g_unicode_canonical_decomposition ()</h3><a class="indexterm" name="id2973398"></a><pre class="programlisting"><a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a>* g_unicode_canonical_decomposition (<a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> ch, <a href="glib-Basic-Types.html#gsize">gsize</a> *result_len);</pre><p>Computes the canonical decomposition of a Unicode character.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>ch</code></em> :</span></td><td> a Unicode character.</td></tr><tr><td><span class="term"><em class="parameter"><code>result_len</code></em> :</span></td><td> location to store the length of the return value.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a newly allocated string of Unicode characters. <em class="parameter"><code>result_len</code></em> is set to the resulting length of the string.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2973489"></a><h3><a name="g-unichar-get-mirror-char"></a>g_unichar_get_mirror_char ()</h3><a class="indexterm" name="id2973500"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a> g_unichar_get_mirror_char (<a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> ch, <a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> *mirrored_ch);</pre><p>In Unicode, some characters are <em class="firstterm">mirrored</em>. Thismeans that their images are mirrored horizontally in text that is laidout from right to left. For instance, "(" would become its mirror image,")", in right-to-left text.</p><p>If <em class="parameter"><code>ch</code></em> has the Unicode mirrored property and there is another unicodecharacter that typically has a glyph that is the mirror image of <em class="parameter"><code>ch</code></em>'sglyph, puts that character in the address pointed to by <em class="parameter"><code>mirrored_ch</code></em>.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>ch</code></em> :</span></td><td> a unicode character</td></tr><tr><td><span class="term"><em class="parameter"><code>mirrored_ch</code></em> :</span></td><td> location to store the mirrored character</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> <code class="literal">TRUE</code> if <em class="parameter"><code>ch</code></em> has a mirrored character and <em class="parameter"><code>mirrored_ch</code></em> isfilled in, <code class="literal">FALSE</code> otherwise</td></tr></tbody></table></div><p>Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id2973641"></a><h3><a name="g-utf8-next-char"></a>g_utf8_next_char()</h3><a class="indexterm" name="id2973652"></a><pre class="programlisting">#define g_utf8_next_char(p)</pre><p>Skips to the next character in a UTF-8 string. The string must bevalid; this macro is as fast as possible, and has no error-checking.You would use this macro to iterate over a string character bycharacter. The macro returns the start of the next UTF-8 character.Before using this macro, use <a href="glib-Unicode-Manipulation.html#g-utf8-validate"><code class="function">g_utf8_validate()</code></a> to validate stringsthat may contain invalid UTF-8.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>p</code></em> :</span></td><td>Pointer to the start of a valid UTF-8 character.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2973702"></a><h3><a name="g-utf8-get-char"></a>g_utf8_get_char ()</h3><a class="indexterm" name="id2973713"></a><pre class="programlisting"><a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> g_utf8_get_char (const <a href="glib-Basic-Types.html#gchar">gchar</a> *p);</pre><p>Converts a sequence of bytes encoded as UTF-8 to a Unicode character.If <em class="parameter"><code>p</code></em> does not point to a valid UTF-8 encoded character, results areundefined. If you are not sure that the bytes are completevalid Unicode characters, you should use <a href="glib-Unicode-Manipulation.html#g-utf8-get-char-validated"><code class="function">g_utf8_get_char_validated()</code></a>instead.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>p</code></em> :</span></td><td> a pointer to Unicode character encoded as UTF-8</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the resulting character</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2973794"></a><h3><a name="g-utf8-get-char-validated"></a>g_utf8_get_char_validated ()</h3><a class="indexterm" name="id2973806"></a><pre class="programlisting"><a href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> g_utf8_get_char_validated (const <a href="glib-Basic-Types.html#gchar">gchar</a> *p, <a href="glib-Basic-Types.html#gssize">gssize</a> max_len);</pre><p>Convert a sequence of bytes encoded as UTF-8 to a Unicode character.This function checks for incomplete characters, for invalid characterssuch as characters that are out of the range of Unicode, and foroverlong encodings of valid characters.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>p</code></em> :</span></td><td> a pointer to Unicode character encoded as UTF-8</td></tr><tr><td><span class="term"><em class="parameter"><code>max_len</code></em> :</span></td><td> the maximum number of bytes to read, or -1, for no maximum.</td></tr><tr><td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -