summaryrefslogtreecommitdiff
path: root/doc/fcstring.fncs
blob: bac5444bef284c8d82e6fd59ad8679041f0dcfe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
 * $Id$
 *
 * Copyright © 2003 Keith Packard
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name of Keith Packard not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Keith Packard makes no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.
 *
 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */
    <variablelist>

@RET@		int
@FUNC@		FcUtf8ToUcs4 
@TYPE1@		FcChar8 *			@ARG1@		src
@TYPE2@		FcChar32 *			@ARG2@		dst
@TYPE3@		int% 				@ARG3@		len
@PURPOSE@	convert UTF-8 to UCS4
@DESC@
Converts the next Unicode char from <parameter>src</parameter> into
<parameter>dst</parameter> and returns the number of bytes containing the
char.  <parameter>src</parameter> must be at least
<parameter>len</parameter> bytes long.
@@

@RET@		int 
@FUNC@		FcUcs4ToUtf8
@TYPE1@		FcChar32% 			@ARG1@		src	 
@TYPE2@		FcChar8% 			@ARG2@		dst[FC_UTF8_MAX_LEN]
@PURPOSE@	convert UCS4 to UTF-8
@DESC@
Converts the Unicode char from <parameter>src</parameter> into
<parameter>dst</parameter> and returns the number of bytes needed to encode
the char.
@@

@RET@		FcBool 
@FUNC@		FcUtf8Len
@TYPE1@		FcChar8 *			@ARG1@		src
@TYPE2@		int% 				@ARG2@		len
@TYPE3@		int *				@ARG3@		nchar
@TYPE4@		int *				@ARG4@		wchar
@PURPOSE@	count UTF-8 encoded chars
@DESC@
Counts the number of Unicode chars in <parameter>len</parameter> bytes of
<parameter>src</parameter>.  Places that count in
<parameter>nchar</parameter>.  <parameter>wchar</parameter> contains 1, 2 or
4 depending on the number of bytes needed to hold the largest unicode char
counted.  The return value indicates whether <parameter>src</parameter> is a
well-formed UTF8 string.
@@

@RET@		int 
@FUNC@		FcUtf16ToUcs4
@TYPE1@		FcChar8 *			@ARG1@		src
@TYPE2@		FcEndian% 			@ARG2@		endian
@TYPE3@		FcChar32 *			@ARG3@		dst
@TYPE4@		int% 				@ARG4@		len
@PURPOSE@	convert UTF-16 to UCS4
@DESC@
Converts the next Unicode char from <parameter>src</parameter> into
<parameter>dst</parameter> and returns the number of bytes containing the
char. <parameter>src</parameter> must be at least <parameter>len</parameter>
bytes long.  Bytes of <parameter>src</parameter> are combined into 16-bit
units according to <parameter>endian</parameter>.
@@

@RET@		FcBool
@FUNC@		FcUtf16Len
@TYPE1@		FcChar8 *			@ARG1@		src
@TYPE2@		FcEndian% 			@ARG2@		endian
@TYPE3@		int% 				@ARG3@		len
@TYPE4@		int *				@ARG4@		nchar
@TYPE5@		int *				@ARG5@		wchar
@PURPOSE@	count UTF-16 encoded chars
@DESC@
Counts the number of Unicode chars in <parameter>len</parameter> bytes of
<parameter>src</parameter>.  Bytes of <parameter>src</parameter> are
combined into 16-bit units according to <parameter>endian</parameter>.
Places that count in <parameter>nchar</parameter>.
<parameter>wchar</parameter> contains 1, 2 or 4 depending on the number of
bytes needed to hold the largest unicode char counted.  The return value
indicates whether <parameter>string</parameter> is a well-formed UTF16
string.
@@

@RET@		FcChar8 *
@FUNC@		FcStrCopy
@TYPE1@		const FcChar8 *			@ARG1@		s
@PURPOSE@	duplicate a string
@DESC@
Allocates memory, copies <parameter>s</parameter> and returns the resulting
buffer.  Yes, this is <function>strdup</function>, but that function isn't
available on every platform.
@@

@RET@		FcChar8 *
@FUNC@		FcStrDowncase
@TYPE1@		const FcChar8 *			@ARG1@		s
@PURPOSE@	create a lower case translation of a string
@DESC@
Allocates memory, copies <parameter>s</parameter>, converting upper case
letters to lower case and returns the allocated buffer.
@@

@RET@		FcChar8 *
@FUNC@		FcStrCopyFilename
@TYPE1@		const FcChar8 *			@ARG1@		s
@PURPOSE@	copy a string, expanding '~'
@DESC@
Just like FcStrCopy except that it converts any leading '~' characters in
<parameter>s</parameter> to the value of the HOME environment variable.
Returns NULL if '~' is present in <parameter>s</parameter> and HOME is unset.
@@

@RET@		int
@FUNC@		FcStrCmpIgnoreCase
@TYPE1@		const FcChar8 *			@ARG1@		s1
@TYPE2@		const FcChar8 *			@ARG2@		s2
@PURPOSE@	compare UTF-8 strings ignoring ASCII case
@DESC@
Returns the usual &lt;0, 0, &gt;0 result of comparing
<parameter>s1</parameter> and <parameter>s2</parameter>.  This test is
case-insensitive in the ASCII range and will operate properly with UTF8
encoded strings, although it does not check for well formed strings.
@@

@RET@		FcChar8 *
@FUNC@		FcStrStr
@TYPE1@		const char *			@ARG1@		s1
@TYPE2@		const char *			@ARG2@		s2
@PURPOSE@	locate UTF-8 substring
@DESC@
Returns the location of <parameter>s2</parameter> in
<parameter>s1</parameter>.  Returns NULL if <parameter>s2</parameter>
is not present in <parameter>s1</parameter>. This test will operate properly
with UTF8 encoded strings, although it does not check for well formed
strings.
@@

@RET@		FcChar8 *
@FUNC@		FcStrStrIgnoreCase
@TYPE1@		const char *			@ARG1@		s1
@TYPE2@		const char *			@ARG2@		s2
@PURPOSE@	locate UTF-8 substring ignoring ASCII case
@DESC@
Returns the location of <parameter>s2</parameter> in 
<parameter>s1</parameter>, ignoring ASCII case.  Returns NULL if
<parameter>s2</parameter> is not present in <parameter>s1</parameter>.
This test is case-insensitive in the ASCII range and will operate properly
with UTF8 encoded strings, although it does not check for well formed
strings.
@@

@RET@		FcChar8 *
@FUNC@		FcStrDirname
@TYPE1@		const FcChar8 *			@ARG1@		file
@PURPOSE@	directory part of filename
@DESC@
Returns the directory containing <parameter>file</parameter>.  This
is returned in newly allocated storage which should be freed when no longer
needed.
@@

@RET@		FcChar8 *
@FUNC@		FcStrBasename
@TYPE1@		const FcChar8 *			@ARG1@		file
@PURPOSE@	last component of filename
@DESC@
Returns the filename of <parameter>file</parameter> stripped of any leading
directory names.  This is returned in newly allocated storage which should
be freed when no longer needed.
@@