fonttosfnt: update to 1.1.0.

This commit is contained in:
Leah Neukirchen 2020-01-06 15:02:28 +01:00
parent ef3f584525
commit c452f8c196
6 changed files with 3 additions and 195 deletions

View file

@ -1,82 +0,0 @@
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)
{

View file

@ -1,16 +0,0 @@
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);

View file

@ -1,57 +0,0 @@
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;

View file

@ -1,32 +0,0 @@
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;

View file

@ -1,5 +0,0 @@
c214ab0d7deae30acdf90933ed14b223118dcf67.diff
6fc84fb2c0d4ac0b3b66330057bb90418cc1eb28.diff
5d446a02a7422d3a61f74b8d1c28b7b551ea06fd.diff
cfb4d64e1b90a28693fd700f4abf0f55d969f4f6.diff
d06059ef2a85df3c70f3c0b77364b4c49837f331.diff

View file

@ -1,7 +1,7 @@
# Template file for 'fonttosfnt'
pkgname=fonttosfnt
version=1.0.5
revision=2
version=1.1.0
revision=1
build_style=gnu-configure
hostmakedepends="pkg-config xorg-util-macros"
makedepends="libfontenc-devel freetype-devel"
@ -10,7 +10,7 @@ maintainer="Leah Neukirchen <leah@vuxu.org>"
license="MIT"
homepage="http://xorg.freedesktop.org"
distfiles="${XORG_SITE}/app/${pkgname}-${version}.tar.bz2"
checksum=c80a5ff516aa06da2e90df044b8e28715f7d9e451feac8030951d9ff828d8503
checksum=7283fd477e3de75cce40b91b5012953e30b862975555d4482435e2ee7b0f46dc
patch_args="-Np1"
post_install() {