fcfontset.fncs revision 2c393a42
12c393a42Smrg/*
22c393a42Smrg * $Id: fcfontset.fncs,v 1.1.1.1 2008/07/30 01:24:16 mrg Exp $
32c393a42Smrg *
42c393a42Smrg * Copyright © 2003 Keith Packard
52c393a42Smrg *
62c393a42Smrg * Permission to use, copy, modify, distribute, and sell this software and its
72c393a42Smrg * documentation for any purpose is hereby granted without fee, provided that
82c393a42Smrg * the above copyright notice appear in all copies and that both that
92c393a42Smrg * copyright notice and this permission notice appear in supporting
102c393a42Smrg * documentation, and that the name of Keith Packard not be used in
112c393a42Smrg * advertising or publicity pertaining to distribution of the software without
122c393a42Smrg * specific, written prior permission.  Keith Packard makes no
132c393a42Smrg * representations about the suitability of this software for any purpose.  It
142c393a42Smrg * is provided "as is" without express or implied warranty.
152c393a42Smrg *
162c393a42Smrg * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
172c393a42Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
182c393a42Smrg * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
192c393a42Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
202c393a42Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
212c393a42Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
222c393a42Smrg * PERFORMANCE OF THIS SOFTWARE.
232c393a42Smrg */
242c393a42Smrg@RET@		FcFontSet *
252c393a42Smrg@FUNC@		FcFontSetCreate
262c393a42Smrg@TYPE1@		void
272c393a42Smrg@PURPOSE@	Create a font set
282c393a42Smrg@DESC@
292c393a42SmrgCreates an empty font set.
302c393a42Smrg@@
312c393a42Smrg
322c393a42Smrg@RET@		void
332c393a42Smrg@FUNC@		FcFontSetDestroy
342c393a42Smrg@TYPE1@		FcFontSet *			@ARG1@		s
352c393a42Smrg@PURPOSE@	Destroy a font set
362c393a42Smrg@DESC@
372c393a42SmrgDestroys a font set.  Note that this destroys any referenced patterns as
382c393a42Smrgwell.
392c393a42Smrg@@
402c393a42Smrg
412c393a42Smrg@RET@		FcBool
422c393a42Smrg@FUNC@		FcFontSetAdd
432c393a42Smrg@TYPE1@		FcFontSet *			@ARG1@		s
442c393a42Smrg@TYPE2@		FcPattern *			@ARG2@		font
452c393a42Smrg@PURPOSE@	Add to a font set
462c393a42Smrg@DESC@
472c393a42SmrgAdds a pattern to a font set.  Note that the pattern is not copied before
482c393a42Smrgbeing inserted into the set. Returns FcFalse if the pattern cannot be
492c393a42Smrginserted into the set (due to allocation failure). Otherwise returns FcTrue.
502c393a42Smrg@@
512c393a42Smrg
522c393a42Smrg@RET@		FcFontSet *
532c393a42Smrg@FUNC@		FcFontSetList
542c393a42Smrg@TYPE1@		FcConfig *			@ARG1@		config
552c393a42Smrg@TYPE2@		FcFontSet **			@ARG2@		sets
562c393a42Smrg@TYPE3@		int				@ARG3@		nsets
572c393a42Smrg@TYPE4@		FcPattern *			@ARG4@		pattern
582c393a42Smrg@TYPE5@		FcObjectSet *			@ARG5@		object_set
592c393a42Smrg@PURPOSE@	List fonts from a set of font sets
602c393a42Smrg@DESC@
612c393a42SmrgSelects fonts matching <parameter>pattern</parameter> from
622c393a42Smrg<parameter>sets</parameter>, creates patterns from those
632c393a42Smrgfonts containing only the objects in <parameter>object_set</parameter> and returns
642c393a42Smrgthe set of unique such patterns.
652c393a42Smrg@@
662c393a42Smrg
672c393a42Smrg@RET@		FcPattern *
682c393a42Smrg@FUNC@		FcFontSetMatch
692c393a42Smrg@TYPE1@		FcConfig *			@ARG1@		config
702c393a42Smrg@TYPE2@		FcFontSet **			@ARG2@		sets
712c393a42Smrg@TYPE3@		int				@ARG3@		nsets
722c393a42Smrg@TYPE4@		FcPattern *			@ARG4@		pattern
732c393a42Smrg@TYPE5@		FcResult *			@ARG5@		result
742c393a42Smrg@PURPOSE@	Return the best font from a set of font sets
752c393a42Smrg@DESC@
762c393a42SmrgFinds the font in <parameter>sets</parameter> most closely matching
772c393a42Smrg<parameter>pattern</parameter> and returns the result of
782c393a42Smrg<function>FcFontRenderPrepare</function> for that font and the provided
792c393a42Smrgpattern. This function should be called only after
802c393a42Smrg<function>FcConfigSubstitute</function> and
812c393a42Smrg<function>FcDefaultSubstitute</function> have been called for
822c393a42Smrg<parameter>pattern</parameter>; otherwise the results will not be correct.
832c393a42SmrgReturns NULL if an error occurs during this process.
842c393a42Smrg@@
852c393a42Smrg
862c393a42Smrg@RET@		void
872c393a42Smrg@FUNC@		FcFontSetPrint
882c393a42Smrg@TYPE1@		FcFontSet *			@ARG1@		set
892c393a42Smrg@PURPOSE@	Print a set of patterns to stdout
902c393a42Smrg@DESC@
912c393a42SmrgThis function is useful for diagnosing font related issues, printing the
922c393a42Smrgcomplete contents of every pattern in <parameter>set</parameter>. The format
932c393a42Smrgof the output is designed to be of help to users and developers, and may
942c393a42Smrgchange at any time.
952c393a42Smrg@@
962c393a42Smrg
972c393a42Smrg@RET@		
982c393a42Smrg@FUNC@		FcFontSetSort
992c393a42Smrg@TYPE1@         FcConfig *			@ARG1@		config
1002c393a42Smrg@TYPE2@		FcFontSet **			@ARG2@		sets
1012c393a42Smrg@TYPE3@		int				@ARG3@		nsets
1022c393a42Smrg@TYPE4@		FcPattern *			@ARG4@		pattern
1032c393a42Smrg@TYPE5@		FcBool%				@ARG5@		trim
1042c393a42Smrg@TYPE6@		FcCharSet **			@ARG6@		csp
1052c393a42Smrg@TYPE7@		FcResult *                      @ARG7@          result
1062c393a42Smrg@PURPOSE@	Add to a font set
1072c393a42Smrg@DESC@
1082c393a42SmrgReturns the list of fonts from <parameter>sets</parameter>
1092c393a42Smrgsorted by closeness to <parameter>pattern</parameter>.  
1102c393a42SmrgIf <parameter>trim</parameter> is FcTrue,
1112c393a42Smrgelements in the list which don't include Unicode coverage not provided by
1122c393a42Smrgearlier elements in the list are elided.  The union of Unicode coverage of
1132c393a42Smrgall of the fonts is returned in <parameter>csp</parameter>,
1142c393a42Smrgif <parameter>csp</parameter> is not NULL.  This function
1152c393a42Smrgshould be called only after FcConfigSubstitute and FcDefaultSubstitute have
1162c393a42Smrgbeen called for <parameter>p</parameter>;
1172c393a42Smrgotherwise the results will not be correct.
1182c393a42Smrg    </para><para>
1192c393a42SmrgThe returned FcFontSet references FcPattern structures which may be shared
1202c393a42Smrgby the return value from multiple FcFontSort calls, applications cannot
1212c393a42Smrgmodify these patterns.  Instead, they should be passed, along with
1222c393a42Smrg<parameter>pattern</parameter> to
1232c393a42Smrg<function>FcFontRenderPrepare</function> which combines them into a complete pattern.
1242c393a42Smrg    </para><para>
1252c393a42SmrgThe FcFontSet returned by FcFontSetSort is destroyed by caling FcFontSetDestroy.
1262c393a42Smrg@@
1272c393a42Smrg
1282c393a42Smrg@RET@		
1292c393a42Smrg@FUNC@		FcFontSetSortDestroy
1302c393a42Smrg@TYPE1@		FcFontSet *			@ARG1@		set
1312c393a42Smrg@PURPOSE@	DEPRECATED destroy a font set
1322c393a42Smrg@DESC@
1332c393a42SmrgThis function is DEPRECATED. <function>FcFontSetSortDestroy</function>
1342c393a42Smrgdestroys <parameter>set</parameter> by calling
1352c393a42Smrg<function>FcFontSetDestroy</function>. Applications should use
1362c393a42Smrg<function>FcFontSetDestroy</function> directly instead.
1372c393a42Smrg@@
138