diff options
author | Ryan Farley | 2019-08-31 07:04:50 -0500 |
---|---|---|
committer | Ryan Farley | 2019-08-31 07:07:19 -0500 |
commit | 4d692f5b46f4e1556e3d1e2f6fcb03beddee3403 (patch) | |
tree | 877dabb9591cf64883081915a7664c4e869acfaa | |
parent | ec88257753a14fb41ed4ce90ad2ed1124edaa25d (diff) | |
download | aur-4d692f5b46f4e1556e3d1e2f6fcb03beddee3403.tar.gz |
patches to fix segfaults, handle more encodings
...should probably include PKGBUILD and SRCINFO
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | 0001-let-freetype-handle-ISO-8859-1-mapping.patch (renamed from 0001-read-let-freetype-handle-8859-1-mapping.patch) | 10 | ||||
-rw-r--r-- | 0002-allow-ISO-646.1991-IRV-as-well-adobe-standard-for-bd.patch | 72 | ||||
-rw-r--r-- | 0003-check-for-freetype-NULL-atoms.patch | 95 | ||||
-rw-r--r-- | PKGBUILD | 12 |
5 files changed, 187 insertions, 10 deletions
@@ -16,9 +16,13 @@ pkgbase = fonttosfnt-git provides = fonttosfnt conflicts = fonttosfnt source = git+https://gitlab.freedesktop.org/xorg/app/fonttosfnt.git - source = 0001-read-let-freetype-handle-8859-1-mapping.patch + source = 0001-let-freetype-handle-ISO-8859-1-mapping.patch + source = 0002-allow-ISO-646.1991-IRV-as-well-adobe-standard-for-bd.patch + source = 0003-check-for-freetype-NULL-atoms.patch md5sums = SKIP - md5sums = 85945e798ebe976d1fba94ea039b625c + md5sums = c9a2934334f46681f1a6131d4fd13077 + md5sums = 1b542636d9a95d9bb6095c12aa20eb3a + md5sums = 9ba2b5498590e75859099cd57c970ac3 pkgname = fonttosfnt-git diff --git a/0001-read-let-freetype-handle-8859-1-mapping.patch b/0001-let-freetype-handle-ISO-8859-1-mapping.patch index afe6852c0054..24b7e587f351 100644 --- a/0001-read-let-freetype-handle-8859-1-mapping.patch +++ b/0001-let-freetype-handle-ISO-8859-1-mapping.patch @@ -1,7 +1,7 @@ -From b21f97e424faac297387fb1d5c0b8eb67d804dd2 Mon Sep 17 00:00:00 2001 +From ae7f143f7b8dd14fd720061922a5a5e03fa60218 Mon Sep 17 00:00:00 2001 From: Ryan Farley <ryan.farley@gmx.com> -Date: Tue, 20 Aug 2019 00:33:08 -0500 -Subject: [PATCH] read - let freetype handle 8859-1 mapping +Date: Tue, 20 Aug 2019 03:16:22 -0500 +Subject: [PATCH app/fonttosfnt 1/2] let freetype handle ISO-8859-1 mapping https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_encoding indicates that ISO-8859-1 is automatically mapped to Unicode for BDF and @@ -12,7 +12,7 @@ leads to an error for such fonts. 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/read.c b/read.c -index bee518c..e41361a 100644 +index 632c7e7..5e80cc5 100644 --- a/read.c +++ b/read.c @@ -79,10 +79,13 @@ readFile(char *filename, FontPtr font) @@ -31,5 +31,5 @@ index bee518c..e41361a 100644 mapping = FontEncMapFind(encoding_name, FONT_ENCODING_UNICODE, 0, 0, NULL); -- -2.22.1 +2.23.0 diff --git a/0002-allow-ISO-646.1991-IRV-as-well-adobe-standard-for-bd.patch b/0002-allow-ISO-646.1991-IRV-as-well-adobe-standard-for-bd.patch new file mode 100644 index 000000000000..2a4e0875de96 --- /dev/null +++ b/0002-allow-ISO-646.1991-IRV-as-well-adobe-standard-for-bd.patch @@ -0,0 +1,72 @@ +From 07230480293018e2f5a7fa7c2ddb7aaebd567897 Mon Sep 17 00:00:00 2001 +From: Ryan Farley <ryan.farley@gmx.com> +Date: Sat, 31 Aug 2019 06:42:24 -0500 +Subject: [PATCH app/fonttosfnt 2/2] allow ISO-646.1991-IRV as well, adobe + standard for bdf + +Allow for BDF file with no specified encoding to be read as Adobe +Standard (per freetype's BDF driver), and handle any Unicode-equivalent +encoding without changing the encoding name. +--- + read.c | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/read.c b/read.c +index 5e80cc5..05f7b4f 100644 +--- a/read.c ++++ b/read.c +@@ -64,6 +64,7 @@ readFile(char *filename, FontPtr font) + StrikePtr strike; + BitmapPtr bitmap; + int symbol = 0; ++ int force_unicode = 1; + char *encoding_name = NULL; + FontMapPtr mapping = NULL; + FontMapReversePtr reverse = NULL; +@@ -79,13 +80,20 @@ readFile(char *filename, FontPtr font) + return -1; + } + +- /* FreeType will handle Unicode and automatically map ISO-8859-1 to +- * Unicode for us -- everything else needs a mapping */ ++ /* FreeType will insist on encodings which are simple subsets of unicode ++ * to be read as unicode regardless of what we call them. */ ++ for(j = 0; j < face->num_charmaps; ++j) { ++ if((face->charmaps[j]->encoding == ft_encoding_none) || ++ (face->charmaps[j]->encoding == ft_encoding_adobe_standard)) { ++ force_unicode = 0; ++ break; ++ } ++ } ++ + encoding_name = faceEncoding(face); + if(encoding_name == NULL) { + symbol = 1; +- } else if((strcasecmp(encoding_name, "iso10646-1") != 0) && +- (strcasecmp(encoding_name, "iso8859-1") != 0)) { ++ } else if(strcasecmp(encoding_name, "iso10646-1") != 0) { + if(reencode_flag) + mapping = FontEncMapFind(encoding_name, + FONT_ENCODING_UNICODE, 0, 0, NULL); +@@ -228,10 +236,16 @@ readFile(char *filename, FontPtr font) + return -1; + } + +- if(!symbol && !mapping) ++ if((!symbol && !mapping) || force_unicode) { + rc = FT_Select_Charmap(face, ft_encoding_unicode); +- else ++ } else { + rc = FT_Select_Charmap(face, ft_encoding_none); ++ if(rc != 0) { ++ /* BDF will default to Adobe Standard even for nonstandard ++ * encodings, so try that as a last resort. */ ++ rc = FT_Select_Charmap(face, ft_encoding_adobe_standard); ++ } ++ } + if(rc != 0) { + fprintf(stderr, "Couldn't select character map: %x.\n", rc); + return -1; +-- +2.23.0 + diff --git a/0003-check-for-freetype-NULL-atoms.patch b/0003-check-for-freetype-NULL-atoms.patch new file mode 100644 index 000000000000..7c28748beeed --- /dev/null +++ b/0003-check-for-freetype-NULL-atoms.patch @@ -0,0 +1,95 @@ +From 6fc84fb2c0d4ac0b3b66330057bb90418cc1eb28 Mon Sep 17 00:00:00 2001 +From: Ryan Farley <ryan.farley@gmx.com> +Date: Fri, 30 Aug 2019 09:43:50 -0500 +Subject: [PATCH app/fonttosfnt] check for freetype NULL atoms + +Freetype uses NULL to represent an empty string when retrieving a BDF +property -- check for this in addition to an actual error +--- + util.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/util.c b/util.c +index 5a23eeb..bcbfa2f 100644 +--- a/util.c ++++ b/util.c +@@ -127,7 +127,7 @@ vsprintf_alloc(const char *f, va_list args) + } + #endif + +-/* Build a UTF-16 string from a Latin-1 string. ++/* Build a UTF-16 string from a Latin-1 string. + Result is not NUL-terminated. */ + char * + makeUTF16(const char *string) +@@ -241,7 +241,7 @@ faceFoundry(FT_Face face) + BDF_PropertyRec prop; + + rc = FT_Get_BDF_Property(face, "FOUNDRY", &prop); +- if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { ++ if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM && prop.u.atom) { + if(strcasecmp(prop.u.atom, "adobe") == 0) + return makeName("ADBE"); + else if(strcasecmp(prop.u.atom, "agfa") == 0) +@@ -286,7 +286,7 @@ faceFoundry(FT_Face face) + /* For now */ + return makeName("UNKN"); + } +- ++ + + int + faceWeight(FT_Face face) +@@ -294,7 +294,7 @@ faceWeight(FT_Face face) + int rc; + BDF_PropertyRec prop; + rc = FT_Get_BDF_Property(face, "WEIGHT_NAME", &prop); +- if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { ++ if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM && prop.u.atom) { + if(strcasecmp(prop.u.atom, "thin") == 0) + return 100; + else if(strcasecmp(prop.u.atom, "extralight") == 0) +@@ -323,7 +323,7 @@ faceWidth(FT_Face face) + int rc; + BDF_PropertyRec prop; + rc = FT_Get_BDF_Property(face, "SETWIDTH_NAME", &prop); +- if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { ++ if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM && prop.u.atom) { + if(strcasecmp(prop.u.atom, "ultracondensed") == 0) + return 1; + else if(strcasecmp(prop.u.atom, "extracondensed") == 0) +@@ -360,7 +360,7 @@ faceItalicAngle(FT_Face face) + } + + rc = FT_Get_BDF_Property(face, "SLANT", &prop); +- if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { ++ if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM && prop.u.atom) { + if(strcasecmp(prop.u.atom, "i") == 0 || + strcasecmp(prop.u.atom, "s") == 0) + return -30 * TWO_SIXTEENTH; +@@ -380,7 +380,7 @@ faceFlags(FT_Face face) + if(faceWeight(face) >= 650) + flags |= FACE_BOLD; + rc = FT_Get_BDF_Property(face, "SLANT", &prop); +- if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM) { ++ if(rc == 0 && prop.type == BDF_PROPERTY_TYPE_ATOM && prop.u.atom) { + if(strcasecmp(prop.u.atom, "i") == 0 || + strcasecmp(prop.u.atom, "s") == 0) + flags |= FACE_ITALIC; +@@ -400,10 +400,12 @@ faceEncoding(FT_Face face) + rc = FT_Get_BDF_Property(face, "CHARSET_ENCODING", &p2); + if(rc != 0 || p2.type != BDF_PROPERTY_TYPE_ATOM) + return NULL; ++ if(!(p1.u.atom && p2.u.atom)) ++ return NULL; + + return sprintf_alloc("%s-%s", p1.u.atom, p2.u.atom); + } +- ++ + int + degreesToFraction(int deg, int *num, int *den) + { +-- +2.23.0 + @@ -12,9 +12,13 @@ makedepends=(git make autoconf automake xproto xorg-util-macros) provides=("${pkgname%-git}") conflicts=("${pkgname%-git}") source=('git+https://gitlab.freedesktop.org/xorg/app/fonttosfnt.git' - '0001-read-let-freetype-handle-8859-1-mapping.patch') + '0001-let-freetype-handle-ISO-8859-1-mapping.patch' + '0002-allow-ISO-646.1991-IRV-as-well-adobe-standard-for-bd.patch' + '0003-check-for-freetype-NULL-atoms.patch') md5sums=('SKIP' - '85945e798ebe976d1fba94ea039b625c') + 'c9a2934334f46681f1a6131d4fd13077' + '1b542636d9a95d9bb6095c12aa20eb3a' + '9ba2b5498590e75859099cd57c970ac3') pkgver() { cd "$srcdir/${pkgname%-git}" @@ -24,7 +28,9 @@ pkgver() { prepare() { cd "$srcdir/${pkgname%-git}" - patch --forward --strip=1 --input="${srcdir}/0001-read-let-freetype-handle-8859-1-mapping.patch" + patch --forward --strip=1 --input="$srcdir/0001-let-freetype-handle-ISO-8859-1-mapping.patch" + patch --forward --strip=1 --input="$srcdir/0002-allow-ISO-646.1991-IRV-as-well-adobe-standard-for-bd.patch" + patch --forward --strip=1 --input="$srcdir/0003-check-for-freetype-NULL-atoms.patch" } build() { |