diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-09-18 17:55:36 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-09-18 17:55:36 +0000 |
commit | e3167f2329da4174fd1332e069788693de96b72a (patch) | |
tree | 39ca6dd621ecfbbec729afb0354cb1e023e903de | |
parent | cf6f2edfb33cb21fb49e4c182f43aab5e031f80a (diff) |
ttf2pk: Adapt to W32TeX (from Akira)
Extend the test to cover vert feature from GSUB table
git-svn-id: svn://tug.org/texlive/trunk@27715 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/ttf2pk/ChangeLog | 28 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/Makefile.am | 7 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/Makefile.in | 8 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/ligkern.c | 2 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/newobj.c | 8 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/subfont.c | 12 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/tests/Test.sfd | 7 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/tests/ipaexg-h.map | 1 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/tests/ipaexg-v.map | 1 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/tests/ipaexg.ttf | bin | 0 -> 6022748 bytes | |||
-rw-r--r-- | Build/source/texk/ttf2pk/tests/ttf2pk.cfg | 2 | ||||
-rwxr-xr-x | Build/source/texk/ttf2pk/tests/ttf2pk.test | 26 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/tfmaux.c | 8 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/ttf2tfm.c | 77 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/ttf2tfm.h | 17 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/ttfaux.c | 37 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/vplaux.c | 113 | ||||
-rw-r--r-- | Build/source/texk/ttf2pk/vplaux.h | 1 |
18 files changed, 317 insertions, 38 deletions
diff --git a/Build/source/texk/ttf2pk/ChangeLog b/Build/source/texk/ttf2pk/ChangeLog index 226fc38a2c2..c90d49dae82 100644 --- a/Build/source/texk/ttf2pk/ChangeLog +++ b/Build/source/texk/ttf2pk/ChangeLog @@ -1,3 +1,31 @@ +2012-09-16 Peter Breitenlohner <peb@mppmu.mpg.de> + + * tests/ttf2pk.cfg, tests/ttf2pk.test: Extend the test to cover + vertical glyph presentation forms from GSUB table. + * tests/Test.sfd, tests/ipaexg.ttf, tests/ipaexg-[vh].map: + Additional test input. + * Makefile.am (EXTRA_DIST, DISTCLEANFILES): Adapted. + +2012-09-11 Peter Breitenlohner <peb@mppmu.mpg.de> + + * ttfaux.c (readttf): Fix layout of diagnostic output. + +2012-09-09 Peter Breitenlohner <peb@mppmu.mpg.de> + + Revert parts of ttf2pk.diff.bz2 from ???. + * ligkern.c (checkligkern): This was obviously wrong. + * newobj.c (init_font_structure), ttf2tfm.c (main): Most of this was + never applied for W32TeX. + * ttfaux.c (readttf): Obtain font xheight from OS/2 table. + * ttfaux.c (readttf_kern): Revert to more defensive code. + +2012-09-07 Peter Breitenlohner <peb@mppmu.mpg.de> + + * newobj.c, subfont.c, tfmaux.c, ttf2tfm.[ch], ttfaux.c, + vplaux.[ch]: Apply ttf2pk-1.5-20020430.patch from + http://ftp.ktug.or.kr/pub/ktug/freetype/contrib/ as already done + long ago for W32TeX. + 2012-07-18 Peter Breitenlohner <peb@mppmu.mpg.de> * tfmaux.c, ttf2tfm.c: Use binary mode for output files. diff --git a/Build/source/texk/ttf2pk/Makefile.am b/Build/source/texk/ttf2pk/Makefile.am index dd4731341b5..fbac54d74d6 100644 --- a/Build/source/texk/ttf2pk/Makefile.am +++ b/Build/source/texk/ttf2pk/Makefile.am @@ -1,6 +1,6 @@ ## Makefile.am for the TeX Live subdirectory texk/ttf2pk/ ## -## Copyright (C) 2009, 2011 Peter Breitenlohner <tex-live@tug.org> +## Copyright (C) 2009-2012 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 @@ -100,8 +100,9 @@ TESTS = tests/ttf2pk.test EXTRA_DIST = $(TESTS) ## tests/ttf2pk.test EXTRA_DIST += tests/GenR102.ttf tests/gentium-ec.enc tests/ttf2pk.cfg \ - tests/GenR102-ec.map tests/GenR102-h.map tests/GenR102-v.map -DISTCLEANFILES += GenR-ec.vpl GenR102-* + tests/GenR102-ec.map tests/GenR102-h.map tests/GenR102-v.map \ + tests/Test.sfd tests/ipaexg.ttf tests/ipaexg-h.map tests/ipaexg-v.map +DISTCLEANFILES += GenR-ec.vpl GenR102-* ipaexg-* ## Not used ## diff --git a/Build/source/texk/ttf2pk/Makefile.in b/Build/source/texk/ttf2pk/Makefile.in index cdac2a512bd..299c0e1d3dc 100644 --- a/Build/source/texk/ttf2pk/Makefile.in +++ b/Build/source/texk/ttf2pk/Makefile.in @@ -347,7 +347,7 @@ ttf2tfm_SOURCES = \ vplaux.c \ vplaux.h -DISTCLEANFILES = config.force GenR-ec.vpl GenR102-* +DISTCLEANFILES = config.force GenR-ec.vpl GenR102-* ipaexg-* LDADD = $(KPATHSEA_LIBS) $(FREETYPE_LIBS) dist_man1_MANS = ttf2pk.1 ttf2tfm.1 cfgdatadir = $(datarootdir)/texmf/ttf2pk @@ -375,8 +375,10 @@ dist_sfddata_DATA = \ TESTS = tests/ttf2pk.test EXTRA_DIST = $(TESTS) tests/GenR102.ttf tests/gentium-ec.enc \ tests/ttf2pk.cfg tests/GenR102-ec.map tests/GenR102-h.map \ - tests/GenR102-v.map BUGS MakeSub.in Makefile.dm dvidrv.btm \ - dvidrv.doc emdir.c emdir.h emtexdir.c emtexdir.h ttf2pk.doc + tests/GenR102-v.map tests/Test.sfd tests/ipaexg.ttf \ + tests/ipaexg-h.map tests/ipaexg-v.map BUGS MakeSub.in \ + Makefile.dm dvidrv.btm dvidrv.doc emdir.c emdir.h emtexdir.c \ + emtexdir.h ttf2pk.doc all: c-auto.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/Build/source/texk/ttf2pk/ligkern.c b/Build/source/texk/ttf2pk/ligkern.c index 98f889f7c8b..68c7f4245c2 100644 --- a/Build/source/texk/ttf2pk/ligkern.c +++ b/Build/source/texk/ttf2pk/ligkern.c @@ -212,7 +212,7 @@ checkligkern(char *s, Font *fnt) lig *lig; - if (findadobe(mlist[2], fnt->charlist)) + if (findadobe(mlist[1], fnt->charlist)) /* remove coincident kerns */ rmkern(mlist[0], mlist[1], ti, fnt); diff --git a/Build/source/texk/ttf2pk/newobj.c b/Build/source/texk/ttf2pk/newobj.c index 9be49ed9c2a..3639961c8cd 100644 --- a/Build/source/texk/ttf2pk/newobj.c +++ b/Build/source/texk/ttf2pk/newobj.c @@ -202,6 +202,8 @@ newchar(Font *fnt) ti->dptr = 0; ti->iptr = 0; + ti->fntnum = -1; + fnt->charlist = ti; return ti; @@ -313,6 +315,10 @@ init_font_structure(Font *fnt) fnt->codingscheme = default_codingscheme; fnt->titlebuf = NULL; + fnt->cksum = 0; + fnt->subfont_num = 0; + fnt->subfont_list = NULL; + fnt->units_per_em = 0; fnt->italicangle = 0.0; fnt->fixedpitch = 0; @@ -321,7 +327,7 @@ init_font_structure(Font *fnt) fnt->pid = 3; fnt->eid = 1; - fnt->xheight = 400; + fnt->xheight = 0; fnt->fontspace = 0; fnt->y_offset = 0.25; diff --git a/Build/source/texk/ttf2pk/subfont.c b/Build/source/texk/ttf2pk/subfont.c index c919028dbe3..89619f11e01 100644 --- a/Build/source/texk/ttf2pk/subfont.c +++ b/Build/source/texk/ttf2pk/subfont.c @@ -35,7 +35,7 @@ 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); +really_get_sfd(Font *fnt, Boolean next, realsubfont *rsf, Boolean new_sfd); static void really_close_sfd(realsubfont *real_name); @@ -163,14 +163,14 @@ really_init_sfd(char *name, Boolean fatal) Boolean get_sfd(Font *fnt, Boolean is_sfd) { if (is_sfd) - return really_get_sfd(fnt, False, real_sfd_name); + return really_get_sfd(fnt, False, real_sfd_name, True); else - return really_get_sfd(fnt, False, real_lig_name); + return really_get_sfd(fnt, False, real_lig_name, False); } static Boolean -really_get_sfd(Font *fnt, Boolean next, realsubfont *rsf) +really_get_sfd(Font *fnt, Boolean next, realsubfont *rsf, Boolean new_sfd) { long i, offset; long begin, end = -1; @@ -229,7 +229,7 @@ again: if (*bufp == '\0') oops("Invalid subfont entry in `%s'.", rsf->name); - if (next) + if (next || !new_sfd) { if (strcmp(fnt->subfont_name, buffer)) goto again; @@ -309,7 +309,7 @@ again: if (!next) while ((rsf = rsf->next)) - (void)really_get_sfd(fnt, True, rsf); + (void)really_get_sfd(fnt, True, rsf, new_sfd); return True; } diff --git a/Build/source/texk/ttf2pk/tests/Test.sfd b/Build/source/texk/ttf2pk/tests/Test.sfd new file mode 100644 index 00000000000..fc06d999aac --- /dev/null +++ b/Build/source/texk/ttf2pk/tests/Test.sfd @@ -0,0 +1,7 @@ +# Test.sfd +# +# GID 36->41 37 38 39 40->38 41 42 43 + +03 0x0041_0x0048 + +# eof diff --git a/Build/source/texk/ttf2pk/tests/ipaexg-h.map b/Build/source/texk/ttf2pk/tests/ipaexg-h.map new file mode 100644 index 00000000000..b34a19deaa3 --- /dev/null +++ b/Build/source/texk/ttf2pk/tests/ipaexg-h.map @@ -0,0 +1 @@ +ipaexg-h@Test@ ipaexg diff --git a/Build/source/texk/ttf2pk/tests/ipaexg-v.map b/Build/source/texk/ttf2pk/tests/ipaexg-v.map new file mode 100644 index 00000000000..f94c427ac5b --- /dev/null +++ b/Build/source/texk/ttf2pk/tests/ipaexg-v.map @@ -0,0 +1 @@ +ipaexg-v@Test@ ipaexg Rotate=Yes diff --git a/Build/source/texk/ttf2pk/tests/ipaexg.ttf b/Build/source/texk/ttf2pk/tests/ipaexg.ttf Binary files differnew file mode 100644 index 00000000000..a82b95c1de3 --- /dev/null +++ b/Build/source/texk/ttf2pk/tests/ipaexg.ttf diff --git a/Build/source/texk/ttf2pk/tests/ttf2pk.cfg b/Build/source/texk/ttf2pk/tests/ttf2pk.cfg index 4a61f25f3cc..709b3d0c428 100644 --- a/Build/source/texk/ttf2pk/tests/ttf2pk.cfg +++ b/Build/source/texk/ttf2pk/tests/ttf2pk.cfg @@ -1,3 +1,5 @@ map GenR102-ec map +GenR102-h map +GenR102-v +map +ipaexg-h +map +ipaexg-v diff --git a/Build/source/texk/ttf2pk/tests/ttf2pk.test b/Build/source/texk/ttf2pk/tests/ttf2pk.test index 3dcfc9227dc..b1e23ad5e46 100755 --- a/Build/source/texk/ttf2pk/tests/ttf2pk.test +++ b/Build/source/texk/ttf2pk/tests/ttf2pk.test @@ -1,14 +1,14 @@ #! /bin/sh -# Copyright (C) 2011 Peter Breitenlohner <tex-live@tug.org> +# Copyright (C) 2011, 2012 Peter Breitenlohner <tex-live@tug.org> # You may freely use, modify and/or distribute this file. -rm -f GenR-ec.vpl GenR102-* +rm -f GenR-ec.vpl GenR102-* ipaexg-* TEXMFCNF=$srcdir/../kpathsea TEXFONTS=.:$srcdir/tests TTF2PKINPUTS=$srcdir/tests -SFDFONTS=$srcdir/data +SFDFONTS="$srcdir/data;$srcdir/tests" export TEXMFCNF TEXFONTS TTF2PKINPUTS SFDFONTS @@ -50,3 +50,23 @@ done echo passed GenR102-v test +./ttf2tfm ipaexg -q ipaexg-h@Test@ >ipaexg-h.map || exit 1 +diff $srcdir/tests/ipaexg-h.map ipaexg-h.map || exit 1 + +./ttf2pk -q ipaexg-h03 100 || exit 1 + +tftopl ipaexg-h03 ipaexg-h03 || exit 77 +pktype ipaexg-h03.100pk >ipaexg-h03.typ || exit 77 + +echo passed ipaexg-h test + +./ttf2tfm ipaexg -q -x ipaexg-v@Test@ >ipaexg-v.map || exit 1 +diff $srcdir/tests/ipaexg-v.map ipaexg-v.map || exit 1 + +./ttf2pk -q ipaexg-v03 100 || exit 1 + +tftopl ipaexg-v03 ipaexg-v03 || exit 77 +pktype ipaexg-v03.100pk >ipaexg-v03.typ || exit 77 + +echo passed ipaexg-v test + diff --git a/Build/source/texk/ttf2pk/tfmaux.c b/Build/source/texk/ttf2pk/tfmaux.c index 68e80a708bf..314c105e9fb 100644 --- a/Build/source/texk/ttf2pk/tfmaux.c +++ b/Build/source/texk/ttf2pk/tfmaux.c @@ -282,7 +282,6 @@ buildtfm(Font *fnt) register int i, j; register ttfinfo *ti; int byte1, old_byte1, byte2; - long cksum; double Slant; char buffer[256]; struct sf sf_array[256]; @@ -365,8 +364,8 @@ buildtfm(Font *fnt) } header = (long *)mymalloc(40000L); - cksum = checksum(fnt->inencptrs); - header[0] = cksum; + fnt->cksum = checksum(fnt->inencptrs); + header[0] = fnt->cksum; header[1] = 0xA00000; /* 10pt design size */ (void)makebcpl(header + 2, fnt->codingscheme, 39); @@ -509,7 +508,8 @@ buildtfm(Font *fnt) old_byte1 = byte1; nl++; } - ligkern[nl - 1] |= 0x80000000L; + if (nl > 0) + ligkern[nl - 1] |= 0x80000000L; } kerns = ligkern + nl; diff --git a/Build/source/texk/ttf2pk/ttf2tfm.c b/Build/source/texk/ttf2pk/ttf2tfm.c index b118529014f..ebc92a10df9 100644 --- a/Build/source/texk/ttf2pk/ttf2tfm.c +++ b/Build/source/texk/ttf2pk/ttf2tfm.c @@ -235,6 +235,37 @@ end: } +#define MAX_SFLIST 10 +static void +add_subfont_list(Font *fnt) +{ + if (fnt->subfont_list == NULL) + fnt->subfont_list = (sflist *)mymalloc(MAX_SFLIST * sizeof(sflist)); + else if (fnt->subfont_num % MAX_SFLIST == 0) + fnt->subfont_list = (sflist *)myrealloc(fnt->subfont_list, + (fnt->subfont_num / MAX_SFLIST + 1) * MAX_SFLIST * sizeof(sflist)); + + (fnt->subfont_list[fnt->subfont_num]).name = + (char *)mymalloc(strlen(fnt->fullname)+1); + strcpy((fnt->subfont_list[fnt->subfont_num]).name, fnt->fullname); + (fnt->subfont_list[fnt->subfont_num]).cksum = fnt->cksum; + + fnt->subfont_num++; +} + + +static void +release_subfont_list(Font *fnt) +{ + register int i; + + for (i = 0; i < fnt->subfont_num; i++) + free((fnt->subfont_list[i]).name); + + free(fnt->subfont_list); +} + + #define VERSION "\ Copyright (C) 1997-1999, 2000, 2002 Frederic Loyer and Werner Lemberg.\n\ There is NO warranty. You may redistribute this software\n\ @@ -272,6 +303,7 @@ version(void) -L LIGFILE[.sfd] create 1st/2nd byte ligatures in subfonts using LIGFILE\n\ -n use PS names of TrueType font\n\ -N use only PS names and no cmap\n\ +-o FILE[.ovp] make an OVP file for conversion to OVF and OFM\n\ -O use octal for all character codes in the vpl file\n\ -p ENCFILE[.enc] read ENCFILE for the TTF->raw TeX mapping\n\ -P INT select INT as the TTF platform ID [3]\n\ @@ -528,6 +560,15 @@ handle_options(int argc, char *argv[], Font *fnt) arginc = 1; break; + case 'o': + if (argc <= 3) + oops("Missing parameter for -o option."); + if (vpl_name) + free(vpl_name); + vpl_name = newstring(argv[3]); + handle_extension(&vpl_name, ".ovp"); + break; + default: if (argc <= 3 || argv[3][0] == '-') { @@ -664,6 +705,9 @@ handle_options(int argc, char *argv[], Font *fnt) warning("Ignoring `-v' and `-V' switches for subfonts."); makevpl = 0; } + if (vpl_name) + if ((fnt->vplout = fopen(vpl_name, "wb")) == NULL) + oops("Cannot open ovp output file."); if (have_capheight) warning("Ignoring `-c' switch for subfonts."); if (fnt->inencname || fnt->outencname) @@ -864,6 +908,18 @@ main(int argc, char *argv[]) if (font.replacements) warning("Replacement glyphs will be ignored."); + /* second try to get an xheight value */ + if (font.xheight == 0) + { + if (NULL != (ti = findadobe("x", font.charlist))) + font.xheight = ti->ury; + else if (font.pid == 3 && font.eid == 1 && + NULL != (ti = findadobe(".c0x78", font.charlist))) + font.xheight = ti->ury; + else + font.xheight = 400; + } + if (NULL != (ti = findadobe("space", font.charlist))) font.fontspace = ti->width; else if (NULL != (ti = findadobe(".c0x20", font.charlist))) @@ -879,10 +935,19 @@ main(int argc, char *argv[]) writetfm(&font); if (font.write_enc) writeenc(&font); + if (font.vplout) + add_subfont_list(&font); } } close_sfd(); + + if (font.vplout) + { + writeovp(&font); + fclose(font.vplout); + release_subfont_list(&font); + } } else { @@ -891,6 +956,18 @@ main(int argc, char *argv[]) readttf(&font, quiet, False); replace_glyphs(&font); + /* second try to get an xheight value */ + if (font.xheight == 0) + { + if (NULL != (ti = findadobe("x", font.charlist))) + font.xheight = ti->ury; + else if (font.pid == 3 && font.eid == 1 && + NULL != (ti = findadobe(".c0x78", font.charlist))) + font.xheight = ti->ury; + else + font.xheight = 400; + } + if (NULL != (ti = findadobe("space", font.charlist))) font.fontspace = ti->width; else if (NULL != (ti = findadobe(".c0x20", font.charlist))) diff --git a/Build/source/texk/ttf2pk/ttf2tfm.h b/Build/source/texk/ttf2pk/ttf2tfm.h index 586ca1c5634..73e6008d9a7 100644 --- a/Build/source/texk/ttf2pk/ttf2tfm.h +++ b/Build/source/texk/ttf2pk/ttf2tfm.h @@ -54,7 +54,8 @@ struct _pcc; typedef struct _pcc pcc; struct _stringlist; typedef struct _stringlist stringlist; - +struct _sflist; +typedef struct _sflist sflist; struct _ttfinfo @@ -77,6 +78,8 @@ struct _ttfinfo pcc *pccs; /* we use the composite feature for */ /* `germandbls' <--> `SS' only */ unsigned char wptr, hptr, dptr, iptr; + + short fntnum; }; @@ -120,6 +123,13 @@ struct _stringlist }; +struct _sflist +{ + char *name; + long cksum; +}; + + struct _Font { char *ttfname; @@ -187,6 +197,11 @@ struct _Font const char *codingscheme; /* coding scheme for TeX */ char *titlebuf; + long cksum; + + short subfont_num; + sflist *subfont_list; + /* * The name of the subfont definition file. */ diff --git a/Build/source/texk/ttf2pk/ttfaux.c b/Build/source/texk/ttf2pk/ttfaux.c index 89327ac5047..39b666a3ae9 100644 --- a/Build/source/texk/ttf2pk/ttfaux.c +++ b/Build/source/texk/ttf2pk/ttfaux.c @@ -3,7 +3,7 @@ * * This file is part of the ttf2pk package. * - * Copyright 1997-1999, 2000 by + * Copyright 1997-1999, 2000, 2002, 2003 by * Frederic Loyer <loyer@ensta.fr> * Werner Lemberg <wl@gnu.org> */ @@ -72,7 +72,7 @@ static void readttf_kern(Font *fnt) { register kern *nk; - register ttfinfo *ti; + register ttfinfo *ti_l, *ti_r; TT_Kern_0_Pair* pairs0; TT_Error error; unsigned int i, j; @@ -95,18 +95,18 @@ readttf_kern(Font *fnt) pairs0 = directory.tables[i].t.kern0.pairs; for (j = 0; j < directory.tables[i].t.kern0.nPairs; j++, pairs0++) { - ti = findglyph(pairs0->left, fnt->charlist); - if (ti == NULL) - warning("kern char not found"); - else - { - nk = newkern(); - nk->succ = findglyph(pairs0->right, fnt->charlist)->adobename; - nk->delta = transform(pairs0->value * 1000 / fnt->units_per_em, 0, - fnt->efactor, fnt->slant); - nk->next = ti->kerns; - ti->kerns = nk; - } + ti_l = findglyph(pairs0->left, fnt->charlist); + if (ti_l == NULL) + continue; + ti_r = findglyph(pairs0->right, fnt->charlist); + if (ti_r == NULL) + continue; + nk = newkern(); + nk->succ = ti_r->adobename; + nk->delta = transform(pairs0->value * 1000 / fnt->units_per_em, 0, + fnt->efactor, fnt->slant); + nk->next = ti_l->kerns; + ti_l->kerns = nk; } return; /* we stop after the first format 0 kerning table */ @@ -258,6 +258,9 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range) fnt->units_per_em = properties.header->Units_Per_EM; fnt->fixedpitch = properties.postscript->isFixedPitch; fnt->italicangle = properties.postscript->italicAngle / 65536.0; +#if TT_FREETYPE_MINOR >= 5 + fnt->xheight = properties.os2->sxHeight * 1000 / fnt->units_per_em; +#endif if (fnt->PSnames != Only) { @@ -442,8 +445,8 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range) printf("\n\n%s:\n", fnt->fullname); printf("\n"); printf("Glyph Code Glyph Name "); - printf("Width llx lly urx ury\n"); - printf("---------------------------------------"); + printf("Width llx lly urx ury\n"); + printf("----------------------------------------"); printf("---------------------------------\n"); } @@ -562,6 +565,8 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range) ti->urx = bbox.xMax * 1000 / fnt->units_per_em; ti->ury = bbox.yMax * 1000 / fnt->units_per_em; + ti->fntnum = fnt->subfont_num; + /* * We must now shift the rotated character both horizontally * and vertically. The vertical amount is 25% by default. diff --git a/Build/source/texk/ttf2pk/vplaux.c b/Build/source/texk/ttf2pk/vplaux.c index cd8d9a55f37..9eef6e256fe 100644 --- a/Build/source/texk/ttf2pk/vplaux.c +++ b/Build/source/texk/ttf2pk/vplaux.c @@ -586,4 +586,117 @@ writevpl(Font *fnt, char makevpl, Boolean forceoctal) } +void +writeovp(Font *fnt) +{ + register int i; + register ttfinfo *ti; + long bc, ec; + char header[256]; + float Slant; + ttfinfo *ofm_array[65536]; + + + out = fnt->vplout; + + header[0] = '\0'; + strncat(header, "Created by `", 12); + strncat(header, fnt->titlebuf, 255 - 12 - 1); + strncat(header, "'", 1); + + voutln2("(VTITLE %s)", header); + voutln("(COMMENT Please change VTITLE if you edit this file)"); + + voutln("(OFMLEVEL H 1)"); + voutln("(FONTDIR TL)"); + voutln2("(FAMILY %s)", fnt->outname); + voutln("(FACE F MRR)"); + voutln("(CODINGSCHEME UNSPECIFIED)"); + voutln("(DESIGNSIZE R 10.0)"); + voutln("(DESIGNUNITS R 1000)"); + voutln("(COMMENT DESIGNSIZE (1 em) IS IN POINTS)"); + voutln("(COMMENT OTHER DIMENSIONS ARE MULTIPLES OF DESIGNSIZE/1000)"); + +#if 0 + /* Let vptovf compute the checksum. */ + voutln2("(CHECKSUM O %lo)", cksum ^ 0xFFFFFFFF); +#endif + + vleft(&level); + voutln("FONTDIMEN"); + + Slant = fnt->slant - fnt->efactor * tan(fnt->italicangle * (PI / 180.0)); + + if (Slant) + voutln2("(SLANT R %f)", Slant); + voutln2("(SPACE D %d)", fnt->fontspace); + if (!fnt->fixedpitch) + { + voutln2("(STRETCH D %d)", transform(200, 0, fnt->efactor, fnt->slant)); + voutln2("(SHRINK D %d)", transform(100, 0, fnt->efactor, fnt->slant)); + } + voutln2("(XHEIGHT D %d)", fnt->xheight); + voutln2("(QUAD D %d)", transform(1000, 0, fnt->efactor, fnt->slant)); + voutln2("(EXTRASPACE D %d)", + fnt->fixedpitch ? fnt->fontspace : + transform(111, 0, fnt->efactor, fnt->slant)); + vright(&level); + + for (i = 0; i < fnt->subfont_num; i++) + { + vleft(&level); + voutln2("MAPFONT D %d", i); + voutln2("(FONTNAME %s)", (fnt->subfont_list[i]).name); + voutln2("(FONTCHECKSUM O %lo)", (fnt->subfont_list[i]).cksum); + vright(&level); + } + + for (i = 0; i <= 0xFFFF; i++) + ofm_array[i] = NULL; + + for (ti = fnt->charlist; ti != NULL; ti = ti->next) + if (ti->charcode >= 0 && ti->charcode <= 0xFFFF) + ofm_array[ti->charcode] = ti; + + for (i = 0; i <= 0xFFFF && ofm_array[i] == NULL; i++) + ; + bc = i; + for (i = 0xFFFF; i >= 0 && ofm_array[i] == NULL; i--) + ; + ec = i; + + if (ec < bc) + oops("No TTF characters."); + + for (i = bc; i <= ec; i++) + { + if ((ti = ofm_array[i]) == NULL) continue; + + vleft(&level); + fprintf(out, "CHARACTER H %lX\n ", ti->charcode); + + voutln2("(CHARWD R %d)", ti->width); + if (ti->ury) + voutln2("(CHARHT R %d)", ti->ury); + if (ti->lly) + voutln2("(CHARDP R %d)", -ti->lly); + if (ti->urx > ti->width) + voutln2("(CHARIC R %d)", ti->urx - ti->width); + + vleft(&level); + voutln("MAP"); + if (ti->fntnum) + voutln2("(SELECTFONT D %d)", ti->fntnum); + + voutln2("(SETCHAR H %X)", (unsigned)ti->incode); + vright(&level); + + vright(&level); + } + + if (level) + oops("I forgot to match the parentheses."); +} + + /* end */ diff --git a/Build/source/texk/ttf2pk/vplaux.h b/Build/source/texk/ttf2pk/vplaux.h index 417d558ff53..cd30f908de4 100644 --- a/Build/source/texk/ttf2pk/vplaux.h +++ b/Build/source/texk/ttf2pk/vplaux.h @@ -16,6 +16,7 @@ void writevpl(Font *fnt, char makevpl, Boolean forceoctal); void upmap(Font *fnt); +void writeovp(Font *fnt); #endif /* VPLAUX_H */ |