PDA

View Full Version : TDXFont



bermubermu
14-08-2007, 09:01 AM
Hi Everybody,

I'm programming a new version of game Simon.

I would like to use special fonts in my program. As far I know, I must to use PowerFont with bmp image file with all the characters. Since here no problem.

My question is: It is possible to use a bitmap image file with all the characters and that each character have diferent size?

Now, in the ImageList I select the correct image file and give the dimension of every box. But I would like to use a image file that no all the characters have the same size...

I don't know if I explain well my problem... I hope yes!!!

Thanks a lot for your time!

David

FNX
14-08-2007, 09:27 AM
If i remember well, you load a single image file into the TDXImageList and set it on the TDXFont. To achive what you want i think you should set the tile size (pattern width, pattern height) to the biggest char on your image.

For example, you create an image with tiles of 48x48 and then you can have a character of 10 pixel, 12, 16, 20, 24, 32, 40, whatever.
The problem is that spacing between character would be different depending on the char size. To solve this i'm afraid you should create your own TDXFont component that inherits from it and handles the space between characters.

Let's see if someone else has another solution :)

bermubermu
14-08-2007, 11:51 AM
Really Thanks!!

One more question... do you know how use font in tga file?

NecroDOME
14-08-2007, 03:04 PM
You could also write your own font generator. This is easy of you use just a default TBitmap and render the font with TextOut or something like that. You could also use a TGA for that. This way its your decision of how big each character will be. The coordinates you can save in an array, dump it to a file so you can also load it later on and don't have to generate it.