The TTIComp tool lets you add instructions to a TrueType font through a .TTI file containing something that looks like C code. You will need to know some C and to know something about TrueType instructions. You can take a look at the examples, and browse the tutorial for more information.
This is an example of what a TTI file may look like:
// This is the instruction file for Garogier.ttf
#input "../Garogier.ttf"
#output "Garogier_hinted.ttf"
#gasp AI
#twilight 1
#stack 100
#cvt base30: -30 \
xHeight30: 830 \
\
difference30: 30 \
\
stemBegin: \
stem40: 40 stem150: 150 \
stemEnd:
void prep() {
setVectorsY();
fixed oldXHeight = getCVT(xHeight);
fixed newXHeight = roundBlack(oldXHeight);
setCVT(xHeight, newXHeight);
fixed diff30 = getCVT(difference30);
if (getPPEM() < 40u) {
setCVT(base30, 0.0);
setCVT(xHeight30, newXHeight);
} else {
setCVT(xHeight30, newXHeight
+ diff30);
}
uint ppemY = getPPEM();
setVectorsX();
if (getPPEM() > ppemY)
setVectorsY();
// pixel size stems
while (cur < stemEnd) {
fixed size = getCVT(cur);
const fixed attenuation =
.5;
if (size<2.0)
size =
size*((2.0-attenuation)/2.0) + attenuation;
setCVT(cur, size);
cur = cur + 1u;
}
setCVTCutIn(50.0);
}
/*** figures ***/
void zero() {
//lsb
roundPoint(1u,1u);
moveDistanceBlack(1u,1u, 1u,23u, stem150);
moveDistanceRoundGrey(1u,1u, 1u,7u);
roundPoint(1u,7u);
moveDistanceBlack(1u,7u, 1u,17u, stem150);
// rsb
moveDistanceRoundWhite(1u,7u, 1u,25u);
interpolateX();
setVectorsY();
movePoint(1u,10u, base30);
moveDistanceBlack(1u,10u, 1u,14u, stem40);
movePoint(1u,4u, xHeight30);
moveDistanceBlack(1u,4u, 1u,20u, stem40);
interpolateY();
}
If this does not scare you, but rather interests you, you may want to take a look at these files, which include source .TTF and .TTI files for two fonts made by me (but not finished yet).
You may download a MS Windows binary (i.e., a working program file) of TTIComp here. It has been confirmed to work on Windows 2000 and Windows 95; other 32 bit Windowses (98, ME, XP etc.) should work as well. The source is also available. If you find any bug, please email me (please make sure I'll be able to reproduce it using the information you give me). Thank you. I expect to have one or two bugs left in switching from twilight zone to normal zone. I would also appreciate any suggestions for the program or the tutorial.