Quick viewing(Text Mode)

New Font Tools For

New Font Tools For

New to ols for T X

E

Werner Lemb erg

Kleine Beurhausstr. 1

D-44137 Dortmund

Germany

[email protected]

Abstract

The following font to ols will b e describ ed in this pap er:

 VFlib, the Vector , which has b een written by Kakugawa Hi-

rotsugu Ì ¯ < ê. This library together with an included suite of demo

applications is aimed to provide a uniform interface for accessing in

many di erent formats. With the help of con guration les it is p ossible to

access fonts with other enco dings, to de ne new virtual fonts, and others.

Using VFlib as a basis for dvi drivers, it will b e no longer necessary to have

pk les for any font format except for .

 FreeTyp e, develop ed byDavid Turner, Rob ert Wilhelm, and the author

of this pap er. This is a platform-indep endent library to render bitmaps

from TrueTyp e fonts. What makes it di erent from other freely available

TrueTyp e to ols is a TrueTyp e to pro cess hints.

 ttf2pk and hbf2gf, maintained resp. written by the author. Both programs

are part of the CJK package and are used to convert CJK TrueTyp e and HBF

fonts into T X fonts.

E

Intro duction Today,wehave many font les and many dif-

ferent font le formats. When we need soft-

None of the to ols are really new, but until now they

ware to display or printcharacters whichdoes

either have not b een presented to the English T X

E

not dep end on a windowing system and/or

communityorhave b een hidden in other packages.

an op erating system, wemust write interface

Most of them are work in progress, and there is a

routines for accessing font les in each appli-

good chance that this pap er is already out of date

cation again and again. To do this,

when it is printed.

must have knowledge of font le

1

All of them have a CJK background more or

formats; it will b e a hard task for program-

less; Kakugawa originally wanted easy Japanese

mers if the number of font formats that an

font supp ort for dvi drivers, mytwo programs are

supp orts b ecomes large.

still only useful for CJK fonts, and FreeTyp e was

also so on extended to manage CJK TrueTyp e fonts.

VFlib is a font library written in pro-

Nevertheless, work is going on to internationalize the

viding several functions to obtain bitmaps of

to ols, making them useful for a broader audience.

characters. VFlib hides the font format of font

In the bibliographyyou can nd the lo cations

les and provides a uni ed API for all sup-

from whichtodownload the packages.

p orted font formats. Thus, programmers for

application software need not have knowledge

VFlib

on font le formats. Instead, any software us-

Until recently do cumentation was only available in

ing VFlib can supp ort various font le formats

Japanese see [2] | the main reason why this great

immediately.

to ol is virtually unknown outside of Japan. Nowa

translation into English has b een made; this quote

[...]

2

from basic.txt tells what VFlib is:

Currently, VFlib supp orts the following font

1

Chinese/Japanese/Korean

2

le formats: PCF, BDF, HBF, TrueTyp e,

In general, I'm following the do cumentation les very

closely, omitting not so imp ortantortootechnical details. GF, PK, TFM, ShotaiKurabu b K û Õ ,

206 TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting

New font to ols for T X

E

3

a vector font format for Japanese Kanji, device. In addition to these font metrics are de ned

and JG another vector font format for Japa- for each glyph.

nese Kanji. Esp ecially, VFlib can b e used as Some font le formats do not have such con-

a font mo dule for drivers/previewers of dvi cepts; in this case, missing information either is

A

les T X/L T X; part of this package is a given in a vf libcap le or the sp eci c font driver pro-

E E

sample dvi previewer for X Windows writ- vides default values. For instance, a TrueTyp e font

ten with only 400 lines of C co de. is a vector font and is not restricted to a certain

p oint size and resolution of the target device since

VFlib stands for Vector Font library | earlier

vector fonts can b e scaled to any size. Another ex-

versions of the library have supp orted Japanese vec-

ample is the ShotaiKurabu font format whichdoes

tor fonts only, hence the name.

not have font metric information at all: a font driver

Basic concepts. The VFlib mo dule consists of two

for this font format generates virtual font metrics

parts: the library itself whichmust b e linked to the

using the data given in a vf libcap le.

application program, and a font database le called

Here a small excerpt of a vf libcap le suitable

`vf libcap' since the le format resembles the format

for Japanese T X JT X; omissions are indicated

E E

of a termcap database; see b elow for an example.

with three dots.

Font classes and font drivers. VFlib can handle

VFlib-Defaults:\

multiple font le formats. Reading a font le is done

:implicit-font-classes=- jtex- kanj i,\

byaninternal mo dule in VFlib corresp onding to the

gf/pk:\

font le format. This internal mo dule is called a

:extension-hints=pk=ascii-jte x-kan ji,\

`font driver'. Service units provided by font drivers

gf=ascii-jtex-kanji,\

are called `font classes'. From an end-user's p ointof

pk=gf/pk,\

view, font formats are distinguished by the names

gf=gf/pk,\

of font classes. Font drivers themself are not visible

.ttf=ttf:\

for end-users.

:variables-default-values=\

$TeX_KPATHSEA_PROGRAM=\

Some font drivers may not read font les on

/usr/local/teTeX/bin/xldvi:

disk; they may generate glyphs and outlines by in-

ternal computation only. In addition, some font

TeX-Defaults:\

drivers may return glyphs which are obtained as

:kpathsea-mode=ljfour:\

glyphs by another font class.

:dpi=600:\

Font names and searching. In VFlib, a font is

:kpathsea-program-name=\

sp eci ed by a `font name' on op ening. First, VFlib

$TeX_KPATHSEA_PROGRAM:

checks if the font name is given in vf libcap or not. If

the font name is found, VFlib reads the description

TrueType-Defaults:\

for the font in vf libcap, invokes a font driver corre-

:extension=.ttf:\

sp onding to the font class name and op ens the font

:aspect=1:\

:dpi=600:\

le.

:font-directories=\

If the font name is not given in a vf libcap le, a

/dos/texmf/fonts//j apane se:\

font searching mechanism is invoked. Since there are

:platform=microsoft:

so many font les for X Window and T X, this fea-

E

ture has b een intro duced to avoid writing an entry

for each font le. Various font drivers will b e called

mincho-jtex:\

to see whether the font can b e op ened; a list of font

:font-class=ttf:\

drivers for font searching is given in the vf libcap le.

:font-file=uwjmg3.ttf:\

Fonts describ ed in a vf libcap le are called `ex-

:magnification=0.92:\

plicit fonts' and fonts that are searched by the font

:writing-direction=h:\

search feature are called `implicit fonts'.

:character-set=jisx0208_1983: \

:encoding-force=sjis:

For T X fonts, the kpathsea library will b e used

E

for searching.

mincho-5pt:\

The vf libcap database. Each virtual font as

:-size=5:\

provided by VFlib has its inherent information on

:inheritance=mincho-jtex:

p oint size, pixel size, and resolution of the target

3

...

Other transcription forms are SyotaiKurabu or Syotai-

Club.

TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting 207

Werner Lemb erg

All other entries are used to de ne a Japa- mincho-10pt:\

:point-size=10:\

nese TrueTyp e font as a font for JT X. The nal

E

:inheritance=mincho-jtex:

JT X font is built from various layers, starting with

E

the entry `mincho-jtex' which de nes the TrueTyp e

font name, the writing direction, the character set,

min:\

etc. `mincho-5pt' is an example of how to inherit

:font-class=ascii-jtex-kanj i:\

font capabilities: only a p oint size declaration has

:kanji-adjustment-file=\

b een added. Then the `min' base font class is sp eci-

/usr/local/VFlib/ascii-jtex/t tf.ad j:

ed, calling the `ascii-jtex-kanji' font driver and us-

ing an adjustment le ttf.adj for all fonts of this

min5:\

4

class. Note that in `min' no fonts are de ned |

:kanji-font=mincho-5pt:\

:inheritance=min: the concept is similar to ob ject oriented languages

where some base classes are de ned on which vir-

...

tual classes are built. With `min5' or `min10' the

top level is reached, using all previously constructed

min10:\

font classes.

:kanji-font=mincho-10pt:\

NFSS would not require size quantization of the

:inheritance=min:

font; it's easy to add a prop er entry like this:

min-nfss:\

The format of a capability le is somewhat

:kanji-font=mincho-jtex:\

strange: each entry must be formally on one line

:inheritance=min:

which can b e split with a trailing . The

A font de ned in this way can then b e used at any

name of a capabilityentry is the rst name starting

size; VFlib would scale the font appropriately.

a line; all capability descriptions then follow in the

The VFlib API. The numb er of functions is small

format

due to the identical interface for all font formats.

:hentry 1 i:hentry 2 i:...:

Before op ening any font you have to call VF_Init

to initialize the library with a vf libcap le. Op en-

A single colon `:'is equivalent to the construction

ing and closing of a font are handled with the func-

`:hwhitespace i:', making it convenient to break a

tions VF_OpenFont and VF_CloseFont resp ectively.

line after the colon. Capability descriptions have

A glyph bitmap can b e accessed in twoways. Either

the format

you sp ecify bitmap sizes in pixels VF_GetBitmap2,

hcap description i=hcap value i

or you pass the resolution in dpi together with the

p oint size as parameters VF_GetBitmap1. Simi-

The rst equal sign separates the description from

lar commands exist for getting outline vector data

the value which can b e e.g. a list containing equal

VF_GetOutline and for obtaining information on

signs to o.

metrics VF_GetMetric1, VF_GetMetric2. All the

The capability entry `VFlib-Defaults' de nes

functions take the character co de as a mandatory

global default values for VFlib. `implicit-font-classes'

parameter.

sp eci es a list of font classes for implicit font search;

Auxiliary functions are provided to free bitmap

the font class drivers are invoked in the order of that

or metrics ob jects, to copy or scale bitmaps, and

list for searching. `extension-hints' gives an ordered

to `dump' the glyph using ASCI I characters to get

list of pairs indicating which extension of an implicit

similar output as gftype.

font needs which driver to handle. In the ab ove ex-

Finally,you can write your own font driver to

ample there are e.g. twoentries for les ending with

be installed with VF_InstallFontDriver. Font

pk: one for Japanese T X and one for standard T X.

E E

drivers must provide a small set of glyph manipulat-

If the rst driver fails, the second will be called.

5

ing functions, and p ointers to those functions are

Finally, `variables-default-values' gives a list of de-

then passed to the VFlib engine. Using the function

fault values which can b e overridden at run-time if

VF_GetProp it's easy to extract font-class-sp eci c

supplied as an argument string to the initialization

4

function of VFlib.

This le comp ensates the mono-width of Japanese

glyphs with small o sets for certain character classes like

`TeX-Defaults' primarily gives initialization val-

CJK punctuation characters to improvetyp ographical out-

ues for kpathsea. Users of web2c and teT X should

E

put. Character classes are a sp ecial feature of JT X.

E

5

b e quite familiar with the description names and its

With `glyph' an emptybox can b e meant also e.g. for

meanings. writing a tfm driver.

208 TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting

New font to ols for T X

E

entries from the vf libcap le to control the new font with hinting instructions whichmove the p oints de-

driver. termining the glyph contours to device resolution

dep endent lo cations b efore rasterization.

Limitations and planned features. Many parts

Wenow assume that all p ointmoving has b een

of the VFlib package are still undo cumented, or do c-

done, and that the x and y co ordinates of the p oints

umentation is only available in Japanese. For in-

are stored in a list together with a ag to indicate

stance, VFlib contains a complete library for inter-

whether the p ointison or o the curve. See Fig-

preting dvi les with sp ecials which further sim-

8

ure 1.

pli es the writing of dvi drivers. A suite of dvi

A scanline is a pixel line in the target bitmap.

previewers and dvi drivers is also included.

An outline, also called contour, is a closed line that

Currently, VFlib is limited to -like op erat-

delimits an inner and an outer region of the glyph.

ing systems, but it should not b e dicult to p ort it

The b est way to ll a shap e is to decomp ose it into

to other platforms b ecause no real dep endencies on

simple horizontal segments, called spans. Spans are

UNIX features are built in.

computed for each scanline. This is usually done

Another useful to ol yet to b e written is a mo d-

from the top to the b ottom of the shap e, in a move-

ule or program for creating tfm les from the bitmap

ment called sweep see Figure 2. It's easy to see

and vector fonts.

that there is typically more than one span p er scan-

Planned for the near future are mo dules for pro-

line. For each scanline during the sweep op eration

cessing PostScript fonts and T X virtual fonts; sup-

E

we need the horizontal x co ordinates of the start

p ort for metrics les is already implemented, but

and end p oints of all spans. These are computed

without a vf mo dule its use is rather academic.

b efore the sweep, in a phase called `decomp osition'

which converts the glyph contours into pro les.

FreeTyp e

Pro les are sections of the contours which are

The rep ort on FreeTyp e see [6] will cover only the

either only ascending or only descending, i.e. mono-

basics without going to o muchinto detail | the -

tonic in the vertical direction we will also say y-

nal end-user API has not b een de ned yet. It is not

monotonic. It can easily b e deduced from Figure 3

really linked to T X, and if you are not interested

E

that it is p ossible to resolveany contour into vertical

in how a rasterizer works, you should skip this sec-

pro les and horizontal lines which are not part of

tion. Nevertheless, it is linked to typ ography, and

a pro le.

the text presents some general principles of how out-

Each pro le inherits the direction of the par-

line glyphs will b e handled to yield bitmaps.

ent contour this is necessary to decide whether a

FreeTyp e is develop ed in a rather unusual way.

p oint is inside or outside of a contour, see b elow.

The package provides the complete library co de and

Figure 4 shows that a contour can havemultiple pro-

some to ols which demonstrate the use of the library

les. Pro les are also called `edges' or `edgelists' in

in two programming languages, namely in C and in

other graphics libraries.

Pascal. We try to keep the library small ab out

The rasterizer stores a pro le as an array of

60 kByte if compiled for maximal sp eed with gcc;

x co ordinates of the intersection p oints of the pro-

nevertheless it is highly p ortable since the C part

le and the a ected scanlines. To allo cate a pro le

is written in ANSI C, having only a few architec-

array without wasting memory we must know the

ture dep endencies which can b e adjusted with a few

height of that pro le; with other words, wehaveto

global de nitions.

compute the vertical extrema minimum and max-

imum. This can be done very easily for straight

The rasterizer. A rasterizer converts the vector

lines, but it is not trivial for B ezier arcs b ecause

data of a glyph into a pixel representation. In

this short overview all complications drop-out con-

8

trol, wrong contour direction, sub-banding of pro-

A second-order B ezier curve also called quadratic

6

spline is fully sp eci ed with the starting p oint of the curve,

les etc. are omitted. This part of the FreeTyp e

a control p oint usually o the line, and the end p oint of the

engine is quite generic and could b e adapted to, say,

curve. It is p ossible to have two consecutive o -p oints in

PostScript fonts to o.

the p oints list; in this case a virtual on-p oint between the

Glyphs as stored in a TrueTyp e font see [5] for

two o -p oints will b e constructed. The parametric form of a

quadratic spline is

a reference consist of vectorial information straight

7

lines and B ezier curves of second order  together

2 2

pt=1 t p +2t1 tp + t p ;

1 2 3

6

The original do cument is raster. of the FreeTyp e

package, written byDavid Turner.

t denotes a real numberinthe range [0; 1], p is the start

1

7

p oint, p the control p oint, and p the end p oint. PostScript fonts use third-order B ezier curves.

2 3

TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting 209

Werner Lemb erg

p

2

p

3

p

1

Two `on' p oints with two `o ' p oints b etween.

Two `on' p oints Two `on' p oints and one `o ' p oint

The b ox indicates a virtual p oint not in the list.

Figure 1: Possible `on' and `o ' p oint combinations in a FreeTyp e font

Figure 2: Filling a shap e with spans. The arrow indicates the sweeping direction.

9

they are not monotonic in the general case. Nev-

ertheless, a B ezier arc can b e split into two subarcs

with very little computation. Both subarcs are again

B ezier arcs, and one of them is guaranteed to b e y-

monotonic. Lo ok at Figure 5: p denote the p oints

i

b elonging to the original curve, q and r then de ne

i i

the subarcs i b eing 1, 2, or 3. The following for-

mul give the relationship between an arc and its

subarcs:

q = p ; q =p + p =2

1 1 2 1 2

r = p ; r =p + p =2

3 3 2 2 3

q = r =q + r =2

3 1 2 2

We stop if either all subarcs are monotonic or the

Figure 3: Decomp osition of a contour into pro les

subarcs b ecome to o small; in b oth cases we've found

an extremum. This pro cess is called attening.

The next step is to compute all intersection

p oints of pro les and scanlines. In the case of lines

this is straightforward, but it is a little more compli-

cated for splines. Fortunately we can use arc split-

ting again. Consider Figure 6. The horizontal lines

represent scanlines, and a short segment of a pro le

is shown. If we continue splitting until each subarc

Figure 4: A contour with multiple pro les

9

A quadratic spline is y-monotonic if and only if the y co-

ordinates of the p oints p , p , and p are monotonic, i.e.

1 2 3

p  p  p or p  p  p . If p = p = p ,

1 2 3 1 2 3 1 2 3

y y y y y y y y y

the arc degenerates into a horizontal line.

210 TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting

New font to ols for T X

E p 2 

 q

2 

q = r 1

3 

p = q 1

1  r

2  



scanline

p = q

3 3

Figure 7: the interior of a glyph must always b e

Figure 5: splitting a B ezier arc into two subarcs

to the right of the contour

crosses only one scanline, we can safely approximate

The instruction interpreter. In gure 8 you can

the subarcs with straight lines for which the compu-

see what instructions basically do. To avoid drop-

tational e ort is minimal. Internally this has b een

outs or ugly shap es, p oints are moved to new reso-

realized with a B ezier arc stack; if the topmost arc

lution dep endent lo cations b efore rendering, assur-

can b e replaced with a line, the intersection p ointis

ing that even for low resolutions go o d optical results

computed and the arc is p opp ed o the stack. Oth-

can b e computed. It has turned out that the True-

erwise the arc is p opp ed o , then split, and the two

Typ e sp eci cations are often very fuzzy ab out cer-

new subarcs are pushed on the stack. This will b e

tain instructions. Long debugging sessions with well

rep eated until the stack is empty.

hinted TrueTyp e fonts were needed, comparing the

results with rendered bitmaps of other commercial

y +3

TrueTyp e engines, to nd out the undo cumented

b ehaviour of those instructions. Nevertheless, af-

ter mastering these obstacles, most glyphs are now

y +2

rendered equally well with FreeTyp e as with the ras-

terizers of Windows and the Mac.

y +1

To be added in the near future is instruction

supp ort for comp osite glyphs. Again the sp eci ca-

y

tions are to o fuzzy to allow a straightforward imple-

mentation without testing undo cumented instruc-

tion prop erties | for instance, should the instruc-

Figure 6: the stepping pro cess: replacing

tion co de of the subglyphs b e executed or only the

suciently small subarcs with lines

instructions for the comp osite glyph? The TrueTyp e

sp eci cation says nothing ab out this problem.

We are done. The contours have b een resolved

Font to ols from CJK

into pro les, and the pro les have b een decomp osed

Both programs discussed in this section are part of

into intersection p oints of the pro les and the scan-

the CJK package [3]. They are sp ecialized to CJK

lines. One last thing must be taken into account:

fonts, but work is going on to internationalize them.

how can we decide which side of the countour is in-

Script le skeletons of MakeTeXPK et al. are delivered

terior and which is exterior? The TrueTyp e sp eci -

with these utilities for on-the- y font generation.

cation de nes that the interior is always on the right

side of the contour see Figure 7. Having an inter-

ttf2pk. It is currently a sp ecial to ol for converting section p oint together with the contour direction, we

CJK TrueTyp e fonts into tfm and pk les, but later can decide simply which pixels must b e blackened.

TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting 211

Werner Lemb erg

HBF_START_FONT 1.1

HBF_CODE_SCHEME CNS11643-92p5

FONT cns40st-5

SIZE 40 150 150

HBF_BITMAP_BOUNDING_BOX 40 40 0 -6

FONTBOUNDINGBOX 40 40 0 -6

STARTPROPERTIES 23

FONTNAME_REGISTRY ""

FOUNDRY "CBS"

FAMILY_NAME "Song"

WEIGHT_NAME "medium"

an uninstructed `v' an instructed `v'

SLANT "r"

SETWIDTH_NAME "normal"

Figure 8: comparison b etween a hinted and an

ADD_STYLE_NAME "fantizi"

unhinted glyph

PIXEL_SIZE 40

POINT_SIZE 400

RESOLUTION_X 75

on it will use FreeTyp e to pro cess all kinds of True-

RESOLUTION_Y 75

Typ e fonts. The original author is Lin Yaw-Jen who

SPACING "c"

mo deled ttf2pk after ttf2bmp and pbmtopk. AVERAGE_WIDTH 400

CHARSET_REGISTRY "CNS11643.92p5"

ttf2pk takes a non-comp osite CJK TrueTyp e

10

CHARSET_ENCODING "0"

font in Big 5, EUC, or SJIS enco ding and converts

WEIGHT 19329

a certain contiguous subrange at most 256 charac-

RESOLUTION 110

ters into a pk and a tfm le. The program has a

X_HEIGHT 34

lot of command switches; a typical call lo oks like

QUAD_WIDTH 40

ttf2pk ntukai01.pk ntukai01.tfm 600 1.0 \

FONT_ASCENT 34

0xA140 256 -e Big5 ntu_kai.ttf

FONT_DESCENT 6

DEFAULT_CHAR 0x2121

`ntukai01' is the rst subfont of the ntukai font,

ENDPROPERTIES

`600' is the resolution in dpi, `1.0'avertical scaling

COMMENT "This HBF header file is in the"

factor for printers with di erent horizontal and ver-

COMMENT "."

tical resolutions, `0xA140' the rst character co de

HBF_START_BYTE_2_RANGES 1

of the subfont, and `256' the numberofcharacters

HBF_BYTE_2_RANGE 0x21-0x7E

in the subfont. The switch -e selects the enco ding

HBF_END_BYTE_2_RANGES

of the TrueTyp e font, and the last parameter is a

HBF_START_CODE_RANGES 1

full path to the TrueTyp e font le.

HBF_CODE_RANGE 0x2121-0x7C51 4040w5.bin 0

Most of the other options not shown here have

HBF_END_CODE_RANGES

COMMENT

b een inherited from pnmtopk; one parameter `-r'

COMMENT Rarely used characters defined by

has b een added to rotate the glyphs by 90 degrees,

11

COMMENT Ministry of Education of Taiwan,

enabling faked vertical typ esetting with T X.

E

COMMENT said to be disjoint from the

CJK subfonts as used in the CJK package are

COMMENT previous planes.

discussed in another pap er of the pro ceedings [4].

COMMENT 8603 characters, 2121--7C51.

COMMENT

hbf2gf. Similarly to ttf2pk, hbf2gf is used to split

HBF_END_FONT

CJK bitmap fonts into subfonts. Its source co de is

written in CWEB; the format used by this to ol is

The syntax is very similar to the format of a

the Hanzi Bitmap Font format HBF, see [1] for a

BDF header bitmap fonts used with X Windows;

complete reference. Basically the format consists of

a small set of keywords starting with `HBF_'; all oth-

the bitmap les and a header le describing the font.

ers are BDF sp eci c have b een added to accommo-

Here an example of an HBF header le, describing

date the sp ecial needs of CJK les. As an example,

a Chinese font with the character set CNS plane 7:

the line

HBF_CODE_RANGE 0x2121-0x7C51 4040w5.bin 0

10

EUC stands for Extended UNIX co de; examples are -

nese GB, Japanese JIS, Korean KS enco ding.

says that the le 4040w5.bin contains glyphs with

11

Alas, only Big 5 enco ding has b oth horizontal and ver-

the character co des 0x2121{0x7C51, starting at o -

tical punctuation marks, but even here the set is not com-

set 0. `HBF_BYTE_2_RANGE' sp eci es the valid range

plete. For typ ographically satisfying results you need a font

of the second bytes of the double byte font enco ding intended for vertical typ esetting.

212 TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting

New font to ols for T X

E

see [3] for more details. Both keywords can app ear Conclusion

more than once.

In a not to o distant future the utilities and libraries

hbf2gf can b e called in two `mo des': the rst

describ ed in this pap er will more or less merge, pro-

creates a complete set of subfonts for a particular

viding a vital basis for handling fonts under and

HBF font, and the second computes the gf and

T X. With VFlib as the framework it will b e p ossi-

E

tfm le of one subfont to be used in MakeTeX...

ble to access already existing fonts in Unico de enco d-

scripts. In b oth cases, a con guration le is used

ing regardless of the original enco ding, create virtual

to avoid lengthy parameter lists.

fonts on the y as needed for text pro cessing with

We continue the example from ab ove with an

mixed writing directions b oth horizontal and verti-

hbf2gf con guration le using the just de ned CNS

cal, sophisticated handling b etween fonts and

font long lines are splitted and marked with a nal

much more.

backslash for clari cation:

With FreeTyp e a new fontworld will b e op ened

hbf_header \

to T X users working on UNIX like op erating sys-

E

$TEXMF/fonts/hbf/chinese/cns 40/c ns40- 5.hb f

tems | after the integration of FreeTyp e ttf2pk will

b e hop efully as useful as pstopk or gsftopk.

comment \

CNS plane 5 song 40x40 pixel font \

References

scaled and adapted to 12pt

[1] Nelson Chin et al. Hanzi Bitmap Font

HBF le format version 1.1. Avail-

mag_x 1

able electronically from ftp://ftp.ifcss.org/

design_size 12.0

pub/software/info/HBF-1.1.tar.gz, Septem-

x_offset 2

b er 1994.

y_offset -8

[2] Kakugawa Hirotsugu < ê Ì ¯. The VFlib

package. Available from ftp://gull.se.

output_name c5so12

hiroshima-u.ac.jp/1997.

[3] Werner Lemb erg. The CJK package. Available

checksum 123456789

from CTAN, language/chinese, 1997.

dpi_x 300

[4] Werner Lemb erg. The CJK package for

A

L T X2 |multilingual supp ort beyond bab el.

"

E

pk_files no

In Proceedings of TUG 97, July 1997.

tfm_files yes

[5] Microsoft corp oration. TrueTyp e 1.0 font

les. Available electronically from ftp://ftp.

pk_directory \

microsoft.com/developr/drg/TrueType/

$TEXMF/fonts/pk/modeless/chi nese /c5so 12/

ttspec.zip,Novemb er 1995.

tfm_directory \

$TEXMF/fonts/tfm/chinese/c5s o12/

[6] David Turner, Rob ert Wilhelm, and Werner

Lemb erg. The FreeTyp e package. Available

Keywords must start a line; a line not start-

from ftp://ftp.physiol.med.tu-muenchen.

ing with a known keyword is ignored. Environment

de/pub/, 1997.

variables can b e sp eci ed with a starting .

An imp ortant concept to understand hbf2gf

con guration les is the di erence b etween `magni-

12

cation' and `scaling'. The former denotes a scal-

ing factor to reach the design size of the font in the

ab ove example it is 1.0 to get 12 pt. O set values

given in pixels refer to this size. The latter then

scales the font to its nal size, indicated with dpi_x

and optionally dpi_y.

It is also p ossible to create fonts with slanted

and rotated glyphs; additionally the next version

will b e able to pro duce virtual fonts.

12

The wording is a bit unfortunate b ecause the meaning

is di erentinT X.

E

TUGb oat,Volume 18 1997, No. 3 | Pro ceedings of the 1997 Annual Meeting 213