# Generate CJK subfonts from master font. # The fonts are created in the current directory. # # $1: The master font (e.g., `bsmi00lp.ttf'). # $2: The name stem for the subfonts (e.g., `bsmilp'). # $3: The subfont definition file (e.g., `UBig5.sfd'). if ($argc != 4) Print("usage: [fontforge -script] ", $0, " master-font name-stem SFD-file"); Quit(1); endif; Print("Loading ", $1, "..."); Open($1); copyright = $copyright \ + Chr(10) + Chr(10) \ + "Subfont version 2005-07-01."; SetFontNames("", "", "", "", copyright, ""); Print("Ensure third order curves..."); SetFontOrder(3); Print("Scaling to PostScript units..."); ScaleToEm(900, 100); num_chars = CharCnt(); count = 0; delta = 100; while (count + delta < num_chars) Print(count, "/", num_chars - 1, ":"); Select(count, count + delta); Print(" Add extrema..."); AddExtrema(); Print(" Simplifying outlines..."); Simplify(0, 2); count += delta; endloop; Print(count, "/", num_chars - 1, ":"); Select(count, num_chars - 1); Print(" Add extrema..."); AddExtrema(); Print(" Simplifying outlines..."); Simplify(0, 2); SelectAll(); # generate AFM and TFM files, no PS hints, and rounded PS coordinates Print("Generating subfonts..."); Generate($2 + "%s.pfb", "", \ 0x1 | 0x100 | 0x10000 | 0x80000 | 0x200000, \ -1, $3); Quit(0);