1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
3 <!-- Created on September, 1 2014 by texi2html 1.78a -->
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>
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
14 <title>GNU libunistring: 9. Display width <uniwidth.h></title>
16 <meta name="description" content="GNU libunistring: 9. Display width <uniwidth.h>">
17 <meta name="keywords" content="GNU libunistring: 9. Display width <uniwidth.h>">
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">
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}
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
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"> << </a>]</td>
46 <td valign="middle" align="left">[<a href="libunistring_10.html#SEC41" title="Next chapter"> >> </a>]</td>
47 <td valign="middle" align="left"> </td>
48 <td valign="middle" align="left"> </td>
49 <td valign="middle" align="left"> </td>
50 <td valign="middle" align="left"> </td>
51 <td valign="middle" align="left"> </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_19.html#SEC77" title="Index">Index</a>]</td>
55 <td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
59 <a name="uniwidth_002eh"></a>
61 <h1 class="chapter"> <a href="libunistring.html#TOC40">9. Display width <code><uniwidth.h></code></a> </h1>
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.
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.
76 <p>These functions are locale dependent. The <var>encoding</var> argument identifies
77 the encoding (e.g. <code>"ISO-8859-2"</code> for Polish).
83 <dt><u>Function:</u> int <b>uc_width</b><i> (ucs4_t <var>uc</var>, const char *<var>encoding</var>)</i>
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.
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>
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>
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>
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.
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="IDX709"></a>
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="IDX710"></a>
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="IDX711"></a>
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.
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"> << </a>]</td>
122 <td valign="middle" align="left">[<a href="libunistring_10.html#SEC41" title="Next chapter"> >> </a>]</td>
123 <td valign="middle" align="left"> </td>
124 <td valign="middle" align="left"> </td>
125 <td valign="middle" align="left"> </td>
126 <td valign="middle" align="left"> </td>
127 <td valign="middle" align="left"> </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_19.html#SEC77" title="Index">Index</a>]</td>
131 <td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
135 This document was generated by <em>Daiki Ueno</em> on <em>September, 1 2014</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.