Draw Outlined Text
BlitzMax Forums/BlitzMax Beginners Area/Draw Outlined Text
| ||
Is there an easy way to do it? I don't mean only draw the text outline, but draw it like in movie subtitles, where the text color is yellow or white, and it has a 1-pixel wide black line surrounding it to make it visible no matter if the background is dark or light. I've though about drawing the text twice, first in bold and and then normal, but the alignment wouldn't work depending on the font and I would need to draw it letter by letter. If I couldn't explain myself correctly, here's an image: ![]() Thanks once again :P |
| ||
X = 10 Y = 10 SetColor 0,0,0 DrawText "Hello",X-1,Y-1 DrawText "Hello",X-1,Y+1 DrawText "Hello",X+1,Y-1 DrawText "Hello",X+1,Y+1 SetColor 255,255,255 DrawText "Hello",X,Y Better alternative is to use bitmap fonts, though, since the above code is drawing four times as much text as is actually visible. |
| ||
Interesting, thank you :) And can I convert TTF fonts to bitmap? If so, how do I do the outlining? |
| ||
And can I convert TTF fonts to bitmap? If so, how do I do the outlining? Try Juicy Fonts. (Windows) |
| ||
Thank you :) |
| ||
Or Fontext (in my sig below). |
| ||
Will try it too :P Thanks. |
| ||
Ok, now this is weird. I saved a font as .png and used in my game, it worked perfectly and everything is just fine. So, now I made a new font, and used it in another project. But even after loading the font, the variable remains as null... I copied the font I used in the other project to the new one... Still null. I changed the graphics driver to use DX7 like in the other project, still null. Everything is just the same, why won't the font load in my second project? GUI class in my first project: Type TGUI Global Neuropol:TImageFont Global NeuroBig:TImageFont Global Pixel:TImageFont Global PixelBig:TImageFont Function Init() Neuropol = LoadImageFont("fonts\neuropol.ttf", 12) NeuroBig = LoadImageFont("fonts\neuropol.ttf", 30) Pixel = LoadImageFont("fonts\trisk.png",12) PixelBig = LoadImageFont("fonts\trisk.png",16) EndFunction EndType This one loads correctly, no null variables. Now for the second one: Type TGUI Global Pixel:TImageFont Global Crosshair:TImage Function InitGui() Pixel = LoadImageFont("fonts\trisk.png",12) If Pixel = Null Then Print "didnt load again..." Crosshair = LoadImage("gfx/p_crosshair.png") End Function End Type Why? I even execute the functions in the same order in both projects, first I create the game window, set mask color and blend mode, then I execute the init function. The path is correct, and it will load as a normal image. So... If the font worked with my first project, why won't the same font work now in this second one? Is there anything I can do to find out why the font isn't loading and remains as null? |
| ||
I'm an idiot. The only reason I thought it was working in the other game is because I was using the method GfK posted and I forgot to remove it :P So forget the question above. |