From 2827674cdc82886a3e1c5f9732868185dc1cda68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Wed, 18 Dec 2019 16:15:39 +0100 Subject: [PATCH] fonttosfnt: add upstream patches after 1.0.5 --- ...46a02a7422d3a61f74b8d1c28b7b551ea06fd.diff | 20 +++++ ...84fb2c0d4ac0b3b66330057bb90418cc1eb28.diff | 82 +++++++++++++++++++ ...4ab0d7deae30acdf90933ed14b223118dcf67.diff | 16 ++++ ...4d64e1b90a28693fd700f4abf0f55d969f4f6.diff | 57 +++++++++++++ ...059ef2a85df3c70f3c0b77364b4c49837f331.diff | 32 ++++++++ srcpkgs/fonttosfnt/patches/series | 5 ++ srcpkgs/fonttosfnt/template | 3 +- 7 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/fonttosfnt/patches/5d446a02a7422d3a61f74b8d1c28b7b551ea06fd.diff create mode 100644 srcpkgs/fonttosfnt/patches/6fc84fb2c0d4ac0b3b66330057bb90418cc1eb28.diff create mode 100644 srcpkgs/fonttosfnt/patches/c214ab0d7deae30acdf90933ed14b223118dcf67.diff create mode 100644 srcpkgs/fonttosfnt/patches/cfb4d64e1b90a28693fd700f4abf0f55d969f4f6.diff create mode 100644 srcpkgs/fonttosfnt/patches/d06059ef2a85df3c70f3c0b77364b4c49837f331.diff create mode 100644 srcpkgs/fonttosfnt/patches/series diff --git a/srcpkgs/fonttosfnt/patches/5d446a02a7422d3a61f74b8d1c28b7b551ea06fd.diff b/srcpkgs/fonttosfnt/patches/5d446a02a7422d3a61f74b8d1c28b7b551ea06fd.diff new file mode 100644 index 0000000000..ec22bf9e36 --- /dev/null +++ b/srcpkgs/fonttosfnt/patches/5d446a02a7422d3a61f74b8d1c28b7b551ea06fd.diff @@ -0,0 +1,20 @@ +diff --git a/read.c b/read.c +index 632c7e7a6e91eddfb67e349d284c316b7fb06648..5e80cc5cd76023c57cba390027136a7bdabec895 100644 +--- a/read.c ++++ b/read.c +@@ -79,10 +79,13 @@ 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 */ + encoding_name = faceEncoding(face); + if(encoding_name == NULL) { + symbol = 1; +- } else if(strcasecmp(encoding_name, "iso10646-1") != 0) { ++ } else if((strcasecmp(encoding_name, "iso10646-1") != 0) && ++ (strcasecmp(encoding_name, "iso8859-1") != 0)) { + if(reencode_flag) + mapping = FontEncMapFind(encoding_name, + FONT_ENCODING_UNICODE, 0, 0, NULL); + diff --git a/srcpkgs/fonttosfnt/patches/6fc84fb2c0d4ac0b3b66330057bb90418cc1eb28.diff b/srcpkgs/fonttosfnt/patches/6fc84fb2c0d4ac0b3b66330057bb90418cc1eb28.diff new file mode 100644 index 0000000000..de1cbc7ca8 --- /dev/null +++ b/srcpkgs/fonttosfnt/patches/6fc84fb2c0d4ac0b3b66330057bb90418cc1eb28.diff @@ -0,0 +1,82 @@ +diff --git a/util.c b/util.c +index 5a23eeb7eddedbd76262438ab0507207c2331062..bcbfa2f5b557114452d07c1f2e33b8f81758fe2d 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) + { + diff --git a/srcpkgs/fonttosfnt/patches/c214ab0d7deae30acdf90933ed14b223118dcf67.diff b/srcpkgs/fonttosfnt/patches/c214ab0d7deae30acdf90933ed14b223118dcf67.diff new file mode 100644 index 0000000000..f18a0c415c --- /dev/null +++ b/srcpkgs/fonttosfnt/patches/c214ab0d7deae30acdf90933ed14b223118dcf67.diff @@ -0,0 +1,16 @@ +diff --git a/struct.c b/struct.c +index c0a3adda376e533d6bb10e5d46e3209585b4751f..294f498c14ef4a8e1cab1b22d7194b86c25b496f 100644 +--- a/struct.c ++++ b/struct.c +@@ -491,8 +491,8 @@ fontMetrics(FontPtr font, + { + int i, rc; + int max_awidth = 0; +- int min_x = 10000 << 16, min_y = 10000 << 16; +- int max_x = -10000 << 16, max_y = -10000 << 16; ++ int min_x = 10000 * 65536, min_y = 10000 * 65536; ++ int max_x = -10000 * 65536, max_y = -10000 * 65536; + for(i = 0; i < FONT_CODES; i++) { + int awidth, x0, y0, x1, y1; + rc = glyphMetrics(font, i, &awidth, &x0, &y0, &x1, &y1); + diff --git a/srcpkgs/fonttosfnt/patches/cfb4d64e1b90a28693fd700f4abf0f55d969f4f6.diff b/srcpkgs/fonttosfnt/patches/cfb4d64e1b90a28693fd700f4abf0f55d969f4f6.diff new file mode 100644 index 0000000000..b75183641f --- /dev/null +++ b/srcpkgs/fonttosfnt/patches/cfb4d64e1b90a28693fd700f4abf0f55d969f4f6.diff @@ -0,0 +1,57 @@ +diff --git a/read.c b/read.c +index 5e80cc5cd76023c57cba390027136a7bdabec895..05f7b4fc7b76508912e537c7b1026ab1cdef7eab 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; + diff --git a/srcpkgs/fonttosfnt/patches/d06059ef2a85df3c70f3c0b77364b4c49837f331.diff b/srcpkgs/fonttosfnt/patches/d06059ef2a85df3c70f3c0b77364b4c49837f331.diff new file mode 100644 index 0000000000..6960c2b38f --- /dev/null +++ b/srcpkgs/fonttosfnt/patches/d06059ef2a85df3c70f3c0b77364b4c49837f331.diff @@ -0,0 +1,32 @@ +diff --git a/read.c b/read.c +index 05f7b4fc7b76508912e537c7b1026ab1cdef7eab..9f5af3639c47b304df74968e7bd3516dd0b44fdc 100644 +--- a/read.c ++++ b/read.c +@@ -255,20 +255,20 @@ readFile(char *filename, FontPtr font) + if(verbose_flag) + fprintf(stderr, "size %d: %dx%d\n", + i, +- (int)(face->available_sizes[i].x_ppem >> 6), +- (int)(face->available_sizes[i].y_ppem >> 6)); ++ (int)((face->available_sizes[i].x_ppem + 32) >> 6), ++ (int)((face->available_sizes[i].y_ppem + 32) >> 6)); + + rc = FT_Set_Pixel_Sizes(face, +- face->available_sizes[i].x_ppem >> 6, +- face->available_sizes[i].y_ppem >> 6); ++ (face->available_sizes[i].x_ppem + 32) >> 6, ++ (face->available_sizes[i].y_ppem + 32) >> 6); + if(rc != 0) { + fprintf(stderr, "Couldn't set size.\n"); + return -1; + } + + strike = makeStrike(font, +- face->available_sizes[i].x_ppem >> 6, +- face->available_sizes[i].y_ppem >> 6); ++ (face->available_sizes[i].x_ppem + 32) >> 6, ++ (face->available_sizes[i].y_ppem + 32) >> 6); + if(strike == NULL) { + fprintf(stderr, "Couldn't allocate strike.\n"); + return -1; + diff --git a/srcpkgs/fonttosfnt/patches/series b/srcpkgs/fonttosfnt/patches/series new file mode 100644 index 0000000000..f1c07a92f2 --- /dev/null +++ b/srcpkgs/fonttosfnt/patches/series @@ -0,0 +1,5 @@ +c214ab0d7deae30acdf90933ed14b223118dcf67.diff +6fc84fb2c0d4ac0b3b66330057bb90418cc1eb28.diff +5d446a02a7422d3a61f74b8d1c28b7b551ea06fd.diff +cfb4d64e1b90a28693fd700f4abf0f55d969f4f6.diff +d06059ef2a85df3c70f3c0b77364b4c49837f331.diff diff --git a/srcpkgs/fonttosfnt/template b/srcpkgs/fonttosfnt/template index 45d850b85f..f81f9b29bb 100644 --- a/srcpkgs/fonttosfnt/template +++ b/srcpkgs/fonttosfnt/template @@ -1,7 +1,7 @@ # Template file for 'fonttosfnt' pkgname=fonttosfnt version=1.0.5 -revision=1 +revision=2 build_style=gnu-configure hostmakedepends="pkg-config xorg-util-macros" makedepends="libfontenc-devel freetype-devel" @@ -11,6 +11,7 @@ license="MIT" homepage="http://xorg.freedesktop.org" distfiles="${XORG_SITE}/app/${pkgname}-${version}.tar.bz2" checksum=c80a5ff516aa06da2e90df044b8e28715f7d9e451feac8030951d9ff828d8503 +patch_args="-Np1" post_install() { vlicense COPYING