Hi, I was just playing luatex with the script in http://luatex.bluwiki.com/go/Use_a_TrueType_font , and found some problem. On Windows XP English Edition or Debian GNU/Linux with luatex 0.10.1 I wrote the following script: ------------------------------------------------------------------file begins \pdfoutput1 \directlua0{ callback.register('define_font', function(name, size) filename=kpse.find_file(name,"truetype fonts") if (filename) then if (size < 0) then size = (- 655.36) * size end ttffont = fontforge.to_table(fontforge.open(filename)) if ttffont then f = { } f.name = ttffont.fontname f.fullname = ttffont.names[1].names.fullname f.parameters = { } f.designsize = size f.size = size direction = 0 f.parameters.slant = 0 f.parameters.space = size * 0.25 f.parameters.space_stretch = 0.3 * size f.parameters.space_shrink = 0.1 * size f.parameters.x_height = 0.4 * size f.parameters.quad = 1.0 * size f.parameters.extra_space = 0 f.characters = { } mag = size / 2048 names_of_char = { } for char, glyph in pairs(ttffont.map.map) do names_of_char[ttffont.glyphs[glyph].name] = ttffont.map.backmap[glyph] end names_of_glyph = { } for char, glyph in pairs(ttffont.map.map) do names_of_glyph[ttffont.glyphs[glyph].name] = glyph end for char, glyph in pairs(ttffont.map.map) do glyph_table = ttffont.glyphs[glyph] f.characters[char] = { index = glyph, width = glyph_table.width * mag, name = glyph_table.name, } if glyph_table.kerns then local kerns = { } for _, kern in pairs(glyph_table.kerns) do kerns[names_of_char[kern.char]] = kern.off * mag end f.characters[char].kerns = kerns end end f.filename = filename f.type = 'real' f.format = 'truetype' f.cidinfo = { registry = "Adobe", ordering = "Identity", supplement = 0, version = 1 } end else f = font.read_tfm(name, size) end return f end ) } %\font\times= times.ttf at 10pt \times Like oratory, music, dance, calligraphy -- like anything that lends its grace to language -- typography is an art that can be deliberately misused. It is a craft by which the meanings of a text (or its absence of meaning) can be clarified, honored and shared, or knowingly disguised. %\font\arial= arial.ttf at 10pt \arial In a world rife with unsolicited messages, typography must often draw attention to itself before it will be read. Yet in order to be read, it must relinquish the attention it has drawn. Typography with anything to say therefore aspires to a kind of statuesque transparency. Its other traditional role is durability: not immunity to change, but a clear superiority to fashion. Typography at its best is a visual form of language linking timelessness and time. %\font\simhei= simhei.ttf at 10pt \simhei %中文 \bye ------------------------------------------------------------------End of file Step 1 times.ttf for Times New Roman and arial.ttf for Arial is available in Microsoft Windows XP, and they looks pretty well. so this script works. Step 2 but then I load a Chinese font, simhei.ttf. It is also available in the English Edition of Windows XP. and now luatex reports: Warning: Glyph 257 is named middot which should mean it is mapped to Unicode U+00B7, but Glyph 194 already has that encoding. and then it crash: This went wrong:[string "luas[0]"]:1: attempt to perform arithemetic on field 'width' (a nil value). <to be read again> \simhei So it fails to compile. Step 3 Then I found a smaller Chinese font named simkai.ttf, you can find it in the Simplified Chinese version of Windows XP. it compiles successfully with the Warning message but without the error message. it generate the pdf file, but the two chinese characters are so close (see the a.pdf I enclosed here) that they are almost in the same place. if I change mag = size / 2048 to mag = size / 256 then the space looks right. Step 4 I tried more Chinese ttf fonts and found that only a few can pass the test, and among those few, the character box width seems all wrong. So how can I make things right? or it is just a bug in luatex? Yue Wang