03.01.2013 Views

Creating cuneiform fonts with MetaType1 and FontForge - TUG

Creating cuneiform fonts with MetaType1 and FontForge - TUG

Creating cuneiform fonts with MetaType1 and FontForge - TUG

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Karel Píška<br />

st<strong>and</strong>ard_introduce("zadim.akk");<br />

st<strong>and</strong>ard_introduce("ba.akk");<br />

st<strong>and</strong>ard_introduce("zu.akk");<br />

.....<br />

% METRICS<br />

wd._ash.akk=240; ht._ash.akk=160; dp._ash.akk=0;<br />

wd._hal.akk=340; ht._hal.akk=160; dp._hal.akk=0;<br />

wd._mug.akk=380; ht._mug.akk=220; dp._mug.akk=0;<br />

wd._zadim.akk=460; ht._zadim.akk=220;<br />

dp._zadim.akk=0;<br />

wd._ba.akk=420; ht._ba.akk=240; dp._ba.akk=0;<br />

wd._zu.akk=500; ht._zu.akk=240; dp._zu.akk=0;<br />

.....<br />

(We do not define the encoding in Type 1.)<br />

2.2 Glyph contours in <strong>MetaType1</strong><br />

Simple (atomic) elements — single wedges are defined<br />

by macros:<br />

def wh(expr l,x,y)=<br />

r:=5; w:=40; b:=5; c:=20; d:=70;<br />

z[nw] 0=(x+l,y+r);<br />

z[nw] 0a=(x+d,y+r); z[nw] 1b=(x+d,y+r);<br />

z[nw] 1=(x,y+w);<br />

z[nw] 1a=(x+b,y+c); z[nw] 2b=(x+b,y-c);<br />

z[nw] 2=(x,y-w);<br />

z[nw] 2a=(x+d,y-r); z[nw] 3b=(x+d,y-r);<br />

z[nw] 3=(x+l,y-r);<br />

p[nw]=compose_path.z[nw](3);<br />

Fill p[nw];<br />

nw:=nw+1;<br />

enddef;<br />

����<br />

����<br />

�������<br />

�� ������<br />

�����<br />

������<br />

������<br />

����<br />

def whv(expr x,y)=<br />

save pa,pb,pc; path pa,pb,pc;<br />

r:=5; w:=40; b:=5; c:=20; d:=70;<br />

pa:=pwh(200,x,y); pb=pwv(200,x+80,y+100);<br />

find_outlines(pa,pb)(pc);<br />

p[nw]:=pc1;<br />

Fill p[nw];<br />

nw:=nw+1;<br />

enddef;<br />

Complete glyphs — that is, <strong>cuneiform</strong> signs —<br />

are demonstrated in the following examples. Horizontal/vertical<br />

wedges, composites or their groups<br />

are also defined by macros; the arguments, for example,<br />

denote their lengths <strong>and</strong> coordinates.<br />

beginglyph(_mash.akk);<br />

save p; path p[]; nw:=0;<br />

whv(0,120);<br />

st<strong>and</strong>ard_exact_hsbw("mash.akk");<br />

endglyph;<br />

beginglyph(_sag.akk);<br />

save p; path p[]; nw:=0;<br />

wh(240,0,160);<br />

wh(160,80,80);<br />

wv(240,220,240);<br />

wv(240,300,240);<br />

whhv(400,120);<br />

st<strong>and</strong>ard_exact_hsbw("sag.akk");<br />

endglyph;<br />

2.3 Generating Type 1<br />

An intermediate Type 1 is generated from scratch:<br />

FN=$1 # font file name<br />

MT1=$2 # <strong>MetaType1</strong> direction<br />

mpost ’\generating:=0;’ input $FN.mp<br />

Another definition of a wedge — a single path: gawk -f $(MT1)/mp2pf.awk \<br />

def pwh(expr l,x,y)=<br />

-v CD=$(MT1)/pfcommon.dat -v NAME=$FN<br />

(x+l,y+r)..controls(x+d,y+r)..(x,y+w) gawk -f $(MT1)/packsubr.awk -v LEV=5 \<br />

..controls(x+b,y+c)<strong>and</strong>(x+b,y-c)..(x,y-w)<br />

..controls(x+d,y-r)..(x+l,y-r)--cycle;<br />

-v OUP=$FN.pn $FN.p<br />

t1asm -b $FN.pn $FN.pfb<br />

enddef;<br />

<strong>with</strong> some simplifications (intentional for <strong>cuneiform</strong>):<br />

������<br />

����<br />

In compound elements, the rendering of inter- glyph design is simple; no kerning pairs are needed;<br />

secting areas may depend on printer/viewer. There- the characters occupy independent boxes; no hyphenfore,<br />

removing overlap in Type 1 (<strong>and</strong> probably ation; <strong>and</strong> no internal encoding in the intermediate<br />

also in OpenType) is required. We use the macro Type 1 is defined. Theoretically, we could use a<br />

find_outlines:<br />

common Type 1 <strong>with</strong> several external encoding vectors,<br />

but in practice, joining all the glyphs into one<br />

OpenType font is a better <strong>and</strong> simpler solution.<br />

3 <strong>FontForge</strong> <strong>and</strong> producing OpenType<br />

Scripts in the <strong>FontForge</strong> scripting language read<br />

Type 1, build data for OpenType (especially, define<br />

the encoding) <strong>and</strong> then generate OTF <strong>and</strong> TTF files.<br />

Here is a table showing the Unicode areas <strong>with</strong> which<br />

we are concerned:<br />

422 <strong>TUG</strong>boat, Volume 29 (2008), No. 3 — Proceedings of the 2008 Annual Meeting

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!