summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fcfreetype.c84
1 files changed, 12 insertions, 72 deletions
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index 50ff348..afbd9ac 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -978,76 +978,6 @@ FcNoticeFoundry(const FT_String *notice)
return 0;
}
-static FcBool
-FcVendorMatch(const FT_Char vendor[4], const FT_Char *vendor_string)
-{
- /* vendor is not necessarily NUL-terminated. */
- int i, len;
-
- len = strlen((char *) vendor_string);
- if (memcmp(vendor, vendor_string, len) != 0)
- return FcFalse;
- for (i = len; i < 4; i++)
- if (vendor[i] != ' ' && vendor[i] != '\0')
- return FcFalse;
- return FcTrue;
-}
-
-/* This table is partly taken from ttmkfdir by Joerg Pommnitz. */
-
-/* It should not contain useless entries (such as UNKN) nor duplicate
- entries for padding both with spaces and NULs. */
-
-static const struct {
- const FT_Char vendor[5];
- const FcChar8 foundry[13];
-} FcVendorFoundries[] = {
- { "ADBE", "adobe"},
- { "AGFA", "agfa"},
- { "ALTS", "altsys"},
- { "APPL", "apple"},
- { "ARPH", "arphic"},
- { "ATEC", "alltype"},
- { "B&H", "b&h"},
- { "BITS", "bitstream"},
- { "CANO", "cannon"},
- { "CLM", "culmus"},
- { "DYNA", "dynalab"},
- { "EPSN", "epson"},
- { "FJ", "fujitsu"},
- { "IBM", "ibm"},
- { "ITC", "itc"},
- { "IMPR", "impress"},
- { "LARA", "larabiefonts"},
- { "LEAF", "interleaf"},
- { "LETR", "letraset"},
- { "LINO", "linotype"},
- { "MACR", "macromedia"},
- { "MONO", "monotype"},
- { "MS", "microsoft"},
- { "MT", "monotype"},
- { "NEC", "nec"},
- { "PARA", "paratype"},
- { "QMSI", "qms"},
- { "RICO", "ricoh"},
- { "URW", "urw"},
- { "Y&Y", "y&y"}
-};
-
-#define NUM_VENDOR_FOUNDRIES (int) (sizeof (FcVendorFoundries) / sizeof (FcVendorFoundries[0]))
-
-static const FcChar8 *
-FcVendorFoundry(const FT_Char vendor[4])
-{
- int i;
-
- if (vendor)
- for(i = 0; i < NUM_VENDOR_FOUNDRIES; i++)
- if (FcVendorMatch (vendor, FcVendorFoundries[i].vendor))
- return FcVendorFoundries[i].foundry;
- return 0;
-}
-
typedef struct _FcStringConst {
const FcChar8 *name;
int value;
@@ -1239,7 +1169,7 @@ FcFreeTypeQueryFace (const FT_Face face,
#if 0
FcChar8 *family = 0;
#endif
- FcChar8 *complex_;
+ FcChar8 *complex_, *foundry_ = NULL;
const FcChar8 *foundry = 0;
int spacing;
TT_OS2 *os2;
@@ -1315,7 +1245,15 @@ FcFreeTypeQueryFace (const FT_Face face,
*/
if (os2 && os2->version >= 0x0001 && os2->version != 0xffff)
- foundry = FcVendorFoundry(os2->achVendID);
+ {
+ if (os2->achVendID && os2->achVendID[0] != 0)
+ {
+ foundry_ = (FcChar8 *) malloc (sizeof (os2->achVendID) + 1);
+ memcpy ((void *)foundry_, os2->achVendID, sizeof (os2->achVendID));
+ foundry_[sizeof (os2->achVendID)] = 0;
+ foundry = foundry_;
+ }
+ }
if (FcDebug () & FC_DBG_SCANV)
printf ("\n");
@@ -1946,6 +1884,8 @@ bail2:
FcCharSetDestroy (cs);
bail1:
FcPatternDestroy (pat);
+ if (foundry_)
+ free (foundry_);
bail0:
return NULL;
}