Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Font Maps?  (Read 1457 times)
aspurgeon
Customers
Community Member
*****
Posts: 161


« on: September 07, 2007, 01:20:48 PM »

TV 6.2 (and, I assume 6.3, but I never used it because I dived into the 6.5 beta) had a tool to create font images and work with them, rather than relying on fonts installed in the end-user's Windows/Fonts folder. 

I know how to load font files that are registered with the operating system, using TVScreen2DText.TextureFont_CreateFont(...).  However, I am using various fonts in my application and I don't think it's desireable to install 5 or 6 TrueType fonts as part of the project.  Instead, I'd much rather create a font map like any other art asset, store it in a package, and then load them in from the image file.

So, my question is...  Will there be such a tool released for 6.5?  Also, is there a way to do this with 6.5 already (no tool required) and I am too dumb to figure it out?  :-)

Thanks in advance for any help!
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #1 on: September 07, 2007, 01:29:22 PM »

You can generate the texture font on your computer, save the generated font texture (TextureFont_GetTexture) and get all char data : TextureFont_GetFontData.

When you want to reuse them in the game, you can just call TextureFont_CreateCustom, with the texture, and the data.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
aspurgeon
Customers
Community Member
*****
Posts: 161


« Reply #2 on: September 07, 2007, 10:58:40 PM »

Sylvain,

Thanks a ton -- I wrote myself a little FontMap utility, and it is saving the loaded fonts just like I wanted. Smiley

Quick question on TextureFont_CreateCustom.  The last parameter is TV_TEXTUREFONT_CHAR[] pCharArray, and is obviously the list of characters that are drawn in the font map.  Is there a contant somewhere I can reference, that has the same character array as that used by TV3D when it creates the texture, or do I need to create my own?  No biggie, just seems redundant.

Thanks!
Andy
Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #3 on: September 08, 2007, 05:05:50 AM »

That's what TextureFont_GetFontData is for Smiley
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
aspurgeon
Customers
Community Member
*****
Posts: 161


« Reply #4 on: September 08, 2007, 04:47:22 PM »

I don't want to doubt, but that doesn't sound right. Huh I'm using C# and I looked at the method signature for TextureFont_GetFontData before posting my last question... It looks like:


Quote
void TVScreen2DText.TextureFont_GetFontData(int iFontID, ref int retNumChars, TV_TEXTUREFONT_CHAR[] pCharArray)

That seems to give me the number of characters represented by the font class, but not the array of what characters there actually are.  Obviously, the engine has a "default" list, which it uses when you call TextureFont_CreateFont.  That seems like it should be what I plug in.  But I don't know where to find it...  I didn't see any methods in TVScreen2DText that return an array of TV_TEXTUREFONT_CHAR structs.

Sorry to be dense, but I'm clearly missing something here.

Logged
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #5 on: September 08, 2007, 05:31:54 PM »

Because of the way the wrappers for TV3D are working, you must allocate an array yourself, and the engine will fill it when you pass the array in the GetFontData function.
You can for example allocate 256 entries.
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
aspurgeon
Customers
Community Member
*****
Posts: 161


« Reply #6 on: September 10, 2007, 07:18:10 PM »

Sylvain, thanks for the wrapper explanation -- I've got it working now.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks