PDA

View Full Version : FontStudio exporter TCharacterData question



NecroDOME
10-10-2010, 06:53 PM
Hi All,

I was building a plugin for font studio to export the data to my engine-readable-format when I bumped upon the TCharacterData struct:


TCharacterData = packed record //This is how plugins version 3 and above will recieve FontData - an array of TCharacterData
Wid,Hgt, X,Y: cardinal; //Unsigned 32bit
Ox, Oy, A, B, C: integer; //Signed 32bit
char: cardinal; //The actual unicode character number

And a question arises: what does the A, B and C mean?

Nitrogen
10-10-2010, 08:48 PM
Sorry, guess I should have documented it a bit better (I thought I did explain it somewhere in that file :P)

From this page: http://msdn.microsoft.com/en-us/library/dd162454%28v=VS.85%29.aspx


The A spacing is the distance to add to the current position before drawing the character glyph.
The B spacing is the width of the drawn portion of the character glyph.
The C spacing is the distance to add to the current position to provide white space to the right of the character glyph.

wagenheimer
11-10-2010, 06:59 PM
Nitrogen!

Your download link to Font Studio really don't works here to me! I don't know what happens, but your domain http://labs.delphituts.com/ is not acessible here, I'm trying for months already. Is there some alternative download link?

Thanks!

chronozphere
12-10-2010, 06:59 AM
Hmm.. I just found this record definition in Font4.pas:



FontInfo = record
A, C: integer;
Wid, Hgt: cardinal;
char: WideChar;
x1,y1,x2,y2: double;
end;


Why is B missing? By looking at your source, my guess is that it's added to C.



procedure TFontObj.Draw(const X, Y: single; const Txt: widestring; Lev: single);
var CurX: single;
Ch: Widechar;
Chaar, I, Ind: integer;
begin
CurX := X;

for I := 1 to length(Txt) do
begin
Ch := Txt[I];
Chaar := integer(ch);

if Chaar = 32 then
begin
Ind := -1;
CurX := CurX + SpaceWidth;
end
else
begin
Ind := CharLookup[Chaar];
end;

if ind > -1 then
begin
CurX := CurX + F[Ind].A;

DrawQuadRT(CurX, Y, F[ind].Wid, F[ind].Hgt, lev, F[ind].x1,F[ind].x2,F[ind].y1,F[ind].y2);

CurX := CurX + F[Ind].C;
end;
end;

end;


Would be nice if you added some comments to make these things clear. ;)

NecroDOME
12-10-2010, 10:01 AM
Thnx, that realy helps a lot :)

Nitrogen
12-10-2010, 10:19 PM
Nitrogen!

Your download link to Font Studio really don't works here to me! I don't know what happens, but your domain http://labs.delphituts.com/ is not acessible here, I'm trying for months already. Is there some alternative download link?

Thanks!

Strange... How about http://www.delphituts.com/labs/FontStudio421.zip

Nitrogen
12-10-2010, 10:22 PM
Would be nice if you added some comments to make these things clear. ;)


Oops! :) The separate B and C values are actually something I did recently and I dont think I updated any of the .fnt file reading sources so they still have only A and C... The old .fnt file exporter plugin still uses the old method (Font Studio 4.21 is backward compatible with the old plugins) so if you want *all* the A,B and C values, I'll have to update the .fnt exporter and corresponding Font4.pas file (with comments of course ;))

wagenheimer
20-10-2010, 01:10 AM
Hi Again Nitron!

The download link really don't works here! http://www.delphituts.com/labs/FontStudio421.zip

I can not even ping delphituts.com here, I tryed it for days long and I think it does not works here in Brazil, it is blocked someway.

Is there no altenative download links? Please upload it to 4shared or any other free hosting service!

Thanks!

chronozphere
20-10-2010, 07:22 AM
The link does work here. Perhaps someone should make a mirror download?

Srki_82
08-12-2010, 01:28 AM
Just one more question about TCharacterData ... what are Ox and Oy values?

Edit: ahhh... it's all in the readme.txt :)