Keith Packard
2007-Mar-12 10:33 UTC
[Fontconfig] fontconfig: Branch ''master'' - 4 commits
INSTALL | 2 +- README | 36 ++++++++++++++++++++++++++++++++++-- configure.in | 2 +- fc-glyphname/fc-glyphname.c | 2 +- fontconfig/fontconfig.h | 2 +- src/fcfreetype.c | 21 +++++++++++++++++---- src/fcpat.c | 10 +++++++--- 7 files changed, 62 insertions(+), 13 deletions(-) New commits: diff-tree c80a08d6bf08a27ede95035f3f02cd5abfa2cafd (from fa741cd4fffbbaa5d4ba9a15f53550ac7817cc92) Author: Keith Packard <keithp@neko.keithp.com> Date: Mon Mar 12 10:32:23 2007 -0700 Work around FreeType bug when glyph name buffer is too small. Recent versions of FreeType do not correctly deal with glyph name buffers that are too small; work around this by declaring a buffer that can hold any PS name (127 bytes). diff --git a/src/fcfreetype.c b/src/fcfreetype.c index e2bcb15..c79ab3b 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -2413,6 +2413,19 @@ FcGlyphNameToUcs4 (FcChar8 *name) } /* + * Work around a bug in some FreeType versions which fail + * to correctly bounds check glyph name buffers and overwrite + * the stack. As Postscript names have a limit of 127 characters, + * this should be sufficient. + */ + +#if FC_GLYPHNAME_MAXLEN < 127 +# define FC_GLYPHNAME_BUFLEN 127 +#else +# define FC_GLYPHNAME_BUFLEN FC_GLYPHNAME_MAXLEN +#endif + +/* * Search through a font for a glyph by name. This is * currently a linear search as there doesn''t appear to be * any defined order within the font @@ -2421,11 +2434,11 @@ static FT_UInt FcFreeTypeGlyphNameIndex (FT_Face face, const FcChar8 *name) { FT_UInt gindex; - FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2]; + FcChar8 name_buf[FC_GLYPHNAME_BUFLEN + 2]; for (gindex = 0; gindex < (FT_UInt) face->num_glyphs; gindex++) { - if (FT_Get_Glyph_Name (face, gindex, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0) + if (FT_Get_Glyph_Name (face, gindex, name_buf, FC_GLYPHNAME_BUFLEN+1) == 0) if (!strcmp ((char *) name, (char *) name_buf)) return gindex; } @@ -2715,11 +2728,11 @@ FcFreeTypeCharSetAndSpacing (FT_Face fac */ if (FcFreeTypeUseNames (face)) { - FcChar8 name_buf[FC_GLYPHNAME_MAXLEN + 2]; + FcChar8 name_buf[FC_GLYPHNAME_BUFLEN + 2]; for (glyph = 0; glyph < (FT_UInt) face->num_glyphs; glyph++) { - if (FT_Get_Glyph_Name (face, glyph, name_buf, FC_GLYPHNAME_MAXLEN+1) == 0) + if (FT_Get_Glyph_Name (face, glyph, name_buf, FC_GLYPHNAME_BUFLEN+1) == 0) { ucs4 = FcGlyphNameToUcs4 (name_buf); if (ucs4 != 0xffff && diff-tree fa741cd4fffbbaa5d4ba9a15f53550ac7817cc92 (from 9b74b78fe87f75f7026bfb23ab43ef347e109ca6) Author: Keith Packard <keithp@neko.keithp.com> Date: Mon Mar 12 10:30:51 2007 -0700 rehash increment could be zero, causing rehash infinite loop. Bump the rehash value by one so that it is always positive. diff --git a/fc-glyphname/fc-glyphname.c b/fc-glyphname/fc-glyphname.c index faaa63b..d4d0b99 100644 --- a/fc-glyphname/fc-glyphname.c +++ b/fc-glyphname/fc-glyphname.c @@ -206,7 +206,7 @@ insert (FcGlyphName *gn, FcGlyphName **t i = (int) (h % hash); while (table[i]) { - if (!r) r = (int) (h % rehash); + if (!r) r = (int) (h % rehash + 1); i += r; if (i >= hash) i -= hash; diff-tree 9b74b78fe87f75f7026bfb23ab43ef347e109ca6 (from 2373f904265a05761039cfc5fe305bf588e831c5) Author: Stephan Kulow <coolo@novell.com> Date: Mon Mar 12 10:21:35 2007 -0700 Make FcPatternDuplicate copy the binding instead of always using Strong. I noticed that Qt always uses a different font than fc-match advertises. Debugging the issue, I found that a call that looks pretty innocent is changing all weak bindings to strong bindings and as such changes the semantic of the match: FcPatternDuplicate. diff --git a/src/fcpat.c b/src/fcpat.c index 052874f..4179694 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -925,10 +925,14 @@ FcPatternDuplicate (const FcPattern *ori for (i = 0; i < orig->num; i++) { for (l = FcPatternEltValues(e + i); l; l = FcValueListNext(l)) - if (!FcPatternObjectAdd (new, e[i].object, - FcValueCanonicalize(&l->value), - FcTrue)) + { + if (!FcPatternObjectAddWithBinding (new, e[i].object, + FcValueCanonicalize(&l->value), + l->binding, + FcTrue)) goto bail1; + + } } return new; diff-tree 2373f904265a05761039cfc5fe305bf588e831c5 (from e3b65ee06808cda296215b88111a259a200cc37c) Author: Keith Packard <keithp@neko.keithp.com> Date: Sat Dec 2 16:09:47 2006 -0800 Update for version 2.4.2 diff --git a/INSTALL b/INSTALL index 1c8d3e3..4ea9080 100644 --- a/INSTALL +++ b/INSTALL @@ -19,7 +19,7 @@ important steps: Set the date Append the short log - git-log --pretty=short 2.4.xx | git-shortlog + git-log --pretty=short 2.4.xx.. | git-shortlog 3. Commit those changes diff --git a/README b/README index 2c2fe0a..6bc94f2 100644 --- a/README +++ b/README @@ -1,12 +1,44 @@ Fontconfig Font configuration and customization library - Version 2.4.1 - 2006-09-15 + Version 2.4.2 + 2006-12-02 Check INSTALL for compilation and installation instructions. Report bugs to https://bugs.freedesktop.org in the fontconfig module. +2.4.2 + +Han-Wen Nienhuys: + FcStrCanonFileName buggy for mingw. (bug 8311) + More fixes for Win32 building (bug 8311) + +Kean Johnston: + Don''t use varargs CPP macros in fccache.c. (bug 8733) + +Keith Packard: + Remove documentation for non-existant FcConfigNormalizeFontDir. + Build fontconfig.def from header files when needed. + Detect and use available random number generator (bug 8308) + Add sparc64 architecture string. + FcStrCanonAbsoluteFilename should be static. + Use explicit platform/nameid order when scanning ttf files. + Warn (and recover) from config file without <cachedir> elements. + Avoid writing uninitialized structure pad bytes to cache files. + Fix grep pattern in makealias to work on non-Gnu grep (bug 8368). + Add FcFreeTypeQueryFace external API. Bug #7311. + Segfault scanning non-font files. Disallow scan edit of user vars. (#8767) + Add space between type and formal in devel man pages (bug 8935) + +Mike FABIAN: + Do not clean cache files for different architectures + +Peter Breitenlohner: + A VPATH build of fontconfig-2.4.1 fails for various reasons. Bug 8933. + Use <literal> instead of <sgmltag> when documenting fonts.conf. Bug 8935. + Fix fc-cat documentation (bug 8935). + + 2.4.1 Keith Packard: diff --git a/configure.in b/configure.in index ef37acd..5e3392f 100644 --- a/configure.in +++ b/configure.in @@ -33,7 +33,7 @@ dnl This is the package version number, dnl version. This same version number must appear in fontconfig/fontconfig.h dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it''s dnl not possible to extract the version number here from fontconfig.h -AM_INIT_AUTOMAKE(fontconfig, 2.4.1) +AM_INIT_AUTOMAKE(fontconfig, 2.4.2) AM_MAINTAINER_MODE dnl libtool versioning diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index 26412a3..f055cdb 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -53,7 +53,7 @@ typedef int FcBool; #define FC_MAJOR 2 #define FC_MINOR 4 -#define FC_REVISION 1 +#define FC_REVISION 2 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION))