vp-build/srcpkgs/fonttosfnt/patches/6fc84fb2c0d4ac0b3b66330057b...

83 lines
2.9 KiB
Diff

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)
{