PDA

View Full Version : Is there a way to make my own FontRender Application?



Freezy
12-01-2004, 06:48 PM
Ehhmmm yo, the Titel say`s it all :)

jansoft
13-01-2004, 12:30 PM
why not ? It is about 2 day work, but you can use my Fntcreator
http://jansoft.aquasoft.cz/delphicomps.html#fntcreator which is designed to prepare font image for later processing in bitmap editor (like Photoshop).
Export consist of two files - bitmap and widths file.
"Bitmap" use as alpha channel and texturize it or do what you want. Save as another TGA/BMP file and then use VTDManager (downloadable from my pages) for compiling with "width" file into FONT.

Freezy
13-01-2004, 03:48 PM
Yay, good work!

Did that mean i can handle the Font like one i createt with the PowerDraw FontRender (a ver2.0 VTD file)?

The Render Routines to a Bitmap is easy, but is a VTD Font only a Record with this Bitmap? I dunno understand becouse it can draw Bold and Italic Fonts at Runtime :?

I like to integrate a Font render tool (that renders in the v2.0 Format) in my Game Development GUI.

jansoft
14-01-2004, 08:24 AM
this is my code iam using to create VTDB record with font. I am using some procedures not defined, but you can imagine what they do.



procedure SaveFontExtraData(PCount,StChar,EnChar:Integer;Wid ths,Heights:Array of Integer;out Data:Pointer;out DataSize:Integer);
var
Write:Pointer;
I:Integer;
begin
DataSize:=(3+4+(PCount)*2)*sizeof(Integer);
GetMem(Data,DataSize);
Write:=Data;
AddInt(Write,PCount);
AddInt(Write,StChar);
AddInt(Write,EnChar);
// skip 16 reserved bytes
for i:=0 to 3 do
AddInt(Write,0);
for I:= 0 to PCount - 1 do
begin
AddInt(Write, Widths[I]);
AddInt(Write, Heights[I]);
end;
end;

procedure CreateVTDFont(stchar,endchar:Integer;Widths,Height s:Array of Integer;Img:TAGFImage;out Data:Pointer;out DataSize:Integer);
var
Write,wdata,idata:Pointer;
wdatasize,idatasize:Integer;
begin
SaveFontExtraData(endchar-stchar,stchar,endchar,widths,heights,wdata,Wdatasi ze);
CheckError(Img.GetAGFData(iData,iDataSize));
DataSize:=IDataSize+WDataSize+4;
getmem(Data,DataSize);
Write:=Data;
AddInt(Write,SIG_FNT2);
move(wData^,Write^,wDataSize);
inc(integer(Write),wDataSize);
move(iData^,Write^,iDataSize);
end;


good luck

Freezy
14-01-2004, 04:54 PM
Oh, thats Great! Thx a lot! =D