New versions of mkfontscale and FreeType 2 backend 

Fri, 24 May 2002 19:38:31 +0800

> > 3) Besides that, I need to fix the spacing value 'p' to 'c' because the
> > value 'p' will cause delay in several seconds when start-up rxvt.
>
> Again, that's a font bug; mkfontscale tries to work out which fonts
> are proportional.  On the other hand, it doesn't yet implement a
> heuristic to distinguich monospaced (-m-) from charcell (-c-) fonts.

I tested your program with another two Chinese ttf from win9x - MINGLIU.TTC and KAIU.TTF, here is the result:

MINGLIU.TTC -dynalab-MingLiU-medium-r-normal--0-0-0-0-m-0-iso8859-1
MINGLIU.TTC -dynalab-MingLiU-medium-r-normal--0-0-0-0-m-0-iso10646-1
KAIU.TTF -dynalab-DFKai-SB-medium-r-normal--0-0-0-0-m-0-iso8859-1
KAIU.TTF -dynalab-DFKai-SB-medium-r-normal--0-0-0-0-m-0-iso10646-1

It looks better then I added this line by hand:

MINGLIU.TTC -dynalab-MingLiU-medium-r-normal--0-0-0-0-m-0-big5-0

The spacing value 'm' still will cause delay with rxvt. Don't know why. :) The CJK ttf seem must use the 'c' value to avoid this problem. ps. how to fix the font's bugs if I want?

maybe fixing this program will be much easy. :)

> I guess a suitable heuristic would be to decalare all monospaced fonts
> in East-Asian encodings to be charcell.

How about using os2->ulCodePageRange1 to lookup the font encoding for supporting modren Unicode encoded CJK fonts? This idea is from another program. Then set their spacing value to 'c'. Here is a patch to do it:

--- 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;
                             }

After adopting this patch, I test it with arphic ttf again, the result is what I need:

gkai00mp.ttf -arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
gkai00mp.ttf -arphic-AR PL KaitiM GB-medium-r-normal--0-0-0-0-c-0-iso10646-1
gbsn00lp.ttf -arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
gbsn00lp.ttf -arphic-AR PL SungtiL GB-medium-r-normal--0-0-0-0-c-0-iso10646-1
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-big5-0
bsmi00lp.ttf -arphic-AR PL Mingti2L Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1
bkai00mp.ttf -arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-big5-0
bkai00mp.ttf -arphic-AR PL KaitiM Big5-medium-r-normal--0-0-0-0-c-0-iso10646-1

then test it with baekmuk ttf:

batang.ttf -misc-Baekmuk Batang-medium-r-normal--0-0-0-0-c-0-ksc5601.1987-0
batang.ttf -misc-Baekmuk Batang-medium-r-normal--0-0-0-0-c-0-iso10646-1
dotum.ttf -ibm-Baekmuk Dotum-medium-r-normal--0-0-0-0-c-0-ksc5601.1987-0
dotum.ttf -ibm-Baekmuk Dotum-medium-r-normal--0-0-0-0-c-0-iso10646-1
gulim.ttf -misc-Baekmuk Gulim-medium-r-normal--0-0-0-0-c-0-ksc5601.1987-0
gulim.ttf -misc-Baekmuk Gulim-medium-r-normal--0-0-0-0-c-0-iso10646-1
hline.ttf -ibm-Baekmuk Headline-medium-r-normal--0-0-0-0-c-0-ksc5601.1987-0
hline.ttf -ibm-Baekmuk Headline-medium-r-normal--0-0-0-0-c-0-iso10646-1

and check ARIAL.TTF again:

ARIAL.TTF -monotype-Arial-medium-r-normal--0-0-0-0-p-0-iso8859-1
ARIAL.TTF -monotype-Arial-medium-r-normal--0-0-0-0-p-0-iso8859-15
ARIAL.TTF -monotype-Arial-medium-r-normal--0-0-0-0-p-0-microsoft-cp1252
ARIAL.TTF -monotype-Arial-medium-r-normal--0-0-0-0-p-0-iso10646-1

Well, looks fine. :) This patch is ugly but maybe it is a start point.

Sorry for such long descriptions!

Rui-Xiang Guo @XFree86.Org

Font editor for TTF fonts? 

Newsgroups:  comp.os.linux.misc
Date:        Fri, 14 Nov 2003 16:20:04 -0500
> does anyone know of a good TTF font editor on Linux?

The only outline font editor for Linux I know about is PfaEdit (http://pfaedit.sourceforge.net). It handles TrueType, PostScript Type 1, and various other formats. I'm not a font designer, and so I can't say whether or not PfaEdit really qualifies as "good" or not. It's been more than adequate for my own limited needs, though (mostly converting between formats and fixing font name problems).

Rod Smith

Font editor for TTF fonts? 

pfaedit.

Supports both TTF and Type1 — even Chinese and Unicode ones.

Lee Sau Dan