--- mkfontscale.c.orig Sat May 18 18:15:35 2002
+++ mkfontscale.c
@@ -37,6 +37,12 @@
#include "freetype/internal/t1types.h"
#include "freetype/ftmodule.h"
+#define TT_CODEPAGE_RANGE_932 (1L << 17) /* JIS/Japan */
+#define TT_CODEPAGE_RANGE_936 (1L << 18) /* Chinese: Simplified */
+#define TT_CODEPAGE_RANGE_949 (1L << 19) /* Korean Wansung */
+#define TT_CODEPAGE_RANGE_950 (1L << 20) /* Chinese: Traditional */
+#define TT_CODEPAGE_RANGE_1361 (1L << 21) /* Korean Johab */
+
#define FACE_TYPE(FACE) ((FACE)->driver->clazz->root.module_name)
#define T1INFO(FACE) \
(strcasecmp(FACE_TYPE(FACE), "type1") == 0 ?\
@@ -58,7 +64,7 @@
"adobe-standard", "adobe-symbol", "ibm-cp437", "microsoft-cp1252",
/* But not "adobe-dingbats", as it uses generic glyph names. */
"jisx0201.1976-0", "jisx0208.1983-0", "jisx0208.1990-0",
- "jisx0212.1190-0", "big5.eten-0", "gb2312.1980-0",
+ "jisx0212.1990-0", "big5-0", "gb2312.1980-0",
"ksc5601.1987-0", "ksc5601.1992-3"};
char *extra_encodings_array[] =
@@ -69,7 +75,7 @@
#define countof(_a) (sizeof(_a)/sizeof((_a)[0]))
int doDirectory(char*);
-static int checkEncoding(FT_Face face, char *encoding_name);
+static int checkEncoding(FT_Face face, char *encoding_name, TT_OS2 *os2);
static int checkExtraEncoding(FT_Face face, char *encoding_name, int found);
static int find_cmap(int type, int pid, int eid, FT_Face face,
FT_CharMap *cmap_return);
@@ -456,7 +462,12 @@
if(!spacing) spacing = "p";
for(encoding = encodings; encoding; encoding = encoding->next)
- if(checkEncoding(face, encoding->value)) {
+ if(checkEncoding(face, encoding->value, os2)) {
+ if((strncmp("jis", encoding->value, 3) == 0) ||
+ (strncmp("big5", encoding->value, 4) == 0) ||
+ (strncmp("gb", encoding->value, 2) == 0) ||
+ (strncmp("ksc", encoding->value, 3) == 0))
+ spacing = "c";
found = 1;
entries = listConsF(entries,
"%s -%s-%s-%s-%s-%s-%s-0-0-0-0-%s-0-%s",
@@ -491,7 +502,7 @@
}
static int
-checkEncoding(FT_Face face, char *encoding_name)
+checkEncoding(FT_Face face, char *encoding_name, TT_OS2 *os2)
{
FontEncPtr encoding;
FontMapPtr mapping;
@@ -542,6 +553,18 @@
if(CODE_IGNORED(c)) {
continue;
} else {
+ if((strcmp(encoding->name, "jisx0208.1983-0")==0) &
&
+ (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_932))
+ return 1;
+ if((strcmp(encoding->name, "big5.eten-0")==0) &&
+ (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_950))
+ return 1;
+ if((strcmp(encoding->name, "gb2312.1980-0")==0) &&
+ (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_936))
+ return 1;
+ if((strcmp(encoding->name, "ksc5601.1987-0")==0) &&
+ (os2->ulCodePageRange1 & TT_CODEPAGE_RANGE_949))
+ return 1;
if(FT_Get_Char_Index(face, c) == 0) {
return 0;
}