4 * Copyright © 2003 Keith Packard
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of Keith Packard not be used in
11 * advertising or publicity pertaining to distribution of the software without
12 * specific, written prior permission. Keith Packard makes no
13 * representations about the suitability of this software for any purpose. It
14 * is provided "as is" without express or implied warranty.
16 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22 * PERFORMANCE OF THIS SOFTWARE.
28 @TYPE1@ FcChar8 * @ARG1@ src
29 @TYPE2@ FcChar32 * @ARG2@ dst
30 @TYPE3@ int% @ARG3@ len
31 @PURPOSE@ convert UTF-8 to UCS4
33 Converts the next Unicode char from <parameter>src</parameter> into
34 <parameter>dst</parameter> and returns the number of bytes containing the
35 char. <parameter>src</parameter> must be at least
36 <parameter>len</parameter> bytes long.
41 @TYPE1@ FcChar32% @ARG1@ src
42 @TYPE2@ FcChar8% @ARG2@ dst[FC_UTF8_MAX_LEN]
43 @PURPOSE@ convert UCS4 to UTF-8
45 Converts the Unicode char from <parameter>src</parameter> into
46 <parameter>dst</parameter> and returns the number of bytes needed to encode
52 @TYPE1@ FcChar8 * @ARG1@ src
53 @TYPE2@ int% @ARG2@ len
54 @TYPE3@ int * @ARG3@ nchar
55 @TYPE4@ int * @ARG4@ wchar
56 @PURPOSE@ count UTF-8 encoded chars
58 Counts the number of Unicode chars in <parameter>len</parameter> bytes of
59 <parameter>src</parameter>. Places that count in
60 <parameter>nchar</parameter>. <parameter>wchar</parameter> contains 1, 2 or
61 4 depending on the number of bytes needed to hold the largest unicode char
62 counted. The return value indicates whether <parameter>src</parameter> is a
63 well-formed UTF8 string.
68 @TYPE1@ FcChar8 * @ARG1@ src
69 @TYPE2@ FcEndian% @ARG2@ endian
70 @TYPE3@ FcChar32 * @ARG3@ dst
71 @TYPE4@ int% @ARG4@ len
72 @PURPOSE@ convert UTF-16 to UCS4
74 Converts the next Unicode char from <parameter>src</parameter> into
75 <parameter>dst</parameter> and returns the number of bytes containing the
76 char. <parameter>src</parameter> must be at least <parameter>len</parameter>
77 bytes long. Bytes of <parameter>src</parameter> are combined into 16-bit
78 units according to <parameter>endian</parameter>.
83 @TYPE1@ FcChar8 * @ARG1@ src
84 @TYPE2@ FcEndian% @ARG2@ endian
85 @TYPE3@ int% @ARG3@ len
86 @TYPE4@ int * @ARG4@ nchar
87 @TYPE5@ int * @ARG5@ wchar
88 @PURPOSE@ count UTF-16 encoded chars
90 Counts the number of Unicode chars in <parameter>len</parameter> bytes of
91 <parameter>src</parameter>. Bytes of <parameter>src</parameter> are
92 combined into 16-bit units according to <parameter>endian</parameter>.
93 Places that count in <parameter>nchar</parameter>.
94 <parameter>wchar</parameter> contains 1, 2 or 4 depending on the number of
95 bytes needed to hold the largest unicode char counted. The return value
96 indicates whether <parameter>string</parameter> is a well-formed UTF16
102 @TYPE1@ FcChar8 @ARG1@ c
103 @PURPOSE@ check for lower case ASCII character
105 This macro checks whether <parameter>c</parameter> is an lower case ASCII
111 @TYPE1@ FcChar8 @ARG1@ c
112 @PURPOSE@ check for upper case ASCII character
114 This macro checks whether <parameter>c</parameter> is a upper case ASCII
120 @TYPE1@ FcChar8 @ARG1@ c
121 @PURPOSE@ convert upper case ASCII to lower case
123 This macro converts upper case ASCII <parameter>c</parameter> to the
124 equivalent lower case letter.
129 @TYPE1@ const FcChar8 * @ARG1@ s
130 @PURPOSE@ duplicate a string
132 Allocates memory, copies <parameter>s</parameter> and returns the resulting
133 buffer. Yes, this is <function>strdup</function>, but that function isn't
134 available on every platform.
139 @TYPE1@ const FcChar8 * @ARG1@ s
140 @PURPOSE@ create a lower case translation of a string
142 Allocates memory, copies <parameter>s</parameter>, converting upper case
143 letters to lower case and returns the allocated buffer.
147 @FUNC@ FcStrCopyFilename
148 @TYPE1@ const FcChar8 * @ARG1@ s
149 @PURPOSE@ copy a string, expanding '~'
151 Just like FcStrCopy except that it converts any leading '~' characters in
152 <parameter>s</parameter> to the value of the HOME environment variable.
153 Returns NULL if '~' is present in <parameter>s</parameter> and HOME is unset.
158 @TYPE1@ const FcChar8 * @ARG1@ s1
159 @TYPE2@ const FcChar8 * @ARG2@ s2
160 @PURPOSE@ compare UTF-8 strings
162 Returns the usual <0, 0, >0 result of comparing
163 <parameter>s1</parameter> and <parameter>s2</parameter>.
167 @FUNC@ FcStrCmpIgnoreCase
168 @TYPE1@ const FcChar8 * @ARG1@ s1
169 @TYPE2@ const FcChar8 * @ARG2@ s2
170 @PURPOSE@ compare UTF-8 strings ignoring case
172 Returns the usual <0, 0, >0 result of comparing
173 <parameter>s1</parameter> and <parameter>s2</parameter>. This test is
174 case-insensitive for all proper UTF-8 encoded strings.
179 @TYPE1@ const FcChar8 * @ARG1@ s1
180 @TYPE2@ const FcChar8 * @ARG2@ s2
181 @PURPOSE@ locate UTF-8 substring
183 Returns the location of <parameter>s2</parameter> in
184 <parameter>s1</parameter>. Returns NULL if <parameter>s2</parameter>
185 is not present in <parameter>s1</parameter>. This test will operate properly
186 with UTF8 encoded strings.
190 @FUNC@ FcStrStrIgnoreCase
191 @TYPE1@ const FcChar8 * @ARG1@ s1
192 @TYPE2@ const FcChar8 * @ARG2@ s2
193 @PURPOSE@ locate UTF-8 substring ignoring ASCII case
195 Returns the location of <parameter>s2</parameter> in
196 <parameter>s1</parameter>, ignoring case. Returns NULL if
197 <parameter>s2</parameter> is not present in <parameter>s1</parameter>.
198 This test is case-insensitive for all proper UTF-8 encoded strings.
203 @TYPE1@ const FcChar8 * @ARG1@ s1
204 @TYPE2@ const FcChar8 * @ARG2@ s2
205 @PURPOSE@ concatenate two strings
207 This function allocates new storage and places the concatenation of
208 <parameter>s1</parameter> and <parameter>s2</parameter> there, returning the
214 @TYPE1@ FcChar8 * @ARG1@ s
215 @PURPOSE@ free a string
217 This is just a wrapper around free(3) which helps track memory usage of
218 strings within the fontconfig library.
222 @TYPE1@ const FcChar8 * @ARG1@ file
223 @PURPOSE@ directory part of filename
225 Returns the directory containing <parameter>file</parameter>. This
226 is returned in newly allocated storage which should be freed when no longer
232 @TYPE1@ const FcChar8 * @ARG1@ file
233 @PURPOSE@ last component of filename
235 Returns the filename of <parameter>file</parameter> stripped of any leading
236 directory names. This is returned in newly allocated storage which should
237 be freed when no longer needed.