Drop unmaintained code

Use four-byte code for foundry as is instead.

https://bugs.freedesktop.org/show_bug.cgi?id=88679
This commit is contained in:
Akira TAGOH 2015-04-22 14:36:29 +09:00
parent b3fc08bc95
commit 3a4136778c
1 changed files with 12 additions and 72 deletions

View File

@ -978,76 +978,6 @@ FcNoticeFoundry(const FT_String *notice)
return 0; 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 { typedef struct _FcStringConst {
const FcChar8 *name; const FcChar8 *name;
int value; int value;
@ -1239,7 +1169,7 @@ FcFreeTypeQueryFace (const FT_Face face,
#if 0 #if 0
FcChar8 *family = 0; FcChar8 *family = 0;
#endif #endif
FcChar8 *complex_; FcChar8 *complex_, *foundry_ = NULL;
const FcChar8 *foundry = 0; const FcChar8 *foundry = 0;
int spacing; int spacing;
TT_OS2 *os2; TT_OS2 *os2;
@ -1315,7 +1245,15 @@ FcFreeTypeQueryFace (const FT_Face face,
*/ */
if (os2 && os2->version >= 0x0001 && os2->version != 0xffff) 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) if (FcDebug () & FC_DBG_SCANV)
printf ("\n"); printf ("\n");
@ -1946,6 +1884,8 @@ bail2:
FcCharSetDestroy (cs); FcCharSetDestroy (cs);
bail1: bail1:
FcPatternDestroy (pat); FcPatternDestroy (pat);
if (foundry_)
free (foundry_);
bail0: bail0:
return NULL; return NULL;
} }