29.05.2014 Views

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

The history of luaTEX 2006–2009 / v 0.50 - Pragma ADE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

local capscale, digscale = 0.85, 0.75<br />

f.name, f.type = name, 'virtual'<br />

f.fonts = {<br />

{ id=id },<br />

{ name="texnansi-lmss10", size=size*capscale },<br />

{ name="texnansi-lmtt10", size=size*digscale }<br />

}<br />

for k,v in pairs(f.characters) do<br />

local chr = utf.char(k)<br />

if chr:find("[A-Z]") then<br />

v.width = capscale*v.width<br />

v.commands = {<br />

{"special","pdf: 1 0 0 rg"},<br />

{"slot",2,k},<br />

{"special","pdf: 0 g"}<br />

}<br />

elseif chr:find("[0-9]") then<br />

v.width = digscale*v.width<br />

v.commands = {<br />

{"special","pdf: 0 0 1 rg"},<br />

{"slot",3,k},<br />

{"special","pdf: 0 g"}<br />

}<br />

else<br />

v.commands = {<br />

{"slot",1,k}<br />

}<br />

end<br />

end<br />

return f<br />

end<br />

end<br />

return font.read_tfm(name,size)<br />

end)<br />

Hardwiring fontnames in callbacks this way does not deserve a price and when possible<br />

we will provide better extension interfaces. Anyhow, in the experimental ConTEXt code<br />

we used calls like this, where demo is an installed feature.<br />

\font\myfont = special@demo-1 at 12pt \myfont<br />

Hi there, this is the first (number 1) example <strong>of</strong> playing with Virtual<br />

Fonts,<br />

A fresh look at fonts 39

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

Saved successfully!

Ooh no, something went wrong!