text and font question
Blitz3D Forums/Blitz3D Beginners Area/text and font question
| ||
EpicBoy wrote: "Or stop using the "Text" command. I had to rewrite parts of my game over the weekend to use bitmap fonts instead of the internal "text" command because of this issue ..." Are there other ways of handling text than <text> and <print>? Does a font have to be in the Windows font directory before it can be used? I have tried putting a path to a font: myfont = LoadFont("fonts/unusual.fon",14,True,False,False) but all I get is some awful default, Times New Roman or something. Any tips on font and text handling would be appreciated. |
| ||
Are there other ways of handling text than <text> and <print>? Yes. You should avoid Text command and use it only for "debugging info" purposes. Use something like this in your actual game: http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=331 |
| ||
Maybe this is a dumb question, but why do you say that the Text command should be avoided? |
| ||
Not avoided. Just used appropriately. If you are in the early stages of your game and it works fine on your machine then continue to use it. If, however, you are nearing completion of your game, or you ran into problems using it with a particular graphics card/driver combo (GF4 comes to mind), then you really should consider using bitmap or (in 3D) sprite fonts. |
| ||
FWIW, I use Syntax Error's Sprite Control library. My (somewhat weird) approach uses TrueType fonts, but digitizes them at twice their desired display resolution, then scales them down to 50% so they blur nicely and look smooth. This way, I don't have to bother with a bitmapped font, but still get the benefits of one. That's just what works for me, though it's kinda offbeat. As for 'LoadFont("fonts/unusual.fon"...' not working, I believe that Blitz can only use TrueType (.ttf) fonts, not .fon fonts. Also, if the font isn't installed on a computer (which is going to be the case for most of the players of your game), you'll need to rename the font with its display name (what you see when you double-click it and the window pops up) instead of its eight-character filename. That way, Blitz can load it without it having to be installed first. That *usually* works, though I've encountered some dodgy fonts that Blitz couldn't load that way. |
| ||
OK, that's clear - as for the .fon reference, I was fooled by Blitz2D using "Blitz.fon"... I thought it used fon files as well as ttf... thanks for that |