[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swftools-common] generating swf fonts
From: |
Giniu |
Subject: |
Re: [Swftools-common] generating swf fonts |
Date: |
Sun, 06 Mar 2005 21:44:57 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20041218) |
Hi
this one will be long... thanks for those basic infos about hexfont.c
Matthias. Now more things is clear, but not everything, I'm looking more
and more into source and I think I'm close to say "Just follow the
source, Luke" :P... back to fonts, I will ask few more questions and
this is probably not last time, but when I will manage to obtain my
goal, maybe I will write some tut about that... ?? since unfortunately
documentation is worse side of this project (at this moment), besides of
this, everything is great, good work :D...
-------
First question is about swf_DrawText function - what i managed to find
out, it looks like this (correct me if I'm wrong):
swf_DrawText(&draw, font, (int)(10*20), nr);
it draws string "nr" using fonts "font" and size "200" into object
"draw"... but about size... of course in int, but why write
"(int)(10*20)"?? It is not just same as write "200" isn't this already
integer?? Or maybe size understood by swf would be 10?? since in target
of this call I saw: "size / 100.0 / 20.0" then multiplicating by 20 have
some sense, but I'm not sure about that... if yes, isn't "10*20" enough??
-------
Second question is about advance parameter of gylph sub-object in
SWFFONT object... what is this parameter (I think that it is width of
gylph)?? let's say with this lines as example:
hexfont.layout->bounds[t] = swf_ShapeDrawerGetBBox(&draw);
hexfont.glyph[t].advance = hexfont.layout->bounds[t].xmax +
hexfont.layout->bounds[t].xmin;
first line are taking out information about just drawed gylph, right??
so if there is only one gylph and what you said, xmin and xmax are
smallest and biggest coordinate of gylph's bounding box, so if I
understand, drawing is started in 0, so xmin <= 0, right?? so this is
width of gylph, I am correct, or I misunderstand something? (also
leading is larger height from all gylphs??)
-------
Next question - if I understand thanks to ascii2glyph and glyph2ascii I
can use custom order, and keep right understanding of gylphs in swf file
without taking care about place they take in gylph table, and won't have
holes in this, right? But why for gylph from e4 to ff you are seting
glyph2ascii at 0?
if(t>=0xe4) {
hexfont.glyph2ascii[t] = 0;
}
I don't getting why from this one and why 0, what I saw, when this is <
0 swf_DrawText will think, that there is no gylph in font file.
-------
Next question is short, instead of writing:
memset(&hexfont, 0, sizeof(hexfont));
Can I write:
memset(&hexfont, 0, sizeof(SWFFONT));
wouldn't this be better??
-------
And I think last question - let's say I want to generate file with 300
standard Latin and some Japanese fonts from Hiragana... So let say I
should write:
hexfont.numchars = 300;
hexfont.maxascii = 12433;
since 12433=0x0391 which is Unicode for last (higher) character from
Hiragana that I want to use??
and in all those lines:
hexfont.glyph2ascii = malloc(sizeof(U16)*256);
hexfont.ascii2glyph = malloc(sizeof(int)*256);
hexfont.glyph = malloc(sizeof(SWFGLYPH)*256);
hexfont.glyphnames = malloc(sizeof(char*)*256);
hexfont.layout->bounds = malloc(sizeof(SRECT)*256);
should I reserve memory for 300 gylphs? like malloc(sizeof(U16)*300)??
If yes can't I write just: malloc(sizeof(U16)*hexfont.numchars) ??
-------
uff.... this is it, maybe it is last time I'm asking about that, as you
can see I'm trying to answer those questions myself for better
understanding. Sorry for size of message, and for my language, my
English is really bad, but four years ago I doesn't know any word in
English, so forgive me please :P If I made some mistakes, please correct
me, thanks in advance...
Giniu