Olivier Binda wrote:
Hello...
I have been testing luatex some more and I have made the following discoveries :
A) The \ifcsname macro doesn't behave as it should when you use non ascii char between \ifcsname and \endcsname, as you can see if you try to luatex this minimal file :
\expandafter\def\csname A人\endcsname{success}% 1) % succeeds \csname A人\endcsname \par 2) % fails...this is a \ifcsname bug \ifcsname A人\endcsname it should write this but it doesn't \else it writes this and it shouldn't% it goes this way, sigh.... \fi \bye
indeed, this does not work; if i remember right we ran into this a while ago but it was never solved; should be on the todo list
B) non-ascii utf8 char don't seem to have their catcodes initialized to "letter" (catcode 11). Is this normal ? Is it a bug ? a feature ?
this is on purpose; you have to initialize anyway since not all characters are letters;
XeTeX initializes all non ascii char as letters. This is quite usefull (and quite logical too). Shouldn't it be the same in luatex, at least for the sake of compatibility ?
catcodes, lc/uccodes etc are to be initialized, and this is something for a macropackage to deal with
\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
^ lokks wrong to me ... this defined direction as global var
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
maybe this is wrong
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,
maybe something funny with your mag, try to set this so 10000 or so, just for testing
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.embedding = "full" f.cidinfo = { registry = "Adobe", ordering = "Identity", supplement = 0, version = 1 } end else f = font.read_tfm(name, size) end return f end ) }
\font\myfont=skullz.ttf at 8pt \myfont abcdefABCDEF %%% it prints but the all the chars are stacked upon another (they must have near 0pt width).
What could be wrong ?
a lot of things ... put some prints in the code, tracing ..
D) Please, could you put more code snipets in the luatex manual (this piece of code from yannis would be a good candidate) ?
the manual is a ref manual and will not have many examples by the time that we release the first formal version, we will provide code that works in plain tex; we will also write a book about luatex and that will hav emore samples
I welcome Yannis' decision to build a luatex wiki and it would be even nicer if someone knowledgeable wrote a little luatex macro library to do (the right way) basic things like : loading utf/opentype fonts.... To help beginners jump on the luatex bandwagon....
well, there's a truckload of experimental code in the context distribution (and i expect the context wiki also to have example code), and we will make much of that generic, but as said, mid next year is the agenda ... keep in mind that for a while font supprt changes, probably more or less stable next month eventually macro packages have to provide the basic code (we don't expect each users to write lua code for each font -) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------