Maps fonts produced by the Culmus project <http://culmus.sourceforge.net> to the XLFD foundry name "culmus". For TrueType fonts, maps the vendor code "CLM" from the TrueType vendor id field. For Type1 fonts, which use heuristics to guess mappings to XLFD foundries from words in the copyright notice, add the names of the main contributors to the Culmus product to recognize the fonts under their copyright. Note: FcNoticeFoundriesi[][] modified to eliminate hard-coded offsets. Signed-off-by: Maxim Iorsh <iorsh@xxxxxxxxxxxxxxxxxxxxx> --- src/fcfreetype.c | 67 +++++++++++++++++------------------------------------ 1 files changed, 22 insertions(+), 45 deletions(-)
diff --git a/src/fcfreetype.c b/src/fcfreetype.c index d37af2d..b540647 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -803,48 +803,25 @@ FcSfntNameLanguage (FT_SfntName *sname) /* Order is significant. For example, some B&H fonts are hinted by URW++, and both strings appear in the notice. */ -static const char notice_foundry_data[] = - "Bigelow\0b&h\0" - "Adobe\0adobe\0" - "Bitstream\0bitstream\0" - "Monotype\0monotype\0" - "Linotype\0linotype\0" - "LINOTYPE-HELL\0linotype\0" - "IBM\0ibm\0" - "URW\0urw\0" - "International Typeface Corporation\0itc\0" - "Tiro Typeworks\0tiro\0" - "XFree86\0xfree86\0" - "Microsoft\0microsoft\0" - "Omega\0omega\0" - "Font21\0hwan\0" - "HanYang System\0hanyang"; - -struct _notice_foundry { - /* these are the offsets into the - * notice_foundry_data array. - */ - unsigned char notice_offset; - unsigned char foundry_offset; -}; - -static const struct _notice_foundry FcNoticeFoundries[] = { - { 0, 8 }, - { 12, 18 }, - { 24, 34 }, - { 44, 53 }, - { 62, 71 }, - { 80, 94 }, - { 103, 107 }, - { 111, 115 }, - { 119, 154 }, - { 158, 173 }, - { 178, 186 }, - { 194, 204 }, - { 214, 220 }, - { 226, 233 }, - { 238, 253 } -}; +static const char *FcNoticeFoundries[][2] = + {{"Iorsh", "culmus"}, + {"Gnat", "culmus"}, + {"Bigelow", "b&h"}, + {"Adobe", "adobe"}, + {"Bitstream", "bitstream"}, + {"Monotype", "monotype"}, + {"Linotype", "linotype"}, + {"LINOTYPE-HELL", "linotype"}, + {"IBM", "ibm"}, + {"URW", "urw"}, + {"International Typeface Corporation", "itc"}, + {"Tiro Typeworks", "tiro"}, + {"XFree86", "xfree86"}, + {"Xorg", "xorg"}, + {"Microsoft", "microsoft"}, + {"Omega", "omega"}, + {"Font21", "hwan"}, + {"HanYang System", "hanyang"}}; #define NUM_NOTICE_FOUNDRIES (int) (sizeof (FcNoticeFoundries) / sizeof (FcNoticeFoundries[0])) @@ -856,9 +833,8 @@ FcNoticeFoundry(const FT_String *notice) if (notice) for(i = 0; i < NUM_NOTICE_FOUNDRIES; i++) { - const struct _notice_foundry *nf = &FcNoticeFoundries[i]; - const char *n = notice_foundry_data + nf->notice_offset; - const char *f = notice_foundry_data + nf->foundry_offset; + const char *n = FcNoticeFoundries[i][0]; + const char *f = FcNoticeFoundries[i][1]; if (strstr ((const char *) notice, n)) return (const FcChar8 *) f; @@ -899,6 +875,7 @@ static const struct { { "B&H", "b&h"}, { "BITS", "bitstream"}, { "CANO", "cannon"}, + { "CLM", "culmus"}, { "DYNA", "dynalab"}, { "EPSN", "epson"}, { "FJ", "fujitsu"},
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig