diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-01-01 12:40:09 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-01-01 12:40:09 +0000 |
commit | 8c8648bd9ce46b8c6ab914f18e31c08268c12917 (patch) | |
tree | 2a1a31a006b161cfbd2aa1da88b0822124c10f00 | |
parent | 6d232ad8a76024f04e6151fb42df4dd83beccff0 (diff) |
Update to fonttosfnt 1.2.1
-rw-r--r-- | app/fonttosfnt/ChangeLog | 53 | ||||
-rw-r--r-- | app/fonttosfnt/Makefile.in | 4 | ||||
-rw-r--r-- | app/fonttosfnt/configure | 20 | ||||
-rw-r--r-- | app/fonttosfnt/configure.ac | 4 | ||||
-rw-r--r-- | app/fonttosfnt/fonttosfnt.h | 1 | ||||
-rw-r--r-- | app/fonttosfnt/read.c | 48 | ||||
-rw-r--r-- | app/fonttosfnt/util.c | 18 | ||||
-rw-r--r-- | app/fonttosfnt/write.c | 5 |
8 files changed, 113 insertions, 40 deletions
diff --git a/app/fonttosfnt/ChangeLog b/app/fonttosfnt/ChangeLog index a5418df4f..87e019481 100644 --- a/app/fonttosfnt/ChangeLog +++ b/app/fonttosfnt/ChangeLog @@ -1,3 +1,56 @@ +commit 33f944705c6c42e1b52f6ec62131d31f737c638f +Author: Peter Hutterer <peter.hutterer@who-t.net> +Date: Wed Dec 16 15:14:11 2020 +1000 + + Bump to 1.2.1 + +commit 2d30328f9c5390eb38d4052028cd00bafaa151d4 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Oct 31 21:01:02 2020 -0700 + + writeFile: avoid file leak on errors + + Resolves issues found by Oracle Parfait 4.0 static analyser: + + File Leak [file-ptr-leak]: + Leaked File out + at line 337 of app/fonttosfnt/write.c in function 'writeFile'. + out initialized at line 330 with fopen + File Leak [file-ptr-leak]: + Leaked File out + at line 366 of app/fonttosfnt/write.c in function 'writeFile'. + out initialized at line 330 with fopen + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 899eadee6750ea39ddb6b874529c29c011599bb2 +Author: Christopher Zimmermann <madroach@gmerlin.de> +Date: Sat Oct 24 11:41:32 2020 +0200 + + Fall back to using FONT property as family name + +commit 5f2307d883de6ddf55f499f1690840747b1a3ad9 +Author: Christopher Zimmermann <madroach@gmerlin.de> +Date: Sat Oct 24 09:53:32 2020 +0200 + + fix sign of calculated descent + + I discovered this bug when converting the Tamsyn font from pcf to otb. + +commit 4d418c1602c8b939d3e5e479c44985a505ecad83 +Author: Christopher Zimmermann <madroach@gmerlin.de> +Date: Fri Oct 23 21:35:24 2020 +0200 + + handle empty foundry encoded as NULL + + to fix a segfault + +commit 5727003b1df9071a2bc9a42bc0b25d7c03c8de09 +Author: Christopher Zimmermann <madroach@gmerlin.de> +Date: Fri Oct 23 21:00:06 2020 +0200 + + remove leftover debug printf + commit 91af80a0aa18c969cd90668eed80bcbfc1e40661 Author: Peter Hutterer <peter.hutterer@who-t.net> Date: Wed Oct 21 16:36:30 2020 +1000 diff --git a/app/fonttosfnt/Makefile.in b/app/fonttosfnt/Makefile.in index cec4b1723..efa5b13dc 100644 --- a/app/fonttosfnt/Makefile.in +++ b/app/fonttosfnt/Makefile.in @@ -77,8 +77,8 @@ bin_PROGRAMS = fonttosfnt$(EXEEXT) subdir = . DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ - compile config.guess config.sub depcomp install-sh missing + $(top_srcdir)/configure COPYING ChangeLog INSTALL NEWS compile \ + config.guess config.sub depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ diff --git a/app/fonttosfnt/configure b/app/fonttosfnt/configure index 7df68d33c..1b8aed3ee 100644 --- a/app/fonttosfnt/configure +++ b/app/fonttosfnt/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for fonttosfnt 1.2.0. +# Generated by GNU Autoconf 2.69 for fonttosfnt 1.2.1. # # Report bugs to <https://gitlab.freedesktop.org/xorg/app/fonttosfnt/issues>. # @@ -581,8 +581,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='fonttosfnt' PACKAGE_TARNAME='fonttosfnt' -PACKAGE_VERSION='1.2.0' -PACKAGE_STRING='fonttosfnt 1.2.0' +PACKAGE_VERSION='1.2.1' +PACKAGE_STRING='fonttosfnt 1.2.1' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/fonttosfnt/issues' PACKAGE_URL='' @@ -1324,7 +1324,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures fonttosfnt 1.2.0 to adapt to many kinds of systems. +\`configure' configures fonttosfnt 1.2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1395,7 +1395,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of fonttosfnt 1.2.0:";; + short | recursive ) echo "Configuration of fonttosfnt 1.2.1:";; esac cat <<\_ACEOF @@ -1504,7 +1504,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -fonttosfnt configure 1.2.0 +fonttosfnt configure 1.2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1828,7 +1828,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by fonttosfnt $as_me 1.2.0, which was +It was created by fonttosfnt $as_me 1.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2657,7 +2657,7 @@ fi # Define the identity of the package. PACKAGE='fonttosfnt' - VERSION='1.2.0' + VERSION='1.2.1' cat >>confdefs.h <<_ACEOF @@ -11156,7 +11156,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by fonttosfnt $as_me 1.2.0, which was +This file was extended by fonttosfnt $as_me 1.2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11222,7 +11222,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -fonttosfnt config.status 1.2.0 +fonttosfnt config.status 1.2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/app/fonttosfnt/configure.ac b/app/fonttosfnt/configure.ac index fe020f1f6..3b31c6d0b 100644 --- a/app/fonttosfnt/configure.ac +++ b/app/fonttosfnt/configure.ac @@ -10,7 +10,7 @@ dnl advertising or publicity pertaining to distribution of the software without dnl specific, written prior permission. Red Hat makes no dnl representations about the suitability of this software for any purpose. It dnl is provided "as is" without express or implied warranty. -dnl +dnl dnl RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO dnl EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR @@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT(fonttosfnt,[1.2.0], [https://gitlab.freedesktop.org/xorg/app/fonttosfnt/issues],fonttosfnt) +AC_INIT(fonttosfnt,[1.2.1], [https://gitlab.freedesktop.org/xorg/app/fonttosfnt/issues],fonttosfnt) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) diff --git a/app/fonttosfnt/fonttosfnt.h b/app/fonttosfnt/fonttosfnt.h index 0dcc31c50..53d958710 100644 --- a/app/fonttosfnt/fonttosfnt.h +++ b/app/fonttosfnt/fonttosfnt.h @@ -191,6 +191,7 @@ unsigned faceFoundry(FT_Face); char *faceEncoding(FT_Face); int faceFlags(FT_Face); int faceIntProp(FT_Face, const char *); +char *faceStringProp(FT_Face, const char *); int faceWeight(FT_Face); int faceWidth(FT_Face); int faceItalicAngle(FT_Face); diff --git a/app/fonttosfnt/read.c b/app/fonttosfnt/read.c index 6b41ba536..0f996ac02 100644 --- a/app/fonttosfnt/read.c +++ b/app/fonttosfnt/read.c @@ -103,7 +103,7 @@ readFile(char *filename, FontPtr font) BitmapPtr bitmap; int symbol = 0; int force_unicode = 1; - const char *encoding_name, *file_format; + const char *family_name, *encoding_name, *file_format; FontMapPtr mapping = NULL; FontMapReversePtr reverse = NULL; @@ -171,6 +171,11 @@ readFile(char *filename, FontPtr font) } } + if(face->family_name) + family_name = face->family_name; + else + family_name = faceStringProp(face, "FONT"); + if(verbose_flag) { fprintf(stderr, "%s %s %s: %d sizes%s\n", filename ? filename : "<stdin>", @@ -178,15 +183,14 @@ readFile(char *filename, FontPtr font) symbol ? " (symbol)" : ""); } - if(font->numNames == 0 && face->style_name && face->family_name) { - char *full_name, *unique_name; - BDF_PropertyRec prop; + if(font->numNames == 0 && face->style_name && family_name) { + char *full_name, *unique_name, *buf; int i; if(strcmp(face->style_name, "Regular") == 0) - full_name = sprintf_alloc("%s", face->family_name); + full_name = sprintf_alloc("%s", family_name); else full_name = sprintf_alloc("%s %s", - face->family_name, face->style_name); + family_name, face->style_name); /* The unique name doesn't actually need to be globally unique; it only needs to be unique among all installed fonts on a @@ -214,17 +218,18 @@ readFile(char *filename, FontPtr font) } i = 0; - rc = FT_Get_BDF_Property(face, "COPYRIGHT", &prop); - if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { + buf = faceStringProp(face, "COPYRIGHT"); + if(buf) { font->names[i].nid = 0; - font->names[i].size = 2 * strlen(prop.u.atom); - font->names[i].value = makeUTF16((char*)prop.u.atom); + font->names[i].size = 2 * strlen(buf); + font->names[i].value = makeUTF16(buf); + free(buf); i++; - } + } font->names[i].nid = 1; - font->names[i].size = 2 * strlen(face->family_name); - font->names[i].value = makeUTF16(face->family_name); + font->names[i].size = 2 * strlen(family_name); + font->names[i].value = makeUTF16(family_name); i++; font->names[i].nid = 2; @@ -247,19 +252,14 @@ readFile(char *filename, FontPtr font) font->names[i].value = makeUTF16("Version 0.0"); i++; - rc = FT_Get_BDF_Property(face, "FOUNDRY", &prop); - if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { + buf = faceStringProp(face, "FOUNDRY"); + if(buf) { font->names[i].nid = 8; - if(prop.u.atom) { - font->names[i].size = 2 * strlen(prop.u.atom); - font->names[i].value = makeUTF16((char*)prop.u.atom); - } - else { - font->names[i].size = 0; - font->names[i].value = makeUTF16(""); - } + font->names[i].size = 2 * strlen(buf); + font->names[i].value = makeUTF16(buf); + free(buf); i++; - } + } font->names[i].nid = 10; font->names[i].size = 2 * strlen(XVENDORNAMESHORT diff --git a/app/fonttosfnt/util.c b/app/fonttosfnt/util.c index ba9d096df..655b5cf9a 100644 --- a/app/fonttosfnt/util.c +++ b/app/fonttosfnt/util.c @@ -405,6 +405,24 @@ faceIntProp(FT_Face face, const char *name) } char * +faceStringProp(FT_Face face, const char *name) +{ + int rc; + BDF_PropertyRec prop; + char *buf = NULL; + + rc = FT_Get_BDF_Property(face, name, &prop); + if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { + buf = sprintf_alloc("%s", prop.u.atom ? prop.u.atom : ""); + if(buf == NULL) { + perror("sprintf_alloc failed"); + exit(1); + } + } + return buf; +} + +char * faceEncoding(FT_Face face) { BDF_PropertyRec p1, p2; diff --git a/app/fonttosfnt/write.c b/app/fonttosfnt/write.c index ca7c95a0b..e68b70c52 100644 --- a/app/fonttosfnt/write.c +++ b/app/fonttosfnt/write.c @@ -334,7 +334,7 @@ writeFile(char *filename, FontPtr font) current_cmap = makeCmap(font); if(current_cmap == NULL) { fprintf(stderr, "Couldn't build cmap.\n"); - return -1; + goto fail; } fontMetrics(font); @@ -363,7 +363,7 @@ writeFile(char *filename, FontPtr font) strike->indexSubTables = makeIndexSubTables(strike, current_cmap); if(!strike->indexSubTables) { fprintf(stderr, "Couldn't build indexSubTable.\n"); - return -1; + goto fail; } strike = strike->next; } @@ -449,6 +449,7 @@ writeFile(char *filename, FontPtr font) return 0; fail: + fclose(out); unlink(filename); return -1; } |