Imported Upstream version 0.9.3
[platform/upstream/libunistring.git] / doc / libunistring_9.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
2 <html>
3 <!-- Created on March, 30 2010 by texi2html 1.78a -->
4 <!--
5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
6             Karl Berry  <karl@freefriends.org>
7             Olaf Bachmann <obachman@mathematik.uni-kl.de>
8             and many others.
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
11
12 -->
13 <head>
14 <title>GNU libunistring: 9. Display width &lt;uniwidth.h&gt;</title>
15
16 <meta name="description" content="GNU libunistring: 9. Display width &lt;uniwidth.h&gt;">
17 <meta name="keywords" content="GNU libunistring: 9. Display width &lt;uniwidth.h&gt;">
18 <meta name="resource-type" content="document">
19 <meta name="distribution" content="global">
20 <meta name="Generator" content="texi2html 1.78a">
21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
22 <style type="text/css">
23 <!--
24 a.summary-letter {text-decoration: none}
25 pre.display {font-family: serif}
26 pre.format {font-family: serif}
27 pre.menu-comment {font-family: serif}
28 pre.menu-preformatted {font-family: serif}
29 pre.smalldisplay {font-family: serif; font-size: smaller}
30 pre.smallexample {font-size: smaller}
31 pre.smallformat {font-family: serif; font-size: smaller}
32 pre.smalllisp {font-size: smaller}
33 span.roman {font-family:serif; font-weight:normal;}
34 span.sansserif {font-family:sans-serif; font-weight:normal;}
35 ul.toc {list-style: none}
36 -->
37 </style>
38
39
40 </head>
41
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
43
44 <table cellpadding="1" cellspacing="1" border="0">
45 <tr><td valign="middle" align="left">[<a href="libunistring_8.html#SEC20" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
46 <td valign="middle" align="left">[<a href="libunistring_10.html#SEC38" title="Next chapter"> &gt;&gt; </a>]</td>
47 <td valign="middle" align="left"> &nbsp; </td>
48 <td valign="middle" align="left"> &nbsp; </td>
49 <td valign="middle" align="left"> &nbsp; </td>
50 <td valign="middle" align="left"> &nbsp; </td>
51 <td valign="middle" align="left"> &nbsp; </td>
52 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
53 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
54 <td valign="middle" align="left">[<a href="libunistring_18.html#SEC71" title="Index">Index</a>]</td>
55 <td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
56 </tr></table>
57
58 <hr size="2">
59 <a name="uniwidth_002eh"></a>
60 <a name="SEC37"></a>
61 <h1 class="chapter"> <a href="libunistring.html#TOC37">9. Display width <code>&lt;uniwidth.h&gt;</code></a> </h1>
62
63 <p>This include file declares functions that return the display width, measured
64 in columns, of characters or strings, when output to a device that uses
65 non-proportional fonts.
66 </p>
67 <a name="IDX604"></a>
68 <p>Note that for some rarely used characters the actual fonts or terminal
69 emulators can use a different width.  There is no mechanism for communicating
70 the display width of characters across a Unix pseudo-terminal (tty).  Also,
71 there are scripts with complex rendering, like the Indic scripts.  For these
72 scripts, there is no such concept as non-proportional fonts.  Therefore
73 the results of these functions usually work fine on most scripts and on
74 most characters but can fail to represent the actual display width.
75 </p>
76 <p>These functions are locale dependent.  The <var>encoding</var> argument identifies
77 the encoding (e.g. <code>&quot;ISO-8859-2&quot;</code> for Polish).
78 </p>
79 <a name="IDX605"></a>
80 <a name="IDX606"></a>
81 <a name="IDX607"></a>
82 <dl>
83 <dt><u>Function:</u> int <b>uc_width</b><i> (ucs4_t <var>uc</var>, const char *<var>encoding</var>)</i>
84 <a name="IDX608"></a>
85 </dt>
86 <dd><p>Determines and returns the number of column positions required for <var>uc</var>.
87 Returns -1 if <var>uc</var> is a control character that has an influence on the
88 column position when output.
89 </p></dd></dl>
90
91 <dl>
92 <dt><u>Function:</u> int <b>u8_width</b><i> (const uint8_t *<var>s</var>, size_t <var>n</var>, const char *<var>encoding</var>)</i>
93 <a name="IDX609"></a>
94 </dt>
95 <dt><u>Function:</u> int <b>u16_width</b><i> (const uint16_t *<var>s</var>, size_t <var>n</var>, const char *<var>encoding</var>)</i>
96 <a name="IDX610"></a>
97 </dt>
98 <dt><u>Function:</u> int <b>u32_width</b><i> (const uint32_t *<var>s</var>, size_t <var>n</var>, const char *<var>encoding</var>)</i>
99 <a name="IDX611"></a>
100 </dt>
101 <dd><p>Determines and returns the number of column positions required for first
102 <var>n</var> units (or fewer if <var>s</var> ends before this) in <var>s</var>.  This
103 function ignores control characters in the string.
104 </p></dd></dl>
105
106 <dl>
107 <dt><u>Function:</u> int <b>u8_strwidth</b><i> (const uint8_t *<var>s</var>, const char *<var>encoding</var>)</i>
108 <a name="IDX612"></a>
109 </dt>
110 <dt><u>Function:</u> int <b>u16_strwidth</b><i> (const uint16_t *<var>s</var>, const char *<var>encoding</var>)</i>
111 <a name="IDX613"></a>
112 </dt>
113 <dt><u>Function:</u> int <b>u32_strwidth</b><i> (const uint32_t *<var>s</var>, const char *<var>encoding</var>)</i>
114 <a name="IDX614"></a>
115 </dt>
116 <dd><p>Determines and returns the number of column positions required for <var>s</var>.
117 This function ignores control characters in the string.
118 </p></dd></dl>
119 <hr size="6">
120 <table cellpadding="1" cellspacing="1" border="0">
121 <tr><td valign="middle" align="left">[<a href="libunistring_8.html#SEC20" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
122 <td valign="middle" align="left">[<a href="libunistring_10.html#SEC38" title="Next chapter"> &gt;&gt; </a>]</td>
123 <td valign="middle" align="left"> &nbsp; </td>
124 <td valign="middle" align="left"> &nbsp; </td>
125 <td valign="middle" align="left"> &nbsp; </td>
126 <td valign="middle" align="left"> &nbsp; </td>
127 <td valign="middle" align="left"> &nbsp; </td>
128 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
129 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
130 <td valign="middle" align="left">[<a href="libunistring_18.html#SEC71" title="Index">Index</a>]</td>
131 <td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
132 </tr></table>
133 <p>
134  <font size="-1">
135   This document was generated by <em>Bruno Haible</em> on <em>March, 30 2010</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.
136  </font>
137  <br>
138
139 </p>
140 </body>
141 </html>