diff -urN freetype/contrib/ttf2pk.orig/newobj.c freetype/contrib/ttf2pk/newobj.c --- freetype/contrib/ttf2pk.orig/newobj.c Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/newobj.c Tue Jan 1 08:08:32 2002 @@ -304,6 +304,8 @@ fnt->sawligkern = False; fnt->subfont_ligs = False; + fnt->ligname = NULL; + fnt->write_enc = False; fnt->charlist = NULL; diff -urN freetype/contrib/ttf2pk.orig/subfont.c freetype/contrib/ttf2pk/subfont.c --- freetype/contrib/ttf2pk.orig/subfont.c Mon Oct 8 18:39:46 2001 +++ freetype/contrib/ttf2pk/subfont.c Mon Jan 7 12:27:08 2002 @@ -30,10 +30,14 @@ FILE *file; }; -static realsubfont *real_sfd_name = NULL; +static realsubfont *real_sfd_name = NULL, *real_lig_name = NULL; +static realsubfont * +really_init_sfd(char *name, Boolean fatal); static Boolean really_get_sfd(Font *fnt, Boolean next, realsubfont *rsf); +static void +really_close_sfd(realsubfont *real_name); /* @@ -47,19 +51,30 @@ Boolean init_sfd(Font *fnt, Boolean fatal) { + real_sfd_name = really_init_sfd(fnt->sfdname, fatal); + if (fnt->ligname) + real_lig_name = really_init_sfd(fnt->ligname, fatal); + + return (real_sfd_name ? True : False); +} + + +static realsubfont * +really_init_sfd(char *name, Boolean fatal) +{ char *sf; char *buf, *p, *q; - realsubfont *rsf, *temp; + realsubfont *rsf, *temp, *real_name = NULL; - buf = newstring(fnt->sfdname); + buf = newstring(name); p = buf; while (1) { if (*p == '\0') { - if (real_sfd_name) + if (real_name) break; else { @@ -68,7 +83,7 @@ else { warning("No subfont definition file."); - return False; + return NULL; } } } @@ -92,7 +107,7 @@ else { warning("Cannot find subfont definition file `%s'.", sf); - return False; + return NULL; } } @@ -104,12 +119,12 @@ else { warning("Cannot open subfont definition file `%s'.", rsf->name); - return False; + return NULL; } } - rsf->next = real_sfd_name; - real_sfd_name = rsf; + rsf->next = real_name; + real_name = rsf; free(sf); } @@ -119,16 +134,16 @@ /* reverse list */ rsf = NULL; - while (real_sfd_name) + while (real_name) { - temp = real_sfd_name; - real_sfd_name = real_sfd_name->next; + temp = real_name; + real_name = real_name->next; temp->next = rsf; rsf = temp; } - real_sfd_name = rsf; + real_name = rsf; - return True; + return real_name; } @@ -145,9 +160,12 @@ * The subset parser was inspired by ttf2bdf.c . */ -Boolean get_sfd(Font *fnt) +Boolean get_sfd(Font *fnt, Boolean is_sfd) { - return really_get_sfd(fnt, False, NULL); + if (is_sfd) + return really_get_sfd(fnt, False, real_sfd_name); + else + return really_get_sfd(fnt, False, real_lig_name); } @@ -157,7 +175,6 @@ long i, offset; long begin, end = -1; char *buffer, *oldbuffer, *bufp, *bufp2, *bufp3; - realsubfont *next_rsf; if (next) @@ -168,10 +185,9 @@ again: - buffer = get_line(next ? rsf->file : real_sfd_name->file); + buffer = get_line(rsf->file); if (!buffer) - oops("Error reading subfont definition file `%s'.", - next ? rsf->name : real_sfd_name->name); + oops("Error reading subfont definition file `%s'.", rsf->name); if (!*buffer) return False; @@ -211,8 +227,7 @@ bufp++; if (*bufp == '\0') - oops("Invalid subfont entry in `%s'.", - next ? rsf->name : real_sfd_name->name); + oops("Invalid subfont entry in `%s'.", rsf->name); if (next) { @@ -293,15 +308,8 @@ free(oldbuffer); if (!next) - { - next_rsf = real_sfd_name->next; - - while (next_rsf) - { - (void)really_get_sfd(fnt, True, next_rsf); - next_rsf = next_rsf->next; - } - } + while (rsf = rsf->next) + (void)really_get_sfd(fnt, True, rsf); return True; } @@ -310,18 +318,26 @@ void close_sfd(void) { + really_close_sfd(real_sfd_name); + really_close_sfd(real_lig_name); +} + + +static void +really_close_sfd(realsubfont *real_name) +{ realsubfont *rsf; - while (real_sfd_name) + while (real_name) { - if (real_sfd_name->file) - fclose(real_sfd_name->file); - if (real_sfd_name->name) - free(real_sfd_name->name); + if (real_name->file) + fclose(real_name->file); + if (real_name->name) + free(real_name->name); - rsf = real_sfd_name; - real_sfd_name = real_sfd_name->next; + rsf = real_name; + real_name = real_name->next; free(rsf); } } diff -urN freetype/contrib/ttf2pk.orig/subfont.h freetype/contrib/ttf2pk/subfont.h --- freetype/contrib/ttf2pk.orig/subfont.h Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/subfont.h Mon Jan 7 11:07:40 2002 @@ -15,7 +15,7 @@ Boolean init_sfd(Font *fnt, Boolean fatal); -Boolean get_sfd(Font *fnt); +Boolean get_sfd(Font *fnt, Boolean is_sfd); void close_sfd(void); void handle_sfd(char *s, int *sfd_begin, int *postfix_begin); diff -urN freetype/contrib/ttf2pk.orig/tfmaux.c freetype/contrib/ttf2pk/tfmaux.c --- freetype/contrib/ttf2pk.orig/tfmaux.c Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/tfmaux.c Wed Jan 2 07:00:42 2002 @@ -291,18 +291,29 @@ if (fnt->subfont_ligs) { - for (i = 0; i < 256; i++) + if (fnt->ligname) { - ti = fnt->inencptrs[i]; - if (ti) + for (i = 0; i < 256; i++) { - sf_array[i].sf_code = ti->charcode; - sf_array[i].position = i; + sf_array[i].sf_code = fnt->sf_code[i]; + sf_array[i].position = (fnt->sf_code[i] == -1 ? -1 : i); } - else + } + else + { + for (i = 0; i < 256; i++) { - sf_array[i].sf_code = -1; - sf_array[i].position = -1; + ti = fnt->inencptrs[i]; + if (ti) + { + sf_array[i].sf_code = ti->charcode; + sf_array[i].position = i; + } + else + { + sf_array[i].sf_code = -1; + sf_array[i].position = -1; + } } } /* we sort the subfont character codes before we build a ligkern list */ @@ -572,6 +583,52 @@ writearr(tparam, np, out); free(header); + fclose(out); +} + + +void +writeenc(Font *fnt) +{ + FILE *out; + char *enc_name; + int i, len = 0; + + + if (fnt->tfm_path) + len += strlen(fnt->tfm_path); + len += strlen(fnt->fullname); + len += 5; /* ".enc" + 1 */ + + enc_name = (char *)mymalloc(len); + enc_name[0] = '\0'; + if (fnt->tfm_path) + strcat(enc_name, fnt->tfm_path); + strcat(enc_name, fnt->fullname); + strcat(enc_name, ".enc"); + + if ((out = fopen(enc_name, "wb")) == NULL) + oops("Cannot open enc file `%s'.", enc_name); + + free(enc_name); + + fprintf(out, "/%sEncoding [", fnt->fullname); + for (i = 0; i < 256; i++) + { + if (i % 4 == 0) + fputc('\n', out); + if (fnt->inencptrs[i] == NULL) + fputs("/.notdef ", out); + else if (strcmp(fnt->inencptrs[i]->adobename, ".notdef") == 0 || + strcmp(fnt->inencptrs[i]->adobename, ".null") == 0 || + strcmp(fnt->inencptrs[i]->adobename, ".nonmarkingreturn") == 0 || + strcmp(fnt->inencptrs[i]->adobename, ".dummy") == 0) + fputs("/.notdef ", out); + else + fprintf(out, "/index0x%04X ", fnt->inencptrs[i]->glyphindex); + } + fputs("\n] def", out); + fclose(out); } diff -urN freetype/contrib/ttf2pk.orig/tfmaux.h freetype/contrib/ttf2pk/tfmaux.h --- freetype/contrib/ttf2pk.orig/tfmaux.h Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/tfmaux.h Tue Jan 1 08:15:52 2002 @@ -21,6 +21,7 @@ int buildtfm(Font *fnt); void writetfm(Font *fnt); +void writeenc(Font *fnt); #endif /* TFMAUX_H */ diff -urN freetype/contrib/ttf2pk.orig/ttf2pk.1 freetype/contrib/ttf2pk/ttf2pk.1 --- freetype/contrib/ttf2pk.orig/ttf2pk.1 Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/ttf2pk.1 Wed Jan 2 14:02:22 2002 @@ -73,9 +73,12 @@ file; the created font can then be used with \*(TX or \*(LX. .PP -All TrueType fonts to be used must be registered in a configuration -file called -.C \%ttfonts.map ; +All TrueType fonts to be used must be registered in a map file +recorded in the configuration file called +.C \%ttf2pk.cfg +(if the configuration file is not found, +.C \%ttfonts.map +will be used by default); it specifies how to handle each font. CJKV (Chinese/Japanese/Korean/old Vietnamese) subfonts as created by .B ttf2tfm @@ -107,17 +110,20 @@ Test for the existence of .IR \%font-name . Returns 0 on success and prints out the corresponding line in -.C \%ttfonts.map -(provided the +a map file (default: +.C \%ttfonts.map ) +provided the .B -q -switch isn't set). +switch isn't set. .TP .I font-name The \*(TX name of the font. .B ttf2pk -looks this name up in a configuration file called -.C \%ttfonts.map +looks this name up in a map file (default: +.C \%ttfonts.map ) +recorded in the configuration file called +.C \%ttf2pk.cfg for further information how to process the font. .TP .I resolution @@ -144,15 +150,17 @@ .B ttf2pk uses, similar to .BR dvips , -a font definition file called -.C \%ttfonts.map . +a font definition file which name is recorded in the configuration file called +.C \%ttf2pk.cfg +(if the configuration file is not found, +.C \%ttfonts.map +will be used by default). The parameters specified to .B ttf2tfm are here preserved\(em\c .B ttf2tfm writes out to standard output, as the last line, a proper -configuration entry for -.C \%ttfonts.map . +configuration entry for a map file. .PP As an example, a call to .PP @@ -174,9 +182,7 @@ .PP Here a table listing the various .B ttf2tfm -parameters and the corresponding -.C \%ttfonts.map -entries: +parameters and the corresponding entries in a map file: .PP .in +4m .ta 2i @@ -211,9 +217,7 @@ .IR old-glyphname = new-glyphname '. They will be ignored if in subfont mode or if no encoding file is given. .PP -One additional parameter in -.C \%ttfonts.map -is unique to +One additional parameter in a map file is unique to .BR ttf2pk : `Hinting', which can take the values `On' or `Off'. Some fonts (e.g.\ the CJK part of @@ -229,9 +233,7 @@ please refer to .BR ttf2tfm (1). .PP -The format of -.C \%ttfonts.map -is simple. +The format of map files is simple. Each line defines a font; first comes the \*(TX font name, then its TrueType font file name, followed by the parameters in any order. @@ -239,9 +241,7 @@ separated from its values by an equal sign, with whitespace possibly surrounding it. .B ttf2pk -reads in -.C \%ttfonts.map -line by line, continuing until the \*(TX +reads in a map file line by line, continuing until the \*(TX font specified on the command line is found, otherwise the programs exits with error code\ 2. Thus you can use any character invalid in a \*(TX @@ -260,8 +260,7 @@ .SH "RETURN VALUE" If the call was successful, 0\ will be returned. In case of error, the return value is\ 1. -Finally, if the font can't be found in -.C \%ttfonts.map , +Finally, if the font can't be found in all map files, 2\ is returned. This simplifies the inclusion of .B ttf2pk diff -urN freetype/contrib/ttf2pk.orig/ttf2pk.c freetype/contrib/ttf2pk/ttf2pk.c --- freetype/contrib/ttf2pk.orig/ttf2pk.c Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/ttf2pk.c Mon Jan 7 13:13:36 2002 @@ -30,6 +30,8 @@ char ident[] = "ttf2pk version 1.4"; char progname[] = "ttf2pk"; /* for error/warning messages */ +static char *cfg_filename = "ttf2pk.cfg"; +char *mapfiles; Boolean have_sfd = False; Boolean have_pid = False; @@ -171,7 +173,7 @@ { value = -1; - while (get_sfd(fnt)) + while (get_sfd(fnt, True)) { if (!strcmp(fnt->subfont_name, temp1)) { @@ -196,21 +198,97 @@ } +static void +add_mapfile(char *p) +{ + char *q; + + if (*p != '+') /* if the fist character is not '+' reset mapfiles */ + { + if (mapfiles != 0) + { + free(mapfiles); + mapfiles = 0; + } + } + else + while (isspace(*++p)); + for (q = p; *q != 0 && !isspace(*q); q++); + *q = '\n'; /* '\n' is the splitting character */ + if (mapfiles == 0) + { + mapfiles = (char *)malloc((q - p + 2) * sizeof(char)); + *mapfiles = '\0'; + } + else + mapfiles = (char *)realloc(mapfiles, + (strlen(mapfiles) + q - p + 2) * sizeof(char *)); + strncat(mapfiles, p, (unsigned)(q - p)); + strcat(mapfiles, "\n"); +} + + +static void +read_config_file(Boolean quiet) +{ + FILE *config_file; + char *p, *configline, *real_cfg_filename; + + + real_cfg_filename = TeX_search_config_file(&cfg_filename); + if (real_cfg_filename) + { + config_file = fopen(real_cfg_filename, "rt"); + if (config_file != NULL) + { + for (;;) + { + if (!(configline = get_line(config_file))) + oops("Error while reading %s.", cfg_filename); + if (!*configline) + break; + p = configline; + while (isspace(*p)) + p++; + if (*p == '*' || *p == '#' || *p == ';' || *p == '%') /* ignore comments */ + continue; + if (strlen(p) > 4 && strncmp(p, "map", 3) == 0) + { + p+=3; /* move by the size of "map" */ + while (isspace(*p)) + p++; + if (*p) + add_mapfile(p); + } + } + fclose(config_file); + } + else if (!quiet) + warning("Cannot open file %s.", cfg_filename); + } + else if (!quiet) + warning("Cannot find file %s. Use ttfonts.map instead.", cfg_filename); + + if (mapfiles == 0) + mapfiles = newstring("ttfonts.map\n"); +} + + int main(int argc, char** argv) { size_t l; unsigned int i; long index, code; - FILE *config_file; + FILE *map_file; char *configline, *oldconfigline, *p, *q; Font font; encoding *enc; long inenc_array[256]; char *fontname; size_t fontname_len; - char *pk_filename, *tfm_filename, *enc_filename, *cfg_filename; - char *real_ttfname, *real_cfg_filename; + char *pk_filename, *tfm_filename, *enc_filename, *map_filename; + char *real_ttfname, *real_map_filename; int dpi = 0, ptsize; Boolean hinting = True; Boolean quiet = False; @@ -273,36 +351,59 @@ init_font_structure(&font); - cfg_filename = newstring("ttfonts.map"); - real_cfg_filename = TeX_search_config_file(&cfg_filename); - if (!real_cfg_filename) - oops("Cannot find file ttfonts.map."); + mapfiles = 0; + read_config_file(quiet); - config_file = fopen(real_cfg_filename, "rt"); - if (config_file == NULL) - oops("Cannot open file ttfonts.map."); - - do + p = mapfiles; + while (*p != 0) { - configline = get_line(config_file); - if (!configline) - oops("Error while reading ttfonts.map."); - if (!*configline) + map_filename = p; + while (*p != '\n') p++; + *p++ = '\0'; + + real_map_filename = TeX_search_config_file(&map_filename); + if (!real_map_filename) { - /* - * This is the only error message we suppress if the -q flag - * is set, making it possible to call ttf2pk silently. - */ if (!quiet) - fprintf(stdout, - "%s: ERROR: Cannot find font %s in ttfonts.map.\n", - progname, fontname); - exit(2); + warning("Cannot find file %s.", map_filename); + continue; } - } while (compare(&font, configline, fontname)); - fclose(config_file); + map_file = fopen(real_map_filename, "rt"); + if (map_file == NULL) + { + if (!quiet) + warning("Cannot open file %s.", map_filename); + continue; + } + + for (;;) + { + if (!(configline = get_line(map_file))) + oops("Error while reading %s.", map_filename); + if (!*configline) + break; + if (compare(&font, configline, fontname) == 0) + { + fclose(map_file); + goto font_found; + } + } + + fclose(map_file); + } + + /* + * This is the only error message we suppress if the -q flag + * is set, making it possible to call ttf2pk silently. + */ + if (!quiet) + fprintf(stdout, + "%s: ERROR: Cannot find font %s in the map files.\n", + progname, fontname); + exit(2); +font_found: if (testing) { if (!quiet) diff -urN freetype/contrib/ttf2pk.orig/ttf2pk.doc freetype/contrib/ttf2pk/ttf2pk.doc --- freetype/contrib/ttf2pk.orig/ttf2pk.doc Mon Oct 8 18:39:46 2001 +++ freetype/contrib/ttf2pk/ttf2pk.doc Wed Jan 2 14:16:28 2002 @@ -45,6 +45,7 @@ -E INT select INT as the TTF encoding ID [1] -f INT select INT as the font index in a TTC [0] -l create 1st/2nd byte ligatures in subfonts +-L SFDFILE[.sfd] create 1st/2nd byte ligatures in subfonts with LIGFILE -n use PS names of TrueType font -N use only PS names and no cmap -O use octal for all character codes in the vpl file @@ -59,6 +60,7 @@ -u output only characters from encodings, nothing extra -v FILE[.vpl] make a VPL file for conversion to VF -V SCFILE[.vpl] like -v, but synthesize smallcaps as lowercase +-w generate encoding vectors containing glyph indices -x rotate subfont glyphs by 90 degrees -y REAL move rotated glyphs down by a factor of REAL [0.25] --help print this message and exit @@ -164,20 +166,20 @@ IDs are for Asian specific MS Windows versions). The `-P' and `-E' options to ttf2tfm must be equally specified for -ttf2pk; the corresponding parameters in ttfonts.map are `Pid' and -`Eid', respectively. +ttf2pk; the corresponding parameters in a map file (default: +ttfonts.map) are `Pid' and `Eid', respectively. The default pid/eid pair is (3,1). If you use the `-N' switch, all cmaps are ignored, using only the PostScript names in the TrueType font. The corresponding option in -ttfonts.map is `PS=Only'. +a map file (default: ttfonts.map) is `PS=Only'. If you use the `-n' switch, the default glyph names built into ttf2tfm are replaced with the PS glyph names found in the font. In many cases this is not what you want because the glyph names in the font are often incorrect or non-standard. The corresponding option in -ttfonts.map `PS=Yes'. +a map file (default: ttfonts.map) is `PS=Yes'. input and output encodings @@ -221,7 +223,7 @@ The `-r' and `-R' switches are ignored for subfonts or if no encoding tables are specified. For ttf2pk, the corresponding option to `-R' is `Replacement'. Single replacements are directly given as -old_glyphname=newglyphname in ttfonts.map. +old_glyphname=newglyphname in a map file (default: ttfonts.map). For pid/eid pairs (1,0) and (3,1), both ttf2tfm and ttf2pk recognize built-in default Adobe glyph names; the former pair follows the names @@ -323,26 +325,29 @@ --version print version number and exit -The FONT parameter must correspond to an entry in the file ttfonts.map -(see below for details), otherwise error code 2 is returned -- this -can be used for scripts like mktexpk to test whether the given font -name is a (registered) TrueType font. +The FONT parameter must correspond to an entry in a map file recorded +in the configuration file ttf2pk.cfg (see below for details), +otherwise error code 2 is returned -- this can be used for scripts +like mktexpk to test whether the given font name is a (registered) +TrueType font. Another possibility is to use the `-t' switch which will print the -line of ttfonts.map corresponding to FONT and return 0 on success -(`-q' suppresses any output). +line of a map file (default: ttfonts.map) corresponding to FONT and +return 0 on success (`-q' suppresses any output). DPI specifies the intended resolution (we always assume a design size of 10pt). -ttfonts.map ------------ +ttf2pk.cfg +---------- -ttf2pk uses, similar to dvips, a font definition file called -ttfonts.map. The parameters specified to ttf2tfm are here preserved +ttf2pk uses, similar to dvips, a font definition file recorded +in the configuration file called ttf2pk.cfg (if the configuration file +is not found, ttfonts.map will be used by default). The parameters +specified to ttf2tfm are here preserved -- ttf2tfm writes out to standard output, as the last line, a proper -configuration entry for ttfonts.map. +configuration entry for a map file. As an example, a call to @@ -359,7 +364,7 @@ holds). Here a table listing the various ttf2tfm parameters and its -corresponding ttfonts.map entries: +corresponding entries in a map file: -s Slant -e Extend @@ -377,23 +382,23 @@ are directly specified with old-glyphname=new-glyphname. For subfonts or if no encoding file is given, replacement glyphs are ignored. -One additional parameter in ttfonts.map is unique to ttf2pk: +One additional parameter in a map file is unique to ttf2pk: `Hinting', which can take the values `On' or `Off'. Some fonts (e.g. the CJK part of cyberbit.ttf) are rendered incorrectly if hinting is activated. Default is `On' (you can also use `Yes', `No', `1', and `0'). -The format of ttfonts.map is simple. Each line defines a font; first +The format of map files is simple. Each line defines a font; first comes the TeX font name, then its TrueType font file name, followed by the parameters in any order. Case is significant (even for parameter names); the parameters are separated from its values by an equal sign, -with possible whitespace surrounding it. ttf2pk reads in ttfonts.map +with possible whitespace surrounding it. ttf2pk reads in a map file line by line, continuing until the TeX font specified on the command line is found, otherwise the programs exits with error code 2. Thus you can use any character invalid in a TeX font name to start a comment line. -In both ttfonts.map and encoding files, use `\' as the final character +In both map files and encoding files, use `\' as the final character of a line to indicate that the input is continued on the next line. The backslash and the following newline character will be removed. @@ -451,8 +456,8 @@ You have to embed the SFD file into the TFM font name (at the place where the infix will appear) surrounded by two `@' signs, on the -command line resp. the ttfonts.map file; both ttf2tfm and ttf2pk -switch then to subfont mode. +command line resp. a map file; both ttf2tfm and ttf2pk switch then +to subfont mode. It is possible to use more than a single SFD file by separating them with commata and no whitespace; for a given subfont, the first file is @@ -465,7 +470,7 @@ Subfont mode disables the options `-n', `-N', `-p', `-r', `-R', `-t', `-T', `-u', `-v', and `-V' for ttf2tfm; similarly, no `Encoding' and `Replacement' parameter resp. single replacement glyph names are -allowed in ttfonts.map. +allowed in a map file. ttf2tfm will create ALL subfont TFM files specified in the SFD files (provided the subfont contains glyphs) in one run. @@ -517,7 +522,8 @@ environment variables introduced in kpathsea version 3.2: .ttf and .ttc TTFONTS - ttfonts.map TTF2PKINPUTS + ttf2pk.cfg TTF2PKINPUTS + .map TTF2PKINPUTS .enc TTF2PKINPUTS, TTF2TFMINPUTS .rpl TTF2PKINPUTS, TTF2TFMINPUTS .tfm TFMFONTS @@ -526,7 +532,8 @@ And here the same for pre-3.2-versions of kpathsea: .ttf and .ttc T1FONTS - ttfonts.map TEXCONFIG + ttf2pk.cfg TEXCONFIG + .map TEXCONFIG .enc TEXPSHEADERS .rpl TEXPSHEADERS .tfm TFMFONTS @@ -535,7 +542,8 @@ Finally, the same for pre-3.0-versions: .ttf and .ttc DVIPSHEADERS - ttfonts.map TEXCONFIG + ttf2pk.cfg TEXCONFIG + .map TEXCONFIG .enc DVIPSHEADERS .rpl DVIPSHEADERS .tfm TFMFONTS @@ -588,7 +596,8 @@ set in autoexec.bat (resp. in config.sys for OS/2): .ttf and .ttc TTFONTS - ttfonts.map TTFCFG + ttf2pk.cfg TTFCFG + .map TTFCFG .enc TTFCFG .rpl TTFCFG .tfm TEXTFM @@ -714,8 +723,8 @@ glyphs. The last line written to stdout by ttf2tfm is a suitable entry for - ttfonts.map -- since ttf2pk doesn't care about virtual fonts, both - calls below produce the same. + a map file (default: ttfonts.map) -- since ttf2pk doesn't care about + virtual fonts, both calls below produce the same. Now just repeat this procedure. For slanted fonts you should additionally use the switch `-s 0.176' (of course you can change the diff -urN freetype/contrib/ttf2pk.orig/ttf2tfm.1 freetype/contrib/ttf2pk/ttf2tfm.1 --- freetype/contrib/ttf2pk.orig/ttf2tfm.1 Mon Oct 8 18:39:46 2001 +++ freetype/contrib/ttf2pk/ttf2tfm.1 Wed Jan 2 13:53:10 2002 @@ -25,6 +25,10 @@ .B -l\c ] [\c +.B -L\ \c +.IR \%ligature-file [ .sfd ]\c +] +[\c .B -n\c ] [\c @@ -73,6 +77,9 @@ .IR \%scvplfile [ .vpl ]\c ] [\c +.B -w\c +] +[\c .B -x\c ] [\c @@ -218,9 +225,21 @@ Then a ligature in subfont\ 45 between position 0xAB and\ 0xCD pointing to character\ 123 will be produced. The fonts of the Korean H\*(LX -package use this feature. +package use this feature. Note that this option generates correct ligatures +only for the TrueType fonts with the platform ID 3 and the encoding ID 5. Will be ignored if not in subfont mode. .TP +.BI -L \ ligature-file +Same as +.BR -l , +but the character codes for ligatures are specified by +.I \%ligature-file. +In particular, +.BR -L \ KS-HLaTeX +generates correct ligatures for the Korean H\*(LX +package regardless of the platform ID and the encoding ID of the given +TrueType fonts. +.TP .B -n Use PS names (of glyphs) of the TrueType font. Will be ignored in subfont mode. @@ -244,8 +263,11 @@ .BI -p \ inencfile The input encoding file name for the TTF\(->raw\ \*(TX mapping. -This parameter has to be specified in -.C \%ttfonts.map +This parameter has to be specified in a map file +(default: +.C \%ttfonts.map ) +recorded in +.C \%ttf2pk.cfg for successive .B ttf2pk calls. @@ -349,6 +371,11 @@ This font handles accented letters and retains proper kerning. Will be ignored in subfont mode. .TP +.B -w +Generate encoding vectors containing glyph indices, primary used +to embed TrueType fonts in pdf\*(TX. +Will be ignored if not in subfont mode. +.TP .B -x Rotate all glyphs by 90 degrees counter-clockwise. If no @@ -550,23 +577,23 @@ .B ttf2tfm must be equally specified for .BR ttf2pk ; -the corresponding parameters in -.C \%ttfonts.map +the corresponding parameters in a map file (default: +.C \%ttfonts.map ) are `Pid' and `Eid', respectively. .PP The default pid/eid pair is (3,1). .PP Similarly, an .B -f -option must be specified as `Fontindex' parameter in -.C \%ttfonts.map . +option must be specified as `Fontindex' parameter in a map file (default: +.C \%ttfonts.map ). .PP If you use the .B -N switch, all cmaps are ignored, using only the PostScript names in the TrueType font. -The corresponding option in -.C \%ttfonts.map +The corresponding option in a map file (default: +.C \%ttfonts.map ) is \%`PS=Only'. If you use the .B -n @@ -575,16 +602,16 @@ are replaced with the PS glyph names found in the font. In many cases this is not what you want because the glyph names in the font are often incorrect or non-standard. -The corresponding option in -.C \%ttfonts.map +The corresponding option in a map file (default: +.C \%ttfonts.map ) is \%`PS=Yes'. .PP Single replacement glyph names specified with .B -r must be given directly as `\c .IR "old-glyphname new-glyphname" ' -in -.C \%ttfonts.map ; +in a map file (default: +.C \%ttfonts.map ); .B -R is equivalent to the `Replacement' option. . @@ -795,9 +822,9 @@ file name into the .C TFM font name (at the place where the infix will appear) surrounded by two -`@' signs, on the command line resp.\ the -.C \%ttfonts.map -file; both +`@' signs, on the command line resp.\ a map file (default: +.C \%ttfonts.map ); +both .B ttf2tfm and .B ttf2pk @@ -825,7 +852,8 @@ for .BR ttf2tfm ; similarly, no `Encoding' or `Replacement' parameter is allowed in -.C \%ttfonts.map . +a map file (default: +.C \%ttfonts.map ). Single replacement glyph names are ignored too. .PP .B ttf2tfm @@ -915,7 +943,9 @@ .ta 2i .C \&.ttf \ and "\ .ttc TTFONTS" .br -.C "ttfonts.map TTF2PKINPUTS" +.C "ttf2pk.cfg TTF2PKINPUTS" +.br +.C "\&.map TTF2PKINPUTS" .br .C "\&.enc TTF2PKINPUTS, TTF2TFMINPUTS" .br @@ -932,7 +962,9 @@ .ta 2i .C \&.ttf \ and "\ .ttc T1FONTS" .br -.C "ttfonts.map TEXCONFIG" +.C "ttf2pk.cfg TEXCONFIG" +.br +.C "\&.map TEXCONFIG" .br .C "\&.enc TEXPSHEADERS" .br @@ -948,7 +980,9 @@ .ta 2i .C \&.ttf \ and "\ .ttc DVIPSHEADERS" .br -.C "ttfonts.map TEXCONFIG" +.C "ttf2pk.cfg TEXCONFIG" +.br +.C "\&.map TEXCONFIG" .br .C "\&.enc DVIPSHEADERS" .br @@ -1018,7 +1052,9 @@ .ta 2i .C \&.ttf \ and "\ .ttc TTFONTS" .br -.C "ttfonts.map TTFCFG" +.C "ttf2pk.cfg TTFCFG" +.br +.C "\&.map TTFCFG" .br .C "\&.enc TTFCFG" .br diff -urN freetype/contrib/ttf2pk.orig/ttf2tfm.c freetype/contrib/ttf2pk/ttf2tfm.c --- freetype/contrib/ttf2pk.orig/ttf2tfm.c Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/ttf2tfm.c Mon Jan 7 13:14:00 2002 @@ -265,6 +265,7 @@ -E INT select INT as the TTF encoding ID [1]\n\ -f INT select INT as the font index in a TTC [0]\n\ -l create 1st/2nd byte ligatures in subfonts\n\ +-L LIGFILE[.sfd] create 1st/2nd byte ligatures in subfonts with LIGFILE\n\ -n use PS names of TrueType font\n\ -N use only PS names and no cmap\n\ -O use octal for all character codes in the vpl file\n\ @@ -279,6 +280,7 @@ -u output only characters from encodings, nothing extra\n\ -v FILE[.vpl] make a VPL file for conversion to VF\n\ -V SCFILE[.vpl] like -v, but synthesize smallcaps as lowercase\n\ +-w generate encoding vectors containing glyph indices\n\ -x rotate subfont glyphs by 90 degrees\n\ -y REAL move rotated glyphs down by a factor of REAL [0.25]\n\ --help print this message and exit\n\ @@ -498,11 +500,25 @@ arginc = 1; break; + case 'L': + if (argc <= 3) + oops("Missing parameter for -L option."); + if (fnt->ligname) + free(fnt->ligname); + fnt->ligname = newstring(argv[3]); + fnt->subfont_ligs = True; + break; + case 'l': fnt->subfont_ligs = True; arginc = 1; break; + case 'w': + fnt->write_enc = True; + arginc = 1; + break; + case 'x': fnt->rotate = True; arginc = 1; @@ -683,6 +699,12 @@ fnt->rotate = False; } + if (fnt->write_enc) + { + warning("Ignoring `-w' switch for non-subfont."); + fnt->write_enc = False; + } + if (fnt->y_offsetparam) warning("Ignoring `-y' switch for non-subfont."); } @@ -793,7 +815,7 @@ if (font.sfdname) { - while (get_sfd(&font)) + while (get_sfd(&font, True)) { char *temp; int i, start, end, len; @@ -840,8 +862,15 @@ else font.fontspace = transform(500, 0, font.efactor, font.slant); + if (font.ligname) + get_sfd(&font, False); /* read sfd files for ligatures */ + if (buildtfm(&font)) + { writetfm(&font); + if (font.write_enc) + writeenc(&font); + } } close_sfd(); diff -urN freetype/contrib/ttf2pk.orig/ttf2tfm.h freetype/contrib/ttf2pk/ttf2tfm.h --- freetype/contrib/ttf2pk.orig/ttf2tfm.h Sat Apr 15 02:53:50 2000 +++ freetype/contrib/ttf2pk/ttf2tfm.h Mon Jan 7 13:10:34 2002 @@ -173,6 +173,10 @@ output encoding file */ Boolean subfont_ligs; /* ligatures 1st byte/2nd byte in subfonts wanted */ + char *ligname; /* ligatures 1st byte/2nd byte in + subfonts with ligaturename */ + Boolean write_enc; /* generate encoding vectors + containing glyph indices wanted */ ttfinfo *charlist; /* a linked list of all valid chars */