Blame doc/fcstring.fncs

Packit 352660
/*
Packit 352660
 * fontconfig/doc/fcstring.fncs
Packit 352660
 *
Packit 352660
 * Copyright © 2003 Keith Packard
Packit 352660
 *
Packit 352660
 * Permission to use, copy, modify, distribute, and sell this software and its
Packit 352660
 * documentation for any purpose is hereby granted without fee, provided that
Packit 352660
 * the above copyright notice appear in all copies and that both that
Packit 352660
 * copyright notice and this permission notice appear in supporting
Packit 352660
 * documentation, and that the name of the author(s) not be used in
Packit 352660
 * advertising or publicity pertaining to distribution of the software without
Packit 352660
 * specific, written prior permission.  The authors make no
Packit 352660
 * representations about the suitability of this software for any purpose.  It
Packit 352660
 * is provided "as is" without express or implied warranty.
Packit 352660
 *
Packit 352660
 * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
Packit 352660
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
Packit 352660
 * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR
Packit 352660
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
Packit 352660
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
Packit 352660
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
Packit 352660
 * PERFORMANCE OF THIS SOFTWARE.
Packit 352660
 */
Packit 352660
    <variablelist>
Packit 352660
Packit 352660
@RET@		int
Packit 352660
@FUNC@		FcUtf8ToUcs4 
Packit 352660
@TYPE1@		FcChar8 *			@ARG1@		src
Packit 352660
@TYPE2@		FcChar32 *			@ARG2@		dst
Packit 352660
@TYPE3@		int% 				@ARG3@		len
Packit 352660
@PURPOSE@	convert UTF-8 to UCS4
Packit 352660
@DESC@
Packit 352660
Converts the next Unicode char from <parameter>src</parameter> into
Packit 352660
<parameter>dst</parameter> and returns the number of bytes containing the
Packit 352660
char.  <parameter>src</parameter> must be at least
Packit 352660
<parameter>len</parameter> bytes long.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		int 
Packit 352660
@FUNC@		FcUcs4ToUtf8
Packit 352660
@TYPE1@		FcChar32% 			@ARG1@		src	 
Packit 352660
@TYPE2@		FcChar8% 			@ARG2@		dst[FC_UTF8_MAX_LEN]
Packit 352660
@PURPOSE@	convert UCS4 to UTF-8
Packit 352660
@DESC@
Packit 352660
Converts the Unicode char from <parameter>src</parameter> into
Packit 352660
<parameter>dst</parameter> and returns the number of bytes needed to encode
Packit 352660
the char.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcBool 
Packit 352660
@FUNC@		FcUtf8Len
Packit 352660
@TYPE1@		FcChar8 *			@ARG1@		src
Packit 352660
@TYPE2@		int% 				@ARG2@		len
Packit 352660
@TYPE3@		int *				@ARG3@		nchar
Packit 352660
@TYPE4@		int *				@ARG4@		wchar
Packit 352660
@PURPOSE@	count UTF-8 encoded chars
Packit 352660
@DESC@
Packit 352660
Counts the number of Unicode chars in <parameter>len</parameter> bytes of
Packit 352660
<parameter>src</parameter>.  Places that count in
Packit 352660
<parameter>nchar</parameter>.  <parameter>wchar</parameter> contains 1, 2 or
Packit 352660
4 depending on the number of bytes needed to hold the largest Unicode char
Packit 352660
counted.  The return value indicates whether <parameter>src</parameter> is a
Packit 352660
well-formed UTF8 string.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		int 
Packit 352660
@FUNC@		FcUtf16ToUcs4
Packit 352660
@TYPE1@		FcChar8 *			@ARG1@		src
Packit 352660
@TYPE2@		FcEndian% 			@ARG2@		endian
Packit 352660
@TYPE3@		FcChar32 *			@ARG3@		dst
Packit 352660
@TYPE4@		int% 				@ARG4@		len
Packit 352660
@PURPOSE@	convert UTF-16 to UCS4
Packit 352660
@DESC@
Packit 352660
Converts the next Unicode char from <parameter>src</parameter> into
Packit 352660
<parameter>dst</parameter> and returns the number of bytes containing the
Packit 352660
char. <parameter>src</parameter> must be at least <parameter>len</parameter>
Packit 352660
bytes long.  Bytes of <parameter>src</parameter> are combined into 16-bit
Packit 352660
units according to <parameter>endian</parameter>.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcBool
Packit 352660
@FUNC@		FcUtf16Len
Packit 352660
@TYPE1@		FcChar8 *			@ARG1@		src
Packit 352660
@TYPE2@		FcEndian% 			@ARG2@		endian
Packit 352660
@TYPE3@		int% 				@ARG3@		len
Packit 352660
@TYPE4@		int *				@ARG4@		nchar
Packit 352660
@TYPE5@		int *				@ARG5@		wchar
Packit 352660
@PURPOSE@	count UTF-16 encoded chars
Packit 352660
@DESC@
Packit 352660
Counts the number of Unicode chars in <parameter>len</parameter> bytes of
Packit 352660
<parameter>src</parameter>.  Bytes of <parameter>src</parameter> are
Packit 352660
combined into 16-bit units according to <parameter>endian</parameter>.
Packit 352660
Places that count in <parameter>nchar</parameter>.
Packit 352660
<parameter>wchar</parameter> contains 1, 2 or 4 depending on the number of
Packit 352660
bytes needed to hold the largest Unicode char counted.  The return value
Packit 352660
indicates whether <parameter>string</parameter> is a well-formed UTF16
Packit 352660
string.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcBool
Packit 352660
@FUNC@		FcIsLower
Packit 352660
@TYPE1@		FcChar8				@ARG1@		c
Packit 352660
@PURPOSE@	check for lower case ASCII character
Packit 352660
@DESC@
Packit 352660
This macro checks whether <parameter>c</parameter> is an lower case ASCII
Packit 352660
letter.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcBool
Packit 352660
@FUNC@		FcIsUpper
Packit 352660
@TYPE1@		FcChar8				@ARG1@		c
Packit 352660
@PURPOSE@	check for upper case ASCII character
Packit 352660
@DESC@
Packit 352660
This macro checks whether <parameter>c</parameter> is a upper case ASCII
Packit 352660
letter.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8
Packit 352660
@FUNC@		FcToLower
Packit 352660
@TYPE1@		FcChar8				@ARG1@		c
Packit 352660
@PURPOSE@	convert upper case ASCII to lower case
Packit 352660
@DESC@
Packit 352660
This macro converts upper case ASCII <parameter>c</parameter> to the
Packit 352660
equivalent lower case letter.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrCopy
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s
Packit 352660
@PURPOSE@	duplicate a string
Packit 352660
@DESC@
Packit 352660
Allocates memory, copies <parameter>s</parameter> and returns the resulting
Packit 352660
buffer.  Yes, this is <function>strdup</function>, but that function isn't
Packit 352660
available on every platform.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrDowncase
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s
Packit 352660
@PURPOSE@	create a lower case translation of a string
Packit 352660
@DESC@
Packit 352660
Allocates memory, copies <parameter>s</parameter>, converting upper case
Packit 352660
letters to lower case and returns the allocated buffer.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrCopyFilename
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s
Packit 352660
@PURPOSE@	create a complete path from a filename
Packit 352660
@DESC@
Packit 352660
<function>FcStrCopyFilename</function> constructs an absolute pathname from
Packit 352660
<parameter>s</parameter>. It converts any leading '~' characters in
Packit 352660
to the value of the HOME environment variable, and any relative paths are
Packit 352660
converted to absolute paths using the current working directory. Sequences
Packit 352660
of '/' characters are converted to a single '/', and names containing the
Packit 352660
current directory '.' or parent directory '..' are correctly reconstructed.
Packit 352660
Returns NULL if '~' is the leading character and HOME is unset or disabled
Packit 352660
(see <function>FcConfigEnableHome</function>).
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		int
Packit 352660
@FUNC@		FcStrCmp
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s1
Packit 352660
@TYPE2@		const FcChar8 *			@ARG2@		s2
Packit 352660
@PURPOSE@	compare UTF-8 strings
Packit 352660
@DESC@
Packit 352660
Returns the usual <0, 0, >0 result of comparing
Packit 352660
<parameter>s1</parameter> and <parameter>s2</parameter>. 
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		int
Packit 352660
@FUNC@		FcStrCmpIgnoreCase
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s1
Packit 352660
@TYPE2@		const FcChar8 *			@ARG2@		s2
Packit 352660
@PURPOSE@	compare UTF-8 strings ignoring case
Packit 352660
@DESC@
Packit 352660
Returns the usual <0, 0, >0 result of comparing
Packit 352660
<parameter>s1</parameter> and <parameter>s2</parameter>. This test is
Packit 352660
case-insensitive for all proper UTF-8 encoded strings.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrStr
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s1
Packit 352660
@TYPE2@		const FcChar8 *			@ARG2@		s2
Packit 352660
@PURPOSE@	locate UTF-8 substring
Packit 352660
@DESC@
Packit 352660
Returns the location of <parameter>s2</parameter> in
Packit 352660
<parameter>s1</parameter>.  Returns NULL if <parameter>s2</parameter>
Packit 352660
is not present in <parameter>s1</parameter>. This test will operate properly
Packit 352660
with UTF8 encoded strings.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrStrIgnoreCase
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s1
Packit 352660
@TYPE2@		const FcChar8 *			@ARG2@		s2
Packit 352660
@PURPOSE@	locate UTF-8 substring ignoring ASCII case
Packit 352660
@DESC@
Packit 352660
Returns the location of <parameter>s2</parameter> in 
Packit 352660
<parameter>s1</parameter>, ignoring case.  Returns NULL if
Packit 352660
<parameter>s2</parameter> is not present in <parameter>s1</parameter>.
Packit 352660
This test is case-insensitive for all proper UTF-8 encoded strings.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrPlus
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		s1
Packit 352660
@TYPE2@		const FcChar8 *			@ARG2@		s2
Packit 352660
@PURPOSE@	concatenate two strings
Packit 352660
@DESC@
Packit 352660
This function allocates new storage and places the concatenation of
Packit 352660
<parameter>s1</parameter> and <parameter>s2</parameter> there, returning the
Packit 352660
new string.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		void
Packit 352660
@FUNC@		FcStrFree
Packit 352660
@TYPE1@		FcChar8 *			@ARG1@		s
Packit 352660
@PURPOSE@	free a string
Packit 352660
@DESC@
Packit 352660
This is just a wrapper around free(3) which helps track memory usage of
Packit 352660
strings within the fontconfig library.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrDirname
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		file
Packit 352660
@PURPOSE@	directory part of filename
Packit 352660
@DESC@
Packit 352660
Returns the directory containing <parameter>file</parameter>.  This
Packit 352660
is returned in newly allocated storage which should be freed when no longer
Packit 352660
needed.
Packit 352660
@@
Packit 352660
Packit 352660
@RET@		FcChar8 *
Packit 352660
@FUNC@		FcStrBasename
Packit 352660
@TYPE1@		const FcChar8 *			@ARG1@		file
Packit 352660
@PURPOSE@	last component of filename
Packit 352660
@DESC@
Packit 352660
Returns the filename of <parameter>file</parameter> stripped of any leading
Packit 352660
directory names.  This is returned in newly allocated storage which should
Packit 352660
be freed when no longer needed.
Packit 352660
@@