Keith Packard
2006-Dec-02 15:18 UTC
[Fontconfig] fontconfig: Branch ''master'' - 13 commits
configure.in | 6 doc/Makefile.am | 14 +- doc/edit-sgml.c | 5 doc/fcblanks.fncs | 4 doc/fccharset.fncs | 8 - doc/fcconfig.fncs | 12 - doc/fcconstant.fncs | 4 doc/fcfile.fncs | 4 doc/fcfreetype.fncs | 25 +++- doc/fcmatrix.fncs | 12 - doc/fcobjectset.fncs | 2 doc/fcobjecttype.fncs | 4 doc/fcpattern.fncs | 32 ++--- doc/fcstring.fncs | 16 +- doc/fcvalue.fncs | 4 doc/fontconfig-user.sgml | 87 +++++++------- fc-arch/fcarch.tmpl.h | 1 fc-cat/fc-cat.c | 9 + fc-cat/fc-cat.sgml | 26 +++- fontconfig/fcfreetype.h | 6 src/fccache.c | 13 +- src/fcdir.c | 2 src/fcfreetype.c | 287 ++++++++++++++++++++++++++++------------------- src/fcinit.c | 19 +++ src/fcint.h | 1 src/fcpat.c | 17 ++ src/fcstr.c | 2 src/fcxml.c | 6 src/makealias | 2 29 files changed, 397 insertions(+), 233 deletions(-) New commits: diff-tree e3b65ee06808cda296215b88111a259a200cc37c (from 61895ed16c0c06e4d6b2abeb8ff292d53b4ea499) Author: Peter Breitenlohner <peb@mppmu.mpg.de> Date: Sat Dec 2 15:09:57 2006 -0800 Fix fc-cat documentation (bug 8935). Adapt documentation to reality. (1) The fc-cat usage message should reflect the options accepted by the program. (2) The fc-cat.1 manpage was fairly broken (unreadable). diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c index 476798e..a2c238c 100644 --- a/fc-cat/fc-cat.c +++ b/fc-cat/fc-cat.c @@ -149,10 +149,11 @@ static void usage (char *program) { #if HAVE_GETOPT_LONG - fprintf (stderr, "usage: %s [-V?] [--version] [--help] {*-%s.cache-2|directory}...\n", + fprintf (stderr, "usage: %s [-rv] [--recurse] [--verbose] [*-%s.cache-2|directory]...\n", program, FC_ARCHITECTURE); + fprintf (stderr, " %s [-V?] [--version] [--help]\n", program); #else - fprintf (stderr, "usage: %s [-fsvV?] {*-%s.cache-2|directory}...\n", + fprintf (stderr, "usage: %s [-rvV?] [*-%s.cache-2|directory]...\n", program, FC_ARCHITECTURE); #endif fprintf (stderr, "Reads font information cache from:\n"); @@ -160,9 +161,13 @@ usage (char *program) fprintf (stderr, " 2) related to a particular font directory\n"); fprintf (stderr, "\n"); #if HAVE_GETOPT_LONG + fprintf (stderr, " -r, --recurse recurse into subdirectories\n"); + fprintf (stderr, " -v, --verbose be verbose\n"); fprintf (stderr, " -V, --version display font config version and exit\n"); fprintf (stderr, " -?, --help display this help and exit\n"); #else + fprintf (stderr, " -r (recurse) recurse into subdirectories\n"); + fprintf (stderr, " -v (verbose) be verbose\n"); fprintf (stderr, " -V (version) display font config version and exit\n"); fprintf (stderr, " -? (help) display this help and exit\n"); #endif diff --git a/fc-cat/fc-cat.sgml b/fc-cat/fc-cat.sgml index 812b0fa..cc06a75 100644 --- a/fc-cat/fc-cat.sgml +++ b/fc-cat/fc-cat.sgml @@ -61,11 +61,14 @@ manpage.1: manpage.sgml </refnamediv> <refsynopsisdiv> <cmdsynopsis> - <command>&dhpackage; < fonts-cache-2-file ></command> + <command>&dhpackage;</command> - <arg><option>-V?</option></arg> + <arg><option>-rvV?</option></arg> + <arg><option>--recurse</option></arg> + <arg><option>--verbose</option></arg> <arg><option>--version</option></arg> <arg><option>--help</option></arg> + <arg><option><replaceable>fonts-cache-2-files</replaceable></option></arg> <arg><option><replaceable>dirs</replaceable></option></arg> </cmdsynopsis> @@ -73,7 +76,8 @@ manpage.1: manpage.sgml <refsect1> <title>DESCRIPTION</title> - <para><command>&dhpackage;</command> reads a font information cache file + <para><command>&dhpackage;</command> reads the font information from + cache files or related to font directories and emits it in ASCII form.</para> </refsect1> @@ -86,6 +90,22 @@ manpage.1: manpage.sgml <variablelist> <varlistentry> + <term><option>-r</option> + <option>--recurse</option> + </term> + <listitem> + <para>Recurse into subdirectories.</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>-v</option> + <option>--verbose</option> + </term> + <listitem> + <para>Be verbose.</para> + </listitem> + </varlistentry> + <varlistentry> <term><option>-?</option> <option>--help</option> </term> diff-tree 61895ed16c0c06e4d6b2abeb8ff292d53b4ea499 (from b1aa20098f641a16d02e70a161450e6b85afe410) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 15:06:13 2006 -0800 Add space between type and formal in devel man pages (bug 8935) Most parameters are pointers and have ''*'' in the type; for those which do not, use ''%'' to mark where a space needs to be inserted. diff --git a/doc/edit-sgml.c b/doc/edit-sgml.c index 77cc807..3f3be53 100644 --- a/doc/edit-sgml.c +++ b/doc/edit-sgml.c @@ -294,6 +294,11 @@ ReplaceRead (FILE *f) ungetc (c, f); while (isspace (StringLast (r->text))) StringDel (r->text); + if (StringLast(r->text) == ''%'') + { + StringDel (r->text); + StringAdd (r->text, '' ''); + } return r; } diff --git a/doc/fcblanks.fncs b/doc/fcblanks.fncs index 696caa5..5b8bab3 100644 --- a/doc/fcblanks.fncs +++ b/doc/fcblanks.fncs @@ -40,7 +40,7 @@ Destroys an FcBlanks object, freeing any @RET@ FcBool @FUNC@ FcBlanksAdd @TYPE1@ FcBlanks * @ARG1@ b -@TYPE2@ FcChar32 @ARG2@ ucs4 +@TYPE2@ FcChar32% @ARG2@ ucs4 @PURPOSE@ Add a character to an FcBlanks @DESC@ Adds a single character to an FcBlanks object, returning FcFalse @@ -50,7 +50,7 @@ if this process ran out of memory. @RET@ FcBool @FUNC@ FcBlanksIsMember @TYPE1@ FcBlanks * @ARG1@ b -@TYPE2@ FcChar32 @ARG2@ ucs4 +@TYPE2@ FcChar32% @ARG2@ ucs4 @PURPOSE@ Query membership in an FcBlanks @DESC@ Returns whether the specified FcBlanks object contains the indicated Unicode diff --git a/doc/fccharset.fncs b/doc/fccharset.fncs index 700a20b..cb07680 100644 --- a/doc/fccharset.fncs +++ b/doc/fccharset.fncs @@ -43,7 +43,7 @@ memory referenced is freed. @RET@ FcBool @FUNC@ FcCharSetAddChar @TYPE1@ FcCharSet * @ARG1@ fcs -@TYPE2@ FcChar32 @ARG2@ ucs4 +@TYPE2@ FcChar32% @ARG2@ ucs4 @PURPOSE@ Add a character to a charset @DESC@ <function>FcCharSetAddChar</function> adds a single unicode char to the set, @@ -101,7 +101,7 @@ Returns a set including only those chars @RET@ FcBool @FUNC@ FcCharSetHasChar @TYPE1@ const FcCharSet * @ARG1@ fcs -@TYPE2@ FcChar32 @ARG2@ ucs4 +@TYPE2@ FcChar32% @ARG2@ ucs4 @PURPOSE@ Check a charset for a char @DESC@ Returns whether <parameter>fcs</parameter> contains the char <parameter>ucs4</parameter>. @@ -145,7 +145,7 @@ Returns whether <parameter>a</parameter> @RET@ FcChar32 @FUNC@ FcCharSetFirstPage @TYPE1@ const FcCharSet * @ARG1@ a -@TYPE2@ FcChar32[FC_CHARSET_MAP_SIZE] @ARG2@ map +@TYPE2@ FcChar32[FC_CHARSET_MAP_SIZE]% @ARG2@ map @TYPE3@ FcChar32 * @ARG3@ next @PURPOSE@ Start enumerating charset contents @DESC@ @@ -157,7 +157,7 @@ font. @RET@ FcChar32 @FUNC@ FcCharSetNextPage @TYPE1@ const FcCharSet * @ARG1@ a -@TYPE2@ FcChar32[FC_CHARSET_MAP_SIZE] @ARG2@ map +@TYPE2@ FcChar32[FC_CHARSET_MAP_SIZE]% @ARG2@ map @TYPE3@ FcChar32 * @ARG3@ next @PURPOSE@ Continue enumerating charset contents @DESC@ diff --git a/doc/fcconfig.fncs b/doc/fcconfig.fncs index 3680b0e..e29c392 100644 --- a/doc/fcconfig.fncs +++ b/doc/fcconfig.fncs @@ -114,7 +114,7 @@ Returns the name of the file used to sto @RET@ FcFontSet * @FUNC@ FcConfigGetFonts @TYPE1@ FcConfig * @ARG1@ config -@TYPE2@ FcSetName @ARG2@ set +@TYPE2@ FcSetName% @ARG2@ set @PURPOSE@ Get config font set @DESC@ Returns one of the two sets of fonts from the configuration as specified @@ -143,7 +143,7 @@ a call to FcFontList when this interval @RET@ FcBool @FUNC@ FcConfigSetRescanInverval @TYPE1@ FcConfig * @ARG1@ config -@TYPE2@ int @ARG2@ rescanInterval +@TYPE2@ int% @ARG2@ rescanInterval @PURPOSE@ Set config rescan interval @DESC@ Sets the rescan interval; returns FcFalse if an error occurred. @@ -181,7 +181,7 @@ Clears the set of application-specific f @TYPE1@ FcConfig * @ARG1@ config @TYPE2@ FcPattern * @ARG2@ p @TYPE3@ FcPattern * @ARG3@ p_pat -@TYPE4@ FcMatchKind @ARG4@ kind +@TYPE4@ FcMatchKind% @ARG4@ kind @PURPOSE@ Execute substitutions @DESC@ Performs the sequence of pattern modification operations, if <parameter>kind</parameter> is @@ -194,7 +194,7 @@ p_pat is used for <test> elements @FUNC@ FcConfigSubstitute @TYPE1@ FcConfig * @ARG1@ config @TYPE2@ FcPattern * @ARG2@ p -@TYPE3@ FcMatchKind @ARG3@ kind +@TYPE3@ FcMatchKind% @ARG3@ kind @PURPOSE@ Execute substitutions @DESC@ Calls FcConfigSubstituteWithPat setting p_pat to NULL. @@ -216,7 +216,7 @@ been called for <parameter>p</parameter> @FUNC@ FcFontSort @TYPE1@ FcConfig * @ARG1@ config @TYPE2@ FcPattern * @ARG2@ p -@TYPE3@ FcBool @ARG3@ trim +@TYPE3@ FcBool% @ARG3@ trim @TYPE4@ FcCharSet ** @ARG4@ csp @TYPE5@ FcResult * @ARG5@ result @PURPOSE@ Return list of matching fonts @@ -282,7 +282,7 @@ FC_CONFIG_DIR environment variable. @FUNC@ FcConfigParseAndLoad @TYPE1@ FcConfig * @ARG1@ config @TYPE2@ const FcChar8 * @ARG2@ file -@TYPE2@ FcBool @ARG3@ complain +@TYPE2@ FcBool% @ARG3@ complain @PURPOSE@ load a configuration file @DESC@ Walks the configuration in ''file'' and constructs the internal representation diff --git a/doc/fcconstant.fncs b/doc/fcconstant.fncs index 9617cba..a09bb39 100644 --- a/doc/fcconstant.fncs +++ b/doc/fcconstant.fncs @@ -24,7 +24,7 @@ @RET@ FcBool @FUNC@ FcNameRegisterConstants @TYPE1@ const FcConstant * @ARG1@ consts -@TYPE2@ int @ARG2@ nconsts +@TYPE2@ int% @ARG2@ nconsts @PURPOSE@ Register symbolic constants @DESC@ Register <parameter>nconsts</parameter> new symbolic constants. @@ -33,7 +33,7 @@ Register <parameter>nconsts</parameter> @RET@ FcBool @FUNC@ FcNameUnregisterConstants @TYPE1@ const FcConstant * @ARG1@ consts -@TYPE2@ int @ARG2@ nconsts +@TYPE2@ int% @ARG2@ nconsts @PURPOSE@ Unregister symbolic constants @DESC@ Unregister <parameter>nconsts</parameter> symbolic constants. diff --git a/doc/fcfile.fncs b/doc/fcfile.fncs index c0ac755..2aa46e1 100644 --- a/doc/fcfile.fncs +++ b/doc/fcfile.fncs @@ -29,7 +29,7 @@ @TYPE3@ FcFileCache * @ARG3@ cache @TYPE4@ FcBlanks * @ARG4@ blanks @TYPE5@ const char * @ARG5@ file -@TYPE6@ FcBool @ARG6@ force +@TYPE6@ FcBool% @ARG6@ force @PURPOSE@ scan a font file @DESC@ Scans a single file and adds all fonts found to <parameter>set</parameter>. @@ -46,7 +46,7 @@ associated information is found in <para @TYPE3@ FcFileCache * @ARG3@ cache @TYPE4@ FcBlanks * @ARG4@ blanks @TYPE5@ const char * @ARG5@ dir -@TYPE6@ FcBool @ARG6@ force +@TYPE6@ FcBool% @ARG6@ force @PURPOSE@ scan a font directory @DESC@ Scans an entire directory and adds all fonts found to diff --git a/doc/fcfreetype.fncs b/doc/fcfreetype.fncs index dadecca..6ecedda 100644 --- a/doc/fcfreetype.fncs +++ b/doc/fcfreetype.fncs @@ -27,8 +27,8 @@ #include <fcfreetype.h> @RET@ FT_UInt @FUNC@ FcFreeTypeCharIndex -@TYPE1@ FT_Face @ARG1@ face -@TYPE2@ FcChar32 @ARG2@ ucs4 +@TYPE1@ FT_Face% @ARG1@ face +@TYPE2@ FcChar32% @ARG2@ ucs4 @PURPOSE@ map Unicode to glyph id @DESC@ Maps a Unicode char to a glyph index. This function uses information from @@ -43,7 +43,7 @@ higher level functions. #include <fcfreetype.h> @RET@ FcCharSet * @FUNC@ FcFreeTypeCharSet -@TYPE1@ FT_Face @ARG1@ face +@TYPE1@ FT_Face% @ARG1@ face @TYPE2@ FcBlanks * @ARG2@ blanks @PURPOSE@ compute unicode coverage @DESC@ @@ -59,7 +59,7 @@ not in ''blanks'' are not placed in the re @RET@ FcPattern * @FUNC@ FcFreeTypeQuery @TYPE1@ const char * @ARG1@ file -@TYPE2@ int @ARG2@ id +@TYPE2@ int% @ARG2@ id @TYPE3@ FcBlanks * @ARG3@ blanks @TYPE4@ int * @ARG4@ count @PURPOSE@ compute pattern from font file (and index) @@ -73,9 +73,9 @@ of fonts in ''file'' is returned in ''count #include <fcfreetype.h> @RET@ FcPattern * @FUNC@ FcFreeTypeQueryFace -@TYPE1@ const FT_Face @ARG1@ face +@TYPE1@ const FT_Face% @ARG1@ face @TYPE2@ const char * @ARG2@ file -@TYPE3@ int @ARG3@ id +@TYPE3@ int% @ARG3@ id @TYPE4@ FcBlanks * @ARG4@ blanks @PURPOSE@ compute pattern from FT_Face @DESC@ diff --git a/doc/fcmatrix.fncs b/doc/fcmatrix.fncs index aae3b8e..2d48b1e 100644 --- a/doc/fcmatrix.fncs +++ b/doc/fcmatrix.fncs @@ -69,9 +69,9 @@ the result in <parameter>result</paramet @PURPOSE@ Rotate a matrix @TYPE1@ FcMatrix * @ARG1@ matrix -@TYPE2@ double +@TYPE2@ double% @ARG2@ cos -@TYPE3@ double +@TYPE3@ double% @ARG3@ sin @DESC@ <function>FcMatrixRotate</function> rotates <parameter>matrix</parameter> @@ -88,9 +88,9 @@ matrix: @PURPOSE@ Scale a matrix @TYPE1@ FcMatrix * @ARG1@ matrix -@TYPE2@ double +@TYPE2@ double% @ARG2@ sx -@TYPE3@ double +@TYPE3@ double% @ARG3@ dy @DESC@ <function>FcMatrixScale</function> multiplies <parameter>matrix</parameter> @@ -107,9 +107,9 @@ the matrix: @PURPOSE@ Shear a matrix @TYPE1@ FcMatrix * @ARG1@ matrix -@TYPE2@ double +@TYPE2@ double% @ARG2@ sh -@TYPE3@ double +@TYPE3@ double% @ARG3@ sv @DESC@ <function>FcMatrixShare</function> shears <parameter>matrix</parameter> diff --git a/doc/fcobjectset.fncs b/doc/fcobjectset.fncs index f1a0c6b..4b0629e 100644 --- a/doc/fcobjectset.fncs +++ b/doc/fcobjectset.fncs @@ -54,7 +54,7 @@ Destroys an object set. @RET+@ FcObjectSet * @FUNC+@ FcObjectSetVaBuild @TYPE1+@ const char * @ARG1+@ first -@TYPE2+@ va_list @ARG2+@ va +@TYPE2+@ va_list% @ARG2+@ va @PURPOSE@ Build object set from args @DESC@ These build an object set from a null-terminated list of property names. diff --git a/doc/fcobjecttype.fncs b/doc/fcobjecttype.fncs index 278b9ee..f472cba 100644 --- a/doc/fcobjecttype.fncs +++ b/doc/fcobjecttype.fncs @@ -24,7 +24,7 @@ @RET@ FcBool @FUNC@ FcNameRegisterObjectTypes @TYPE1@ const FcObjectType * @ARG1@ types -@TYPE2@ int @ARG2@ ntype +@TYPE2@ int% @ARG2@ ntype @PURPOSE@ Register object types @DESC@ Register <parameter>ntype</parameter> new object types. @@ -33,7 +33,7 @@ Register <parameter>ntype</parameter> ne @RET@ FcBool @FUNC@ FcNameUnregisterObjectTypes @TYPE1@ const FcObjectType * @ARG1@ types -@TYPE2@ int @ARG2@ ntype +@TYPE2@ int% @ARG2@ ntype @PURPOSE@ Unregister object types @DESC@ Unregister <parameter>ntype</parameter> object types. diff --git a/doc/fcpattern.fncs b/doc/fcpattern.fncs index b049966..c04d9b3 100644 --- a/doc/fcpattern.fncs +++ b/doc/fcpattern.fncs @@ -70,8 +70,8 @@ equal. @FUNC@ FcPatternAdd @TYPE1@ FcPattern * @ARG1@ p @TYPE2@ const char * @ARG2@ object -@TYPE3@ FcValue @ARG3@ value -@TYPE4@ FcBool @ARG4@ append +@TYPE3@ FcValue% @ARG3@ value +@TYPE4@ FcBool% @ARG4@ append @PURPOSE@ Add a value to a pattern @DESC@ Adds a single value to the list of values associated with the property named @@ -85,8 +85,8 @@ retains no reference to any application- @FUNC@ FcPatternAddWeak @TYPE1@ FcPattern * @ARG1@ p @TYPE2@ const char * @ARG2@ object -@TYPE3@ FcValue @ARG3@ value -@TYPE4@ FcBool @ARG4@ append +@TYPE3@ FcValue% @ARG3@ value +@TYPE4@ FcBool% @ARG4@ append @PURPOSE@ Add a value to a pattern with weak binding @DESC@ FcPatternAddWeak is essentially the same as FcPatternAdd except that any @@ -98,14 +98,14 @@ values added to the list have binding <p @FUNC@ FcPatternAddInteger @TYPE1@ FcPattern * @ARG1@ p @TYPE2@ const char * @ARG2@ object -@TYPE3@ int @ARG3@ i +@TYPE3@ int% @ARG3@ i @PROTOTYPE+@ @RET+@ FcBool @FUNC+@ FcPatternAddDouble @TYPE1+@ FcPattern * @ARG1+@ p @TYPE2+@ const char * @ARG2+@ object -@TYPE3+@ double @ARG3+@ d +@TYPE3+@ double% @ARG3+@ d @PROTOTYPE++@ @RET++@ FcBool @@ -133,7 +133,7 @@ values added to the list have binding <p @FUNC+++++@ FcPatternAddBool @TYPE1+++++@ FcPattern * @ARG1+++++@ p @TYPE2+++++@ const char * @ARG2+++++@ object -@TYPE3+++++@ FcBool @ARG3+++++@ b +@TYPE3+++++@ FcBool% @ARG3+++++@ b @PURPOSE@ Add a typed value to a pattern @DESC@ These are all convenience functions that insert objects of the specified @@ -146,7 +146,7 @@ any existing list of values. @FUNC@ FcPatternGet @TYPE1@ FcPattern * @ARG1@ p @TYPE2@ const char * @ARG2@ object -@TYPE3@ int @ARG3@ id +@TYPE3@ int% @ARG3@ id @TYPE4@ FcValue * @ARG4@ v @PURPOSE@ Return a value from a pattern @DESC@ @@ -162,7 +162,7 @@ within the pattern directly. Applicatio @FUNC@ FcPatternGetInteger @TYPE1@ FcPattern * @ARG1@ p @TYPE2@ const char * @ARG2@ object -@TYPE3@ int @ARG3@ n +@TYPE3@ int% @ARG3@ n @TYPE4@ int * @ARG4@ i @PROTOTYPE+@ @@ -170,7 +170,7 @@ within the pattern directly. Applicatio @FUNC+@ FcPatternGetDouble @TYPE1+@ FcPattern * @ARG1+@ p @TYPE2+@ const char * @ARG2+@ object -@TYPE3+@ int @ARG3+@ n +@TYPE3+@ int% @ARG3+@ n @TYPE4+@ double * @ARG4+@ d @PROTOTYPE++@ @@ -178,7 +178,7 @@ within the pattern directly. Applicatio @FUNC++@ FcPatternGetString @TYPE1++@ FcPattern * @ARG1++@ p @TYPE2++@ const char * @ARG2++@ object -@TYPE3++@ int @ARG3++@ n +@TYPE3++@ int% @ARG3++@ n @TYPE4++@ char **const @ARG4++@ s @PROTOTYPE+++@ @@ -186,7 +186,7 @@ within the pattern directly. Applicatio @FUNC+++@ FcPatternGetMatrix @TYPE1+++@ FcPattern * @ARG1+++@ p @TYPE2+++@ const char * @ARG2+++@ object -@TYPE3+++@ int @ARG3+++@ n +@TYPE3+++@ int% @ARG3+++@ n @TYPE4+++@ FcMatrix ** @ARG4+++@ s @PROTOTYPE++++@ @@ -194,7 +194,7 @@ within the pattern directly. Applicatio @FUNC++++@ FcPatternGetCharSet @TYPE1++++@ FcPattern * @ARG1++++@ p @TYPE2++++@ const char * @ARG2++++@ object -@TYPE3++++@ int @ARG3++++@ n +@TYPE3++++@ int% @ARG3++++@ n @TYPE4++++@ FcCharSet ** @ARG4++++@ c @PROTOTYPE+++++@ @@ -202,7 +202,7 @@ within the pattern directly. Applicatio @FUNC+++++@ FcPatternGetBool @TYPE1+++++@ FcPattern * @ARG1+++++@ p @TYPE2+++++@ const char * @ARG2+++++@ object -@TYPE3+++++@ int @ARG3+++++@ n +@TYPE3+++++@ int% @ARG3+++++@ n @TYPE4+++++@ FcBool * @ARG4+++++@ b @PURPOSE@ Return a typed value from a pattern @DESC@ @@ -222,7 +222,7 @@ in preference to FcPatternGet to provide @RET+@ FcPattern * @FUNC+@ FcPatternVaBuild @TYPE1+@ FcPattern * @ARG1+@ orig -@TYPE2+@ va_list @ARG2+@ va +@TYPE2+@ va_list% @ARG2+@ va @PURPOSE@ Create patterns from arguments @DESC@ Builds a pattern using a list of objects, types and values. Each @@ -267,7 +267,7 @@ whether the property existed or not. @FUNC@ FcPatternRemove @TYPE1@ FcPattern * @ARG1@ p @TYPE2@ const char * @ARG2@ object -@TYPE3@ int @ARG3@ id +@TYPE3@ int% @ARG3@ id @PURPOSE@ Remove one object of the specified type from the pattern @DESC@ Removes the value associated with the property `object'' at position `id'', returning diff --git a/doc/fcstring.fncs b/doc/fcstring.fncs index b3adc43..8aa8b5e 100644 --- a/doc/fcstring.fncs +++ b/doc/fcstring.fncs @@ -27,7 +27,7 @@ @FUNC@ FcUtf8ToUcs4 @TYPE1@ FcChar8 * @ARG1@ src @TYPE2@ FcChar32 * @ARG2@ dst -@TYPE3@ int @ARG3@ len +@TYPE3@ int% @ARG3@ len @PURPOSE@ convert UTF-8 to UCS4 @DESC@ Converts the next Unicode char from <parameter>src</parameter> into @@ -38,8 +38,8 @@ char. <parameter>src</parameter> nust b @RET@ int @FUNC@ FcUcs4ToUtf8 -@TYPE1@ FcChar32 @ARG1@ src -@TYPE2@ FcChar8 @ARG2@ dst[FC_UTF8_MAX_LEN] +@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 @@ -50,7 +50,7 @@ the char. @RET@ FcBool @FUNC@ FcUtf8Len @TYPE1@ FcChar8 * @ARG1@ src -@TYPE2@ int @ARG2@ len +@TYPE2@ int% @ARG2@ len @TYPE3@ int * @ARG3@ nchar @TYPE4@ int * @ARG4@ wchar @PURPOSE@ count UTF-8 encoded chars @@ -66,9 +66,9 @@ well-formed UTF8 string. @RET@ int @FUNC@ FcUtf16ToUcs4 @TYPE1@ FcChar8 * @ARG1@ src -@TYPE2@ FcEndian @ARG2@ endian +@TYPE2@ FcEndian% @ARG2@ endian @TYPE3@ FcChar32 * @ARG3@ dst -@TYPE4@ int @ARG4@ len +@TYPE4@ int% @ARG4@ len @PURPOSE@ convert UTF-16 to UCS4 @DESC@ Converts the next Unicode char from <parameter>src</parameter> into @@ -81,8 +81,8 @@ units according to <parameter>endian</pa @RET@ FcBool @FUNC@ FcUtf16Len @TYPE1@ FcChar8 * @ARG1@ src -@TYPE2@ FcEndian @ARG2@ endian -@TYPE3@ int @ARG3@ len +@TYPE2@ FcEndian% @ARG2@ endian +@TYPE3@ int% @ARG3@ len @TYPE4@ int * @ARG4@ nchar @TYPE5@ int * @ARG5@ wchar @PURPOSE@ count UTF-16 encoded chars diff --git a/doc/fcvalue.fncs b/doc/fcvalue.fncs index 010f07a..88ccaf3 100644 --- a/doc/fcvalue.fncs +++ b/doc/fcvalue.fncs @@ -23,7 +23,7 @@ */ @RET@ void @FUNC@ FcValueDestroy -@TYPE1@ FcValue @ARG1@ v +@TYPE1@ FcValue% @ARG1@ v @PURPOSE@ Free a value @DESC@ Frees any memory referenced by <parameter>v</parameter>. Values of type FcTypeString, @@ -32,7 +32,7 @@ FcTypeMatrix and FcTypeCharSet reference @RET@ FcValue @FUNC@ FcValueSave -@TYPE1@ FcValue @ARG1@ v +@TYPE1@ FcValue% @ARG1@ v @PURPOSE@ Copy a value @DESC@ Returns a copy of <parameter>v</parameter> duplicating any object referenced by it so that <parameter>v</parameter> diff-tree b1aa20098f641a16d02e70a161450e6b85afe410 (from 2cae0512cdf3544ff78b04f6c05a4cb585e50bb8) Author: Peter Breitenlohner <peb@mppmu.mpg.de> Date: Sat Dec 2 14:28:03 2006 -0800 Use <literal> instead of <sgmltag> when documenting fonts.conf. Bug 8935. diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml index a1f6b39..1007782 100644 --- a/doc/fontconfig-user.sgml +++ b/doc/fontconfig-user.sgml @@ -295,22 +295,22 @@ following structure: </para> <refsect2><title><literal><fontconfig></literal></title><para> This is the top level element for a font configuration and can contain -<sgmltag>dir</>, <sgmltag>cache</>, <sgmltag>include</>, <sgmltag>match</> and <sgmltag>alias</> elements in any order. +<literal><dir></literal>, <literal><cache></literal>, <literal><include></literal>, <literal><match></literal> and <literal><alias></literal> elements in any order. </para></refsect2> - <refsect2><title><sgmltag>dir</></title><para> + <refsect2><title><literal><dir></literal></title><para> This element contains a directory name which will be scanned for font files to include in the set of available fonts. </para></refsect2> - <refsect2><title><sgmltag>cache</></title><para> + <refsect2><title><literal><cache></literal></title><para> This element contains a file name for the per-user cache of font information. If it starts with ''~'', it refers to a file in the users home directory. This file is used to hold information about fonts that isn''t present in the per-directory cache files. It is automatically maintained by the fontconfig library. The default for this file -is ``~/.fonts.cache-<sgmltag>version</>'''', where <sgmltag>version</> is the font configuration +is ``~/.fonts.cache-<literal><version></literal>'''', where <literal><version></literal> is the font configuration file version number (currently 2). </para></refsect2> - <refsect2><title><sgmltag>include ignore_missing="no"</></title><para> + <refsect2><title><literal><include ignore_missing="no"></literal></title><para> This element contains the name of an additional configuration file or directory. If a directory, every file within that directory starting with an ASCII digit (U+0030 - U+0039) and ending with the string ``.conf'''' will be processed in sorted order. When @@ -320,42 +320,42 @@ FcConfigLoadAndParse. If ''ignore_missin default "no", a missing file or directory will elicit no warning message from the library. </para></refsect2> - <refsect2><title><sgmltag>config</></title><para> + <refsect2><title><literal><config></literal></title><para> This element provides a place to consolidate additional configuration -information. <sgmltag>config</> can contain <sgmltag>blank</> and <sgmltag>rescan</> elements in any +information. <literal><config></literal> can contain <literal><blank></literal> and <literal><rescan></literal> elements in any order. </para></refsect2> - <refsect2><title><sgmltag>blank</></title><para> + <refsect2><title><literal><blank></literal></title><para> Fonts often include "broken" glyphs which appear in the encoding but are -drawn as blanks on the screen. Within the <sgmltag>blank</> element, place each -Unicode characters which is supposed to be blank in an <sgmltag>int</> element. +drawn as blanks on the screen. Within the <literal><blank></literal> element, place each +Unicode characters which is supposed to be blank in an <literal><int></literal> element. Characters outside of this set which are drawn as blank will be elided from the set of characters supported by the font. </para></refsect2> - <refsect2><title><sgmltag>rescan</></title><para> -The <sgmltag>rescan</> element holds an <sgmltag>int</> element which indicates the default + <refsect2><title><literal><rescan></literal></title><para> +The <literal><rescan></literal> element holds an <literal><int></literal> element which indicates the default interval between automatic checks for font configuration changes. Fontconfig will validate all of the configuration files and directories and automatically rebuild the internal datastructures when this interval passes. </para></refsect2> - <refsect2><title><sgmltag>selectfont</></title><para> + <refsect2><title><literal><selectfont></literal></title><para> This element is used to black/white list fonts from being listed or matched against. It holds acceptfont and rejectfont elements. </para></refsect2> - <refsect2><title><sgmltag>acceptfont</></title><para> + <refsect2><title><literal><acceptfont></literal></title><para> Fonts matched by an acceptfont element are "whitelisted"; such fonts are explicitly included in the set of fonts used to resolve list and match requests; including them in this list protects them from being "blacklisted" by a rejectfont element. Acceptfont elements include glob and pattern elements which are used to match fonts. </para></refsect2> - <refsect2><title><sgmltag>rejectfont</></title><para> + <refsect2><title><literal><rejectfont></literal></title><para> Fonts matched by an rejectfont element are "blacklisted"; such fonts are excluded from the set of fonts used to resolve list and match requests as if they didn''t exist in the system. Rejectfont elements include glob and pattern elements which are used to match fonts. </para></refsect2> - <refsect2><title><sgmltag>glob</></title><para> + <refsect2><title><literal><glob></literal></title><para> Glob elements hold shell-style filename matching patterns (including ? and *) which match fonts based on their complete pathnames. This can be used to exclude a set of directories (/usr/share/fonts/uglyfont*), or particular @@ -363,7 +363,7 @@ font file types (*.pcf.gz), but the latt on filenaming conventions which can''t be relied upon. Note that globs only apply to directories, not to individual fonts. </para></refsect2> - <refsect2><title><sgmltag>pattern</></title><para> + <refsect2><title><literal><pattern></literal></title><para> Pattern elements perform list-style matching on incoming fonts; that is, they hold a list of elements and associated values. If all of those elements have a matching value, then the pattern matches the font. This can @@ -371,22 +371,22 @@ be used to select fonts based on attribu etc), which is a more reliable mechanism than using file extensions. Pattern elements include patelt elements. </para></refsect2> - <refsect2><title><sgmltag>patelt name="property"</></title><para> + <refsect2><title><literal><patelt name="property"></literal></title><para> Patelt elements hold a single pattern element and list of values. They must have a ''name'' attribute which indicates the pattern element name. Patelt elements include int, double, string, matrix, bool, charset and const elements. </para></refsect2> - <refsect2><title><sgmltag>match target="pattern"</></title><para> -This element holds first a (possibly empty) list of <sgmltag>test</> elements and then -a (possibly empty) list of <sgmltag>edit</> elements. Patterns which match all of the + <refsect2><title><literal><match target="pattern"></literal></title><para> +This element holds first a (possibly empty) list of <literal><test></literal> elements and then +a (possibly empty) list of <literal><edit></literal> elements. Patterns which match all of the tests are subjected to all the edits. If ''target'' is set to "font" instead of the default "pattern", then this element applies to the font name resulting from a match rather than a font pattern to be matched. If ''target'' is set to "scan", then this element applies when the font is scanned to build the fontconfig database. </para></refsect2> - <refsect2><title><sgmltag>test qual="any" name="property" target="default" compare="eq"</></title><para> + <refsect2><title><literal><test qual="any" name="property" target="default" compare="eq"></literal></title><para> This element contains a single value which is compared with the target (''pattern'', ''font'', ''scan'' or ''default'') property "property" (substitute any of the property names seen above). ''compare'' can be one of "eq", "not_eq", "less", "less_eq", "more", or @@ -398,11 +398,11 @@ the target= attribute in the <test> the original pattern or the font. "default" selects whichever target the outer <match> element has selected. </para></refsect2> - <refsect2><title><sgmltag>edit name="property" mode="assign" binding="weak"</></title><para> + <refsect2><title><literal><edit name="property" mode="assign" binding="weak"></literal></title><para> This element contains a list of expression elements (any of the value or operator elements). The expression elements are evaluated at run-time and modify the property "property". The modification depends on whether -"property" was matched by one of the associated <sgmltag>test</> elements, if so, the +"property" was matched by one of the associated <literal><test></literal> elements, if so, the modification may affect the first matched value. Any values inserted into the property are given the indicated binding ("strong", "weak" or "same") with "same" binding using the value from the matched pattern element. @@ -418,23 +418,23 @@ with "same" binding using the value from "append_last" Append at end of list Append at end of list </programlisting> </para></refsect2> - <refsect2><title><sgmltag>int</>, <sgmltag>double</>, <sgmltag>string</>, <sgmltag>bool</></title><para> -These elements hold a single value of the indicated type. <sgmltag>bool</> + <refsect2><title><literal><int></literal>, <literal><double></literal>, <literal><string></literal>, <literal><bool></literal></title><para> +These elements hold a single value of the indicated type. <literal><bool></literal> elements hold either true or false. An important limitation exists in the parsing of floating point numbers -- fontconfig requires that the mantissa start with a digit, not a decimal point, so insert a leading zero for purely fractional values (e.g. use 0.5 instead of .5 and -0.5 instead of -.5). </para></refsect2> - <refsect2><title><sgmltag>matrix</></title><para> -This element holds the four <sgmltag>double</> elements of an affine + <refsect2><title><literal><matrix></literal></title><para> +This element holds the four <literal><double></literal> elements of an affine transformation. </para></refsect2> - <refsect2><title><sgmltag>name</></title><para> + <refsect2><title><literal><name></literal></title><para> Holds a property name. Evaluates to the first value from the property of the font, not the pattern. </para></refsect2> - <refsect2><title><sgmltag>const</></title><para> + <refsect2><title><literal><const></literal></title><para> Holds the name of a constant; these are always integers and serve as symbolic names for common font values: <programlisting> @@ -484,40 +484,39 @@ symbolic names for common font values: </para> </refsect2> <refsect2> - <title><sgmltag>or</>, <sgmltag>and</>, <sgmltag>plus</>, <sgmltag>minus</>, <sgmltag>times</>, <sgmltag>divide</></title> + <title><literal><or></literal>, <literal><and></literal>, <literal><plus></literal>, <literal><minus></literal>, <literal><times></literal>, <literal><divide></literal></title> <para> These elements perform the specified operation on a list of expression -elements. <sgmltag>or</> and <sgmltag>and</> are boolean, not bitwise. +elements. <literal><or></literal> and <literal><and></literal> are boolean, not bitwise. </para> </refsect2> <refsect2> - <title><sgmltag>eq</>, <sgmltag>not_eq</>, <sgmltag>less</>, <sgmltag>less_eq</>, <sgmltag>more</>, <sgmltag>more_eq</></title> + <title><literal><eq></literal>, <literal><not_eq></literal>, <literal><less></literal>, <literal><less_eq></literal>, <literal><more></literal>, <literal><more_eq></literal></title> <para> These elements compare two values, producing a boolean result. </para></refsect2> - <refsect2><title><sgmltag>not</></title><para> + <refsect2><title><literal><not></literal></title><para> Inverts the boolean sense of its one expression element </para></refsect2> - <refsect2><title><sgmltag>if</></title><para> + <refsect2><title><literal><if></literal></title><para> This element takes three expression elements; if the value of the first is true, it produces the value of the second, otherwise it produces the value of the third. </para></refsect2> - <refsect2><title><sgmltag>alias</></title><para> + <refsect2><title><literal><alias></literal></title><para> Alias elements provide a shorthand notation for the set of common match operations needed to substitute one font family for another. They contain a -<sgmltag>family</> element followed by optional <sgmltag>prefer</>, <sgmltag>accept</> and <sgmltag>default</> -elements. Fonts matching the <sgmltag>family</> element are edited to prepend the -list of <sgmltag>prefer</>ed families before the matching <sgmltag>family</>, append the -<sgmltag>accept</>able families after the matching <sgmltag>family</> and append the <sgmltag>default</> +<literal><family></literal> element followed by optional <literal><prefer></literal>, <literal><accept></literal> and <literal><default></literal> +elements. Fonts matching the <literal><family></literal> element are edited to prepend the +list of <literal><prefer></literal>ed families before the matching <literal><family></literal>, append the +<literal><accept></literal>able families after the matching <literal><family></literal> and append the <literal><default></literal> families to the end of the family list. </para></refsect2> - <refsect2><title><sgmltag>family</></title><para> + <refsect2><title><literal><family></literal></title><para> Holds a single font family name </para></refsect2> - <refsect2><title><sgmltag>prefer</>, <sgmltag>accept</>, <sgmltag>default</></title><para> -These hold a list of <sgmltag>family</> elements to be used by the <sgmltag>alias</> element. -<sgmltag>/article</> + <refsect2><title><literal><prefer></literal>, <literal><accept></literal>, <literal><default></literal></title><para> +These hold a list of <literal><family></literal> elements to be used by the <literal><alias></literal> element. </para></refsect2> </refsect1> <refsect1><title>EXAMPLE CONFIGURATION FILE</title> diff-tree 2cae0512cdf3544ff78b04f6c05a4cb585e50bb8 (from 0f963b0d3ec417a39f6aa2ba22ba56c2a79d05aa) Author: Peter Breitenlohner <peb@mppmu.mpg.de> Date: Sat Dec 2 14:18:11 2006 -0800 A VPATH build of fontconfig-2.4.1 fails for various reasons. Bug 8933. VPATH builds without doctools breaks as it cannot find the distributed pre-formatted documentation. diff --git a/configure.in b/configure.in index 2029510..ef37acd 100644 --- a/configure.in +++ b/configure.in @@ -510,7 +510,7 @@ default_docs="yes" # Check if docs exist or can be created # if test x$HASDOCBOOK = xno; then - if test -f doc/fonts-conf.5; then + if test -f $srcdir/doc/fonts-conf.5; then : else default_docs="no" diff --git a/doc/Makefile.am b/doc/Makefile.am index 3477eb7..5641dd9 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -142,7 +142,7 @@ fontconfig-devel.txt: local-fontconfig-d fontconfig-devel.pdf: local-fontconfig-devel.sgml $(DOC_FUNCS_SGML) version.sgml confdir.sgml $(RM) $@ - ../missing --run $(DOC2PDF) $< && mv local-$@ $@ \ + $(top_srcdir)/missing --run $(DOC2PDF) $< && mv local-$@ $@ \ || echo Failed to generate $@ >&2; \ (test -f $@ || echo $(DOC2PDF) is required to generate this file >> $@) @@ -160,7 +160,7 @@ fontconfig-user.txt: local-fontconfig-us fontconfig-user.pdf: local-fontconfig-user.sgml version.sgml confdir.sgml $(RM) $@ - ../missing --run $(DOC2PDF) $< && mv local-$@ $@ \ + $(top_srcdir)/missing --run $(DOC2PDF) $< && mv local-$@ $@ \ || echo Failed to generate $@ >&2; \ (test -f $@ || echo $(DOC2PDF) is required to generate this file >> $@) @@ -170,7 +170,14 @@ confdir.sgml: ${DOC_SRC}/confdir.sgml.in CLEANFILES=confdir.sgml local-fontconfig-user.sgml local-fontconfig-devel.sgml +htmldoc_DATA = $(HTML_DIR)/* + +$(HTML_DIR)/*: $(HTML_DIR) + else + +htmldoc_DATA = $(srcdir)/$(HTML_DIR)/* + all-local: clean-local: endif @@ -179,6 +186,3 @@ htmldocdir=$(docdir)/$(HTML_DIR) doc_DATA = $(DOC_FILES) -htmldoc_DATA = $(HTML_DIR)/* - -$(HTML_DIR)/*: $(HTML_DIR) diff-tree 0f963b0d3ec417a39f6aa2ba22ba56c2a79d05aa (from c9c6875014661d4326100bae0464279d76bd657f) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 13:57:45 2006 -0800 Segfault scanning non-font files. Disallow scan edit of user vars. (#8767) Missing NULL font check before attempting to edit scanned pattern. Also, <match target="scan"> rules are now checked to ensure all edited variables are in the predefined set; otherwise, the resulting cache files will not be stable. diff --git a/src/fcdir.c b/src/fcdir.c index d082992..e9e9d19 100644 --- a/src/fcdir.c +++ b/src/fcdir.c @@ -65,7 +65,7 @@ FcFileScanFontConfig (FcFontSet *set, /* * Edit pattern with user-defined rules */ - if (config && !FcConfigSubstituteWithPat (config, font, NULL, FcMatchScan)) + if (font && config && !FcConfigSubstituteWithPat (config, font, NULL, FcMatchScan)) { FcPatternDestroy (font); font = NULL; diff --git a/src/fcint.h b/src/fcint.h index 60563cb..4ab4a74 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -865,6 +865,7 @@ FcListPatternMatchAny (const FcPattern * #define FC_EMBOLDEN_OBJECT 38 #define FC_EMBEDDED_BITMAP_OBJECT 39 #define FC_DECORATIVE_OBJECT 40 +#define FC_MAX_BASE_OBJECT FC_DECORATIVE_OBJECT FcPrivate FcBool FcNameBool (const FcChar8 *v, FcBool *result); diff --git a/src/fcxml.c b/src/fcxml.c index a9453eb..156599c 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -1845,6 +1845,12 @@ FcParseMatch (FcConfigParse *parse) vstack->u.edit->next = edit; edit = vstack->u.edit; vstack->tag = FcVStackNone; + if (kind == FcMatchScan && edit->object > FC_MAX_BASE_OBJECT) + { + FcConfigMessage (parse, FcSevereError, + "<match target=\"scan\"> cannot edit user-defined object \"%s\"", + FcObjectName(edit->object)); + } break; default: FcConfigMessage (parse, FcSevereWarning, "invalid match element"); diff-tree c9c6875014661d4326100bae0464279d76bd657f (from 72ffe6536a6825a32095c8185aff836a12326ac5) Author: Kean Johnston <kean@armory.com> Date: Sat Dec 2 13:36:56 2006 -0800 Don''t use varargs CPP macros in fccache.c. (bug 8733) src/fccache.c uses a trick to try and use a function name that is also a macro name. It does this using the varargs args() macro. Replace that with separate macros for each number of formals. diff --git a/src/fccache.c b/src/fccache.c index ba6af72..3185059 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -826,16 +826,17 @@ FcDirCacheWrite (FcCache *cache, FcConfi * Hokey little macro trick to permit the definitions of C functions * with the same name as CPP macros */ -#define args(x...) (x) +#define args1(x) (x) +#define args2(x,y) (x,y) const FcChar8 * -FcCacheDir args(const FcCache *c) +FcCacheDir args1(const FcCache *c) { return FcCacheDir (c); } FcFontSet * -FcCacheCopySet args(const FcCache *c) +FcCacheCopySet args1(const FcCache *c) { FcFontSet *old = FcCacheSet (c); FcFontSet *new = FcFontSetCreate (); @@ -858,19 +859,19 @@ FcCacheCopySet args(const FcCache *c) } const FcChar8 * -FcCacheSubdir args(const FcCache *c, int i) +FcCacheSubdir args2(const FcCache *c, int i) { return FcCacheSubdir (c, i); } int -FcCacheNumSubdir args(const FcCache *c) +FcCacheNumSubdir args1(const FcCache *c) { return c->dirs_count; } int -FcCacheNumFont args(const FcCache *c) +FcCacheNumFont args1(const FcCache *c) { return FcCacheSet(c)->nfont; } diff-tree 72ffe6536a6825a32095c8185aff836a12326ac5 (from 5e234d9e764d8c52d93b918a5c92b7956c95882b) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 13:22:27 2006 -0800 Add FcFreeTypeQueryFace external API. Bug #7311. Expose ability to build an FcPattern directly from an FT_Face object. diff --git a/configure.in b/configure.in index 98604c3..2029510 100644 --- a/configure.in +++ b/configure.in @@ -41,11 +41,11 @@ dnl libtool versioning dnl bump revision when fixing bugs dnl bump current and age, reset revision to zero when adding APIs dnl bump current, leave age, reset revision to zero when changing/removing APIS -LT_CURRENT=2 +LT_CURRENT=3 LT_REVISION=0 AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) -LT_AGE=1 +LT_AGE=2 LT_VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE" AC_SUBST(LT_VERSION_INFO) diff --git a/doc/fcfreetype.fncs b/doc/fcfreetype.fncs index b226561..dadecca 100644 --- a/doc/fcfreetype.fncs +++ b/doc/fcfreetype.fncs @@ -62,8 +62,23 @@ not in ''blanks'' are not placed in the re @TYPE2@ int @ARG2@ id @TYPE3@ FcBlanks * @ARG3@ blanks @TYPE4@ int * @ARG4@ count -@PURPOSE@ compute font file pattern +@PURPOSE@ compute pattern from font file (and index) @DESC@ Constructs a pattern representing the ''id''th font in ''file''. The number of fonts in ''file'' is returned in ''count''. @@ + +@SYNOPSIS@ +#include <fontconfig.h> +#include <fcfreetype.h> +@RET@ FcPattern * +@FUNC@ FcFreeTypeQueryFace +@TYPE1@ const FT_Face @ARG1@ face +@TYPE2@ const char * @ARG2@ file +@TYPE3@ int @ARG3@ id +@TYPE4@ FcBlanks * @ARG4@ blanks +@PURPOSE@ compute pattern from FT_Face +@DESC@ +Constructs a pattern representing ''face''. ''file'' and ''id'' are used solely as +data for pattern elements (FC_FILE, FC_INDEX and sometimes FC_FAMILY). +@@ diff --git a/fontconfig/fcfreetype.h b/fontconfig/fcfreetype.h index 0c2a81c..e9be351 100644 --- a/fontconfig/fcfreetype.h +++ b/fontconfig/fcfreetype.h @@ -48,6 +48,12 @@ FcPatternGetFTFace (const FcPattern *p, FcPublic FcBool FcPatternAddFTFace (FcPattern *p, const char *object, const FT_Face f); +FcPublic FcPattern * +FcFreeTypeQueryFace (const FT_Face face, + const FcChar8 *file, + int id, + FcBlanks *blanks); + _FCFUNCPROTOEND #endif diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 8ca14d7..e2bcb15 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1063,12 +1063,11 @@ static const FT_UShort nameid_order[] = #define NUM_NAMEID_ORDER (sizeof (nameid_order) / sizeof (nameid_order[0])) FcPattern * -FcFreeTypeQuery (const FcChar8 *file, - int id, - FcBlanks *blanks, - int *count) +FcFreeTypeQueryFace (const FT_Face face, + const FcChar8 *file, + int id, + FcBlanks *blanks) { - FT_Face face; FcPattern *pat; int slant = -1; int weight = -1; @@ -1077,7 +1076,6 @@ FcFreeTypeQuery (const FcChar8 *file, int i; FcCharSet *cs; FcLangSet *ls; - FT_Library ftLibrary; #if 0 FcChar8 *family = 0; #endif @@ -1108,14 +1106,6 @@ FcFreeTypeQuery (const FcChar8 *file, FcChar8 *style = 0; int st; - if (FT_Init_FreeType (&ftLibrary)) - return 0; - - if (FT_New_Face (ftLibrary, (char *) file, id, &face)) - goto bail; - - *count = face->num_faces; - pat = FcPatternCreate (); if (!pat) goto bail0; @@ -1785,12 +1775,6 @@ FcFreeTypeQuery (const FcChar8 *file, */ FcCharSetDestroy (cs); - /* - * Deallocate family/style values - */ - - FT_Done_Face (face); - FT_Done_FreeType (ftLibrary); return pat; bail2: @@ -1798,13 +1782,35 @@ bail2: bail1: FcPatternDestroy (pat); bail0: + return NULL; +} + +FcPattern * +FcFreeTypeQuery(const FcChar8 *file, + int id, + FcBlanks *blanks, + int *count) +{ + FT_Face face; + FT_Library ftLibrary; + FcPattern *pat = NULL; + + if (FT_Init_FreeType (&ftLibrary)) + return NULL; + + if (FT_New_Face (ftLibrary, (char *) file, id, &face)) + goto bail; + + *count = face->num_faces; + + pat = FcFreeTypeQueryFace (face, file, id, blanks); + FT_Done_Face (face); bail: FT_Done_FreeType (ftLibrary); - return 0; + return pat; } - /* * For our purposes, this approximation is sufficient */ diff-tree 5e234d9e764d8c52d93b918a5c92b7956c95882b (from 2b77216ee21de95ec352672aa025195a83925b32) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 13:14:23 2006 -0800 Fix grep pattern in makealias to work on non-Gnu grep (bug 8368). grep -l -w ''^foo'' doesn''t work on Solaris. Replace with grep -l ''^foo\>'' instead which does. Also, grep -l will report the filename more than once (!), so add | head -1 to pick just the first one. diff --git a/src/makealias b/src/makealias index 02167b2..ef4d3c2 100755 --- a/src/makealias +++ b/src/makealias @@ -15,7 +15,7 @@ while read name; do hattr=''__attribute((visibility("hidden")))'' echo "extern __typeof ($name) $alias $hattr;" >> $HEAD echo "#define $name $alias" >> $HEAD - grep -l -w ''^''$name "$SRCDIR"/*.c | sed -e ''s/^.*\/\([^.]*\)\.c/#ifdef __\1__/'' >> $TAIL + grep -l ''^''$name''\>'' "$SRCDIR"/*.c | head -1 | sed -e ''s/^.*\/\([^.]*\)\.c/#ifdef __\1__/'' >> $TAIL echo "#undef $name" >> $TAIL cattr=''__attribute((alias("''$alias''"), visibility("default")))'' echo "extern __typeof ($name) $name $cattr;" >> $TAIL diff-tree 2b77216ee21de95ec352672aa025195a83925b32 (from 64d7e303df441f274ee194a401dcd14dfb58af7e) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 13:04:05 2006 -0800 Avoid writing uninitialized structure pad bytes to cache files. The union inside the FcValue structure contains pad bytes. Instead of copying the whole structure to the cache block, copy only the initialized fields to avoid writing whichever bytes serve as padding within the structure. diff --git a/src/fcpat.c b/src/fcpat.c index bf34c2e..052874f 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -1174,8 +1174,14 @@ FcValueListSerialize (FcSerialize *seria head_serialized = vl_serialized; vl_serialized->next = NULL; - vl_serialized->value = vl->value; + vl_serialized->value.type = vl->value.type; switch (vl->value.type) { + case FcTypeInteger: + vl_serialized->value.u.i = vl->value.u.i; + break; + case FcTypeDouble: + vl_serialized->value.u.d = vl->value.u.d; + break; case FcTypeString: s_serialized = FcStrSerialize (serialize, vl->value.u.s); if (!s_serialized) @@ -1184,6 +1190,12 @@ FcValueListSerialize (FcSerialize *seria s_serialized, FcChar8); break; + case FcTypeBool: + vl_serialized->value.u.b = vl->value.u.b; + break; + case FcTypeMatrix: + /* can''t happen */ + break; case FcTypeCharSet: c_serialized = FcCharSetSerialize (serialize, vl->value.u.c); if (!c_serialized) @@ -1192,6 +1204,9 @@ FcValueListSerialize (FcSerialize *seria c_serialized, FcCharSet); break; + case FcTypeFTFace: + /* can''t happen */ + break; case FcTypeLangSet: l_serialized = FcLangSetSerialize (serialize, vl->value.u.l); if (!l_serialized) diff-tree 64d7e303df441f274ee194a401dcd14dfb58af7e (from 253ec7609c13b46c717c801206ebb1a6c7f06e27) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 12:14:49 2006 -0800 Warn (and recover) from config file without <cachedir> elements. When updating from older fontconfig versions, if the config file is not replaced, it will not contain <cachedir> elements. Lacking these, fontconfig has no place to store cached font information and cannot operate reasonably. Add code to check and see if the loaded configuration has no cache directories, and if so, warn the user and add both the default system cache directory and the normal per-user cache directory. diff --git a/src/fcinit.c b/src/fcinit.c index 7d2311f..693e0b7 100644 --- a/src/fcinit.c +++ b/src/fcinit.c @@ -69,6 +69,25 @@ FcInitLoadConfig (void) FcConfigDestroy (config); return FcInitFallbackConfig (); } + + if (config->cacheDirs && config->cacheDirs->num == 0) + { + fprintf (stderr, + "Fontconfig warning: no <cachedir> elements found. Check configuration.\n"); + fprintf (stderr, + "Fontconfig warning: adding <cachedir>%s</cachedir>\n", + FC_CACHEDIR); + fprintf (stderr, + "Fontconfig warning: adding <cachedir>~/.fontconfig</cachedir>\n"); + if (!FcConfigAddCacheDir (config, (FcChar8 *) FC_CACHEDIR) || + !FcConfigAddCacheDir (config, (FcChar8 *) "~/.fontconfig")) + { + fprintf (stderr, + "Fontconfig error: out of memory"); + FcConfigDestroy (config); + return FcInitFallbackConfig (); + } + } return config; } diff-tree 253ec7609c13b46c717c801206ebb1a6c7f06e27 (from b5803016d74856eb44b05876f0d7178bfec0df47) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 11:47:07 2006 -0800 Use explicit platform/nameid order when scanning ttf files. Instead of accepting whatever order names appear in the font file, use an explicit ordering for both platform and nameid. Platforms are high precedence than nameids. The platform order is: microsoft, apple unicode, macintosh, (other) The family nameid order is: preferred family, font family The fullname nameid order is: mac full name, full name The style nameid order is preferred subfamily, font subfamily This will change the names visible to users in various application UIs, but should not change how existing font names are matched as all names remain present in the resulting database. The hope is that family names will, in general, be less ambiguous. Testing here shows that commercial fonts have longer names now while DejaVu has a shorter family name, and moves more of the font description to the style name. diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 83c58d6..8ca14d7 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1043,6 +1043,25 @@ FcStringInPatternElement (FcPattern *pat return FcFalse; } +static const FT_UShort platform_order[] = { + TT_PLATFORM_MICROSOFT, + TT_PLATFORM_APPLE_UNICODE, + TT_PLATFORM_MACINTOSH, +}; +#define NUM_PLATFORM_ORDER (sizeof (platform_order) / sizeof (platform_order[0])) + +static const FT_UShort nameid_order[] = { + TT_NAME_ID_PREFERRED_FAMILY, + TT_NAME_ID_FONT_FAMILY, + TT_NAME_ID_MAC_FULL_NAME, + TT_NAME_ID_FULL_NAME, + TT_NAME_ID_PREFERRED_SUBFAMILY, + TT_NAME_ID_FONT_SUBFAMILY, + TT_NAME_ID_TRADEMARK, + TT_NAME_ID_MANUFACTURER, +}; + +#define NUM_NAMEID_ORDER (sizeof (nameid_order) / sizeof (nameid_order[0])) FcPattern * FcFreeTypeQuery (const FcChar8 *file, int id, @@ -1083,6 +1102,8 @@ FcFreeTypeQuery (const FcChar8 *file, int nstyle_lang = 0; int nfullname = 0; int nfullname_lang = 0; + int p, platform; + int n, nameid; FcChar8 *style = 0; int st; @@ -1132,105 +1153,145 @@ FcFreeTypeQuery (const FcChar8 *file, * of them */ snamec = FT_Get_Sfnt_Name_Count (face); - for (snamei = 0; snamei < snamec; snamei++) + for (p = 0; p <= NUM_PLATFORM_ORDER; p++) { - FcChar8 *utf8; - const FcChar8 *lang; - const char *elt = 0, *eltlang = 0; - int *np = 0, *nlangp = 0; - - if (FT_Get_Sfnt_Name (face, snamei, &sname) != 0) - continue; - - utf8 = FcSfntNameTranscode (&sname); - lang = FcSfntNameLanguage (&sname); + if (p < NUM_PLATFORM_ORDER) + platform = platform_order[p]; + else + platform = 0xffff; - if (!utf8) - continue; - - switch (sname.name_id) { - case TT_NAME_ID_FONT_FAMILY: -#if 0 - case TT_NAME_ID_PS_NAME: - case TT_NAME_ID_UNIQUE_ID: -#endif - if (FcDebug () & FC_DBG_SCANV) - printf ("found family (n %2d p %d e %d l 0x%04x) %s\n", - sname.name_id, sname.platform_id, - sname.encoding_id, sname.language_id, - utf8); - - elt = FC_FAMILY; - eltlang = FC_FAMILYLANG; - np = &nfamily; - nlangp = &nfamily_lang; - break; - case TT_NAME_ID_FULL_NAME: - case TT_NAME_ID_MAC_FULL_NAME: - if (FcDebug () & FC_DBG_SCANV) - printf ("found full (n %2d p %d e %d l 0x%04x) %s\n", - sname.name_id, sname.platform_id, - sname.encoding_id, sname.language_id, - utf8); - - elt = FC_FULLNAME; - eltlang = FC_FULLNAMELANG; - np = &nfullname; - nlangp = &nfullname_lang; - break; - case TT_NAME_ID_FONT_SUBFAMILY: - if (FcDebug () & FC_DBG_SCANV) - printf ("found style (n %2d p %d e %d l 0x%04x) %s\n", - sname.name_id, sname.platform_id, - sname.encoding_id, sname.language_id, - utf8); - - elt = FC_STYLE; - eltlang = FC_STYLELANG; - np = &nstyle; - nlangp = &nstyle_lang; - break; - case TT_NAME_ID_TRADEMARK: - case TT_NAME_ID_MANUFACTURER: - /* If the foundry wasn''t found in the OS/2 table, look here */ - if(!foundry) - foundry = FcNoticeFoundry((FT_String *) utf8); - break; - } - if (elt) + /* + * Order nameids so preferred names appear first + * in the resulting list + */ + for (n = 0; n < NUM_NAMEID_ORDER; n++) { - if (FcStringInPatternElement (pat, elt, utf8)) - { - free (utf8); - continue; - } + nameid = nameid_order[n]; - /* add new element */ - if (!FcPatternAddString (pat, elt, utf8)) - { - free (utf8); - goto bail1; - } - free (utf8); - if (lang) + for (snamei = 0; snamei < snamec; snamei++) { - /* pad lang list with ''xx'' to line up with elt */ - while (*nlangp < *np) + FcChar8 *utf8; + const FcChar8 *lang; + const char *elt = 0, *eltlang = 0; + int *np = 0, *nlangp = 0; + + if (FT_Get_Sfnt_Name (face, snamei, &sname) != 0) + continue; + if (sname.name_id != nameid) + continue; + + /* + * Sort platforms in preference order, accepting + * all other platforms last + */ + if (p < NUM_PLATFORM_ORDER) + { + if (sname.platform_id != platform) + continue; + } + else { - if (!FcPatternAddString (pat, eltlang, (FcChar8 *) "xx")) + int sp; + + for (sp = 0; sp < NUM_PLATFORM_ORDER; sp++) + if (sname.platform_id == platform_order[sp]) + break; + if (sp != NUM_PLATFORM_ORDER) + continue; + } + utf8 = FcSfntNameTranscode (&sname); + lang = FcSfntNameLanguage (&sname); + + if (!utf8) + continue; + + switch (sname.name_id) { + case TT_NAME_ID_PREFERRED_FAMILY: + case TT_NAME_ID_FONT_FAMILY: +#if 0 + case TT_NAME_ID_PS_NAME: + case TT_NAME_ID_UNIQUE_ID: +#endif + if (FcDebug () & FC_DBG_SCANV) + printf ("found family (n %2d p %d e %d l 0x%04x) %s\n", + sname.name_id, sname.platform_id, + sname.encoding_id, sname.language_id, + utf8); + + elt = FC_FAMILY; + eltlang = FC_FAMILYLANG; + np = &nfamily; + nlangp = &nfamily_lang; + break; + case TT_NAME_ID_MAC_FULL_NAME: + case TT_NAME_ID_FULL_NAME: + if (FcDebug () & FC_DBG_SCANV) + printf ("found full (n %2d p %d e %d l 0x%04x) %s\n", + sname.name_id, sname.platform_id, + sname.encoding_id, sname.language_id, + utf8); + + elt = FC_FULLNAME; + eltlang = FC_FULLNAMELANG; + np = &nfullname; + nlangp = &nfullname_lang; + break; + case TT_NAME_ID_PREFERRED_SUBFAMILY: + case TT_NAME_ID_FONT_SUBFAMILY: + if (FcDebug () & FC_DBG_SCANV) + printf ("found style (n %2d p %d e %d l 0x%04x) %s\n", + sname.name_id, sname.platform_id, + sname.encoding_id, sname.language_id, + utf8); + + elt = FC_STYLE; + eltlang = FC_STYLELANG; + np = &nstyle; + nlangp = &nstyle_lang; + break; + case TT_NAME_ID_TRADEMARK: + case TT_NAME_ID_MANUFACTURER: + /* If the foundry wasn''t found in the OS/2 table, look here */ + if(!foundry) + foundry = FcNoticeFoundry((FT_String *) utf8); + break; + } + if (elt) + { + if (FcStringInPatternElement (pat, elt, utf8)) + { + free (utf8); + continue; + } + + /* add new element */ + if (!FcPatternAddString (pat, elt, utf8)) + { + free (utf8); goto bail1; - ++*nlangp; + } + free (utf8); + if (lang) + { + /* pad lang list with ''xx'' to line up with elt */ + while (*nlangp < *np) + { + if (!FcPatternAddString (pat, eltlang, (FcChar8 *) "xx")) + goto bail1; + ++*nlangp; + } + if (!FcPatternAddString (pat, eltlang, lang)) + goto bail1; + ++*nlangp; + } + ++*np; } - if (!FcPatternAddString (pat, eltlang, lang)) - goto bail1; - ++*nlangp; + else + free (utf8); } - ++*np; } - else - free (utf8); } - + if (!nfamily && face->family_name && FcStrCmpIgnoreBlanksAndCase ((FcChar8 *) face->family_name, (FcChar8 *) "") != 0) { diff-tree b5803016d74856eb44b05876f0d7178bfec0df47 (from bae5db78ddab473695a7efee374a75d6fe02426f) Author: Keith Packard <keithp@neko.keithp.com> Date: Sun Nov 12 17:15:55 2006 -0800 FcStrCanonAbsoluteFilename should be static. diff --git a/src/fcstr.c b/src/fcstr.c index 368761d..eaae935 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -833,7 +833,7 @@ FcStrBasename (const FcChar8 *file) return FcStrCopy (slash + 1); } -FcChar8 * +static FcChar8 * FcStrCanonAbsoluteFilename (const FcChar8 *s) { FcChar8 *file; diff-tree bae5db78ddab473695a7efee374a75d6fe02426f (from 0334e5a294dd6a36c94936f6c9c709e86773cf64) Author: Keith Packard <keithp@neko.keithp.com> Date: Sun Nov 12 17:15:24 2006 -0800 Add sparc64 architecture string. diff --git a/fc-arch/fcarch.tmpl.h b/fc-arch/fcarch.tmpl.h index c7c4567..0843a64 100644 --- a/fc-arch/fcarch.tmpl.h +++ b/fc-arch/fcarch.tmpl.h @@ -35,3 +35,4 @@ ppc 12345678_00000001_00000004_00000 ppc64 12345678_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000030 m68k 12345678_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_0000001c mipsel 78563412_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_0000001c +sparc64 12345678_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000030