summaryrefslogtreecommitdiff
path: root/Build/source/texk/ttf2pk2
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2011-05-09 09:20:56 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2011-05-09 09:20:56 +0000
commit32db0daad9f37a2b83bb5efb624eae3ea72e2470 (patch)
treefa6257e434e0a11a504f9f48abb780c7c525cd21 /Build/source/texk/ttf2pk2
parent66450148d7e252f1faf049a75878fff2d85e6d15 (diff)
ttf2pk2: get kerning via freetype2
git-svn-id: svn://tug.org/texlive/trunk@22372 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ttf2pk2')
-rw-r--r--Build/source/texk/ttf2pk2/ChangeLog6
-rw-r--r--Build/source/texk/ttf2pk2/ttf2pk.12
-rw-r--r--Build/source/texk/ttf2pk2/ttf2tfm.148
-rw-r--r--Build/source/texk/ttf2pk2/ttfaux.c75
4 files changed, 35 insertions, 96 deletions
diff --git a/Build/source/texk/ttf2pk2/ChangeLog b/Build/source/texk/ttf2pk2/ChangeLog
index 6eb80b0f51a..598c28ec586 100644
--- a/Build/source/texk/ttf2pk2/ChangeLog
+++ b/Build/source/texk/ttf2pk2/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-04 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * ttfaux.c (readttf_kern): Rewrite, using FT_Get_Kerning().
+
+ * ttf2pk.1, ttf2tfm.1: Mention freetype2, drop old kpathsea.
+
2011-05-01 Peter Breitenlohner <peb@mppmu.mpg.de>
* ttfaux.c (readttf): Skip unused vars.
diff --git a/Build/source/texk/ttf2pk2/ttf2pk.1 b/Build/source/texk/ttf2pk2/ttf2pk.1
index 516a3081223..37d50e10c17 100644
--- a/Build/source/texk/ttf2pk2/ttf2pk.1
+++ b/Build/source/texk/ttf2pk2/ttf2pk.1
@@ -1,6 +1,6 @@
.\" man page for ttf2pk
.
-.TH TTF2PK 1 10-Jan-2002 "FreeType version 1.5"
+.TH TTF2PK 1 04-May-2011 "FreeType2 version"
.SH NAME
ttf2pk \- convert a TrueType font into TeX's PK format
.SH SYNOPSIS
diff --git a/Build/source/texk/ttf2pk2/ttf2tfm.1 b/Build/source/texk/ttf2pk2/ttf2tfm.1
index 482f2ee1ff4..e0ea2b815d1 100644
--- a/Build/source/texk/ttf2pk2/ttf2tfm.1
+++ b/Build/source/texk/ttf2pk2/ttf2tfm.1
@@ -1,6 +1,6 @@
.\" man page for ttf2tfm
.
-.TH TTF2TFM 1 10-Jan-2002 "FreeType version 1.5"
+.TH TTF2TFM 1 04-May-2011 "FreeType2 version"
.SH NAME
ttf2tfm \- build TeX metric files from a TrueType font
.SH SYNOPSIS
@@ -8,7 +8,8 @@ ttf2tfm \- build TeX metric files from a TrueType font
.nh
.B ttf2tfm
'in +\n(.ku
-.IR ttffile [ .ttf | .ttc ]
+.I ttffile\c
+.RB [ .ttf | .ttc ]
[\c
.BI \-c \ \%caps-height-factor\c
]
@@ -956,10 +957,6 @@ is appended and not `\c
.
.
.SS kpathsea
-Please note that older versions of
-.B kpathsea
-(<3.2) have no special means to seach for TrueType fonts and related
-files, thus we use the paths for PostScript related stuff.
The actual version of kpathsea is displayed on screen if you call
either
.B ttf2pk
@@ -995,48 +992,9 @@ version\ 3.2:
.br
.C "\&.sfd TTF2PKINPUTS, TTF2TFMINPUTS"
.PP
-And here the same for pre-3.2-versions of
-.B kpathsea:
-.PP
-.in +4m
-.ta 2i
-.C \&.ttf \ and "\ .ttc T1FONTS"
-.br
-.C "ttf2pk.cfg TEXCONFIG"
-.br
-.C "\&.map TEXCONFIG"
-.br
-.C "\&.enc TEXPSHEADERS"
-.br
-.C "\&.rpl TEXPSHEADERS"
-.br
-.C "\&.tfm TFMFONTS"
-.br
-.C "\&.sfd TEXPSHEADERS"
-.PP
-Finally, the same for pre-3.0-versions (as used e.g. in te\*(TX\ 0.4):
-.PP
-.in +4m
-.ta 2i
-.C \&.ttf \ and "\ .ttc DVIPSHEADERS"
-.br
-.C "ttf2pk.cfg TEXCONFIG"
-.br
-.C "\&.map TEXCONFIG"
-.br
-.C "\&.enc DVIPSHEADERS"
-.br
-.C "\&.rpl DVIPSHEADERS"
-.br
-.C "\&.tfm TFMFONTS"
-.br
-.C "\&.sfd DVIPSHEADERS"
-.PP
Please consult the info files of
.B kpathsea
for details on these variables.
-The decision whether to use the old or the new scheme will be done
-during compilation.
.PP
You should set the
.C TEXMFCNF
diff --git a/Build/source/texk/ttf2pk2/ttfaux.c b/Build/source/texk/ttf2pk2/ttfaux.c
index 10b26d5ebc8..802fc15dc5d 100644
--- a/Build/source/texk/ttf2pk2/ttfaux.c
+++ b/Build/source/texk/ttf2pk2/ttfaux.c
@@ -64,7 +64,6 @@ FT_Face_Properties properties;
FT_BBox bbox;
#if 0
-FT_Kerning directory;
FT_Post post;
TTO_GSUBHeader gsub_;
@@ -74,58 +73,44 @@ TTO_GSUBHeader *gsub;
Boolean has_gsub;
-#if 0
static void
readttf_kern(Font *fnt)
{
- register kern *nk;
- register ttfinfo *ti;
- FT_Kern_0_Pair* pairs0;
+ kern *nk;
+ ttfinfo *ti, *tj;
FT_Error error;
- unsigned int i, j;
-
-
- if ((error = FT_Get_Kerning_Directory(face, &directory)))
- oops("Cannot get kerning directory (error code = 0x%x).", error);
-
- if (directory.nTables == 0)
- return;
+ FT_Vector akerning;
- for (i = 0; i < directory.nTables; i++)
+ for (ti = fnt->charlist; ti; ti = ti->next)
{
- if ((error = FT_Load_Kerning_Table(face, i)))
- oops("Cannot load kerning table (error code = 0x%x).", error);
-
- switch (directory.tables[i].format)
+ kern head;
+ kern *tail = &head;
+ head.next = NULL;
+ for (tj = fnt->charlist; tj; tj = tj->next)
{
- case 0:
- pairs0 = directory.tables[i].t.kern0.pairs;
- for (j = 0; j < directory.tables[i].t.kern0.nPairs; j++, pairs0++)
+ if ((error = FT_Get_Kerning(face, ti->glyphindex, tj->glyphindex,
+ FT_KERNING_UNSCALED, &akerning)))
+ oops("Cannot get kerning vector (error code = 0x%x).", error);
+
+ if (akerning.x)
{
- 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;
- }
+ nk = newkern();
+ nk->succ = tj->adobename;
+ nk->delta = transform(akerning.x * 1000 / fnt->units_per_em, 0,
+ fnt->efactor, fnt->slant);
+ /* We append the new kern to reproduce the old .vpl file */
+ tail->next = nk;
+ tail = nk;
+#if 0
+ nk->next = ti->kerns;
+ ti->kerns = nk;
+#endif
}
- return; /* we stop after the first format 0 kerning table */
-
- default:
- break;
}
+ ti->kerns = head.next;
}
- return;
}
-#endif
-
void
readttf(Font *fnt, Boolean quiet, Boolean only_range)
@@ -298,10 +283,6 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range)
{
cmap_plat=face->charmaps[i]->platform_id;
cmap_enc=face->charmaps[i]->encoding_id;
-#if 0
- if ((error = FT_Get_CharMap_ID(face, i, &cmap_plat, &cmap_enc)))
- oops("Cannot query cmap (error code = 0x%x).", error);
-#endif
if (cmap_plat == fnt->pid && cmap_enc == fnt->eid)
break;
}
@@ -317,14 +298,12 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range)
{
cmap_plat=face->charmaps[i]->platform_id;
cmap_enc=face->charmaps[i]->encoding_id;
- //FT_Get_CharMap_ID(face, i, &cmap_plat, &cmap_enc);
fprintf(stderr, " (%i,%i)\n", cmap_plat, cmap_enc);
}
fprintf(stderr, "\n");
exit(1);
}
-// if ((error = FT_Get_CharMap(face, i, &char_map)))
if ((error = FT_Set_Charmap(face, face->charmaps[i])))
oops("Cannot load cmap (error code = 0x%x).", error);
}
@@ -532,7 +511,6 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range)
else
index = k;
- //Num = FT_Char_Index(char_map, index);
Num = FT_Get_Char_Index(face, index);
/* now we try to get a vertical glyph form */
@@ -564,7 +542,6 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range)
index = 0;
}
-// error = FT_Load_Glyph(instance, glyph, Num, 0);
error = FT_Load_Glyph(face, Num, flags);
#if 0
if (!error)
@@ -757,10 +734,8 @@ readttf(Font *fnt, Boolean quiet, Boolean only_range)
}
/* kerning between subfonts isn't available */
-#if 0
if (!only_range)
readttf_kern(fnt);
-#endif
}