Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Necro on Wed 23/07/2003 18:25:01

Title: Suggestion: Font outline/shadow
Post by: Necro on Wed 23/07/2003 18:25:01
Importing ttf font are exellent , but I find myself wanting some font with outlines or shadows.

Would it be possible to import a font then have a box displaying whether you wanted it imported as normal or having AGS make an outlined version and shadowed version of it.

[*cough* RC2 *cough*]
Title: Re:Suggestion: Font outline/shadow
Post by: TerranRich on Thu 24/07/2003 01:35:39
This has been suggested many times. I agree with this suggestion however, and I think maybe CJ should bump this one upward on his to-do list, if it's even in there. I didn't see it in there, or in the tracker. Someone should've added this to the tracker at least by now. :)
Title: Re:Suggestion: Font outline/shadow
Post by: RickJ on Thu 24/07/2003 01:51:30
Why don't we just ask someone to make a seperate font outline generator?  AJA seems to have a handle on how to do it (see thread link below), is he is listening maybe he would like to comment.  In the thread below he was discussing about how to do an AGS plugin to generate outlin fonts.  

[ur]http://www.agsforums.com/yabb/index.php?board=2;action=display;threadid=7305;start=msg90[/url]

Are there any other font experts out there?  Great challange eh!



Title: Re:Suggestion: Font outline/shadow
Post by: Necro on Thu 24/07/2003 10:57:57
I think AJA's outline plugin would over complicate things. plus increase filesizes when it wouldnt need it. You could however great a font outliner as a seperate tool from ags the simply generates sci-fonts normal/outline/shadowed.

CJ please make it so.
Title: Re:Suggestion: Font outline/shadow
Post by: AJA on Thu 24/07/2003 16:22:19
QuoteI think AJA's outline plugin would over complicate things

That depends... if AGS would allow a plugin to fiddle with the fonts before they are displayed all you'd have to do is set (in the game_start function) which fonts should be outlined. I haven't yet quite had any experiements with outline generation for fonts because I haven't quite been able to draw text on a blank bitmap... :P

-EDIT-

Or the other way would be that I'd create similar functions to DisplaySpeech etc.... The only difference would be that my functions would create outlines... Still haven't got the draw text on a blank bitmap working... :(

-EDIT2-

IT WORKS!!! ;D I'll just tweak it a bit and show you then how it looks like... :)
Title: Re:Suggestion: Font outline/shadow
Post by: AJA on Thu 24/07/2003 17:23:06
Here it is: http://koti.mbnet.fi/dima/downloads/fontoutline.zip
There's an example... again. Here's all the info you'll need (hopefully):
Print (x, y, font, colour, text);

And this is ALPHA!

-EDIT-
link fixed tho' the problem wasn't with the link (i had named the zip incorrectly :P)... thx, Zeuz!
Title: Re:Suggestion: Font outline/shadow
Post by: Necro on Thu 24/07/2003 18:18:51
Wow that was quick! amazing. well I see its certainly achievable....

CJ should add it to his list for ags NOW!! , but I think I'll be keeping an eye on your plug-ins AJA.. :D

Title: Re:Suggestion: Font outline/shadow
Post by: RickJ on Thu 24/07/2003 18:57:33
AJA, what I was asking if it's possible for you to make an outline font generator so that this wouldn't need to be done at runtime.  Seems like you may have done all the heavy lifting already to accomplish this.  Maybe you could simply add the ability to wirte your fonts out to an AGS supported font file?  The alternative, of course would to be to make a standalone allpication to do the same thing.  This would negarte the need of something being added to the AGS editor itself.  What do youthink?  Is it a possibility?
Title: Re:Suggestion: Font outline/shadow
Post by: Necro on Fri 25/07/2003 01:57:18
yes this is what I was meaning too... people would want to add 100-300k to thier games if they could make the fonts before hand.
Title: Re:Suggestion: Font outline/shadow
Post by: Cerulean on Fri 25/07/2003 03:35:21
Another angle on this: Remember antialiased ttf? Chris removed it because dialogue was being shown antialiased with "transparent pink" and there was all this pink junk around the words. But I think if it used black instead of pink, it would probably look like an fairly good outline, behind smooth text to boot. I would ask that the feature be reactivated, modified to use the shadow font color as the assumed background when rendering the antialiased text.
Title: Re:Suggestion: Font outline/shadow
Post by: Necro on Fri 25/07/2003 07:49:05
and remember option to outline OR shadow . don't forget shadow because that looks cool sometimes too.
Title: Re:Suggestion: Font outline/shadow
Post by: Pumaman on Fri 25/07/2003 13:45:56
I'm not sure how AJA is generating outlines, but I might try an auto-outline thing by drawing the font a few times at 1-pixel offsets in different directions. I'll give it a go and see how it looks at some point.
Title: Re:Suggestion: Font outline/shadow
Post by: AJA on Fri 25/07/2003 16:36:21
CJ: I used the same method for the creditz plugins outlining, but it turned out REALLY slow with ttf fonts (tho' they were scrolling so it probably won't affect so much with static text :P)... otherwise it worked quite nicely, if I remember correctly.

This is what my outline plugin does:
1. I create a new bitmap for the text
2. I draw the text onto the new bitmap
3. I get the transparent color from the bitmap
4. My outline generation function creates a new outline-bitmap which is 2 pixels wider and higher than the original one.
5. I run a loop which checks if a pixel of the bitmap is not transparent. In this case it draws an outline pixel to these coordinates (x+1,y; x-1, y; x, y+1; x, y-1).
6. The loop also draws the font again so that the bitmap will contain the outline and the original bitmap on it so that I won't have to first draw the outline and then draw the text.

Quite easy... Tho' I haven't yet tested how much this slows down the engine if it does. :P


RickJ: I have no idea how to do any binary stuff etc. So I wouldn't be able to make a program that could write SCI font files... not yet at least... :(
Title: Re:Suggestion: Font outline/shadow
Post by: RickJ on Sat 26/07/2003 04:41:29
AJA: I can appreciate that.  Ijust thought it was worth asking the question though.    
Title: Re:Suggestion: Font outline/shadow
Post by: AJA on Sat 26/07/2003 10:57:11
:)
Title: Re:Suggestion: Font outline/shadow
Post by: Necro on Sat 26/07/2003 13:08:37
not to be too greedy , but if your doing the pixel offset thing then you could possible have 2 sets of an out line a light and full version... light being offset of x-1 , x+1, y-1, y+1 giving a rounded corder outline and the full being all offsets for the square corner type outline.. (x-1 & y-1,x=0 & y=0, X=1 & y=1...ect)
Title: Re:Suggestion: Font outline/shadow
Post by: AJA on Thu 31/07/2003 16:06:41
yup... I just made it the "faster" way... :P
Title: Re:Suggestion: Font outline/shadow
Post by: Ciro Durán on Sat 02/08/2003 01:32:53
I have the same problem, although not with the speech fonts, but rather with the way I designed the GUI, as you can see this picture:

(http://www.ldc.usb.ve/~ciro/asd.jpg)
(Please ignore the fact it's in spanish :P)

The "sentence" part is directly over the play screen, when the AA enters, it leaves the pink fade.    It would be really cool if CJ could fix this, although I recall Allegro only uses #FF00FF color to use transparencies, I might be wrong.

Maybe my temporal solution will be making a black box behind the sentence... :P (bummer)
Title: Re:Suggestion: Font outline/shadow
Post by: TerranRich on Sat 02/08/2003 05:26:10
Just draw the text with a black outline in a paint program, then import it as a sprite with an invisible background (no anti-aliasing though). :)
Title: Re:Suggestion: Font outline/shadow
Post by: Ciro Durán on Sat 02/08/2003 06:07:49
Quote from: terranRICH on Sat 02/08/2003 05:26:10
Just draw the text with a black outline in a paint program, then import it as a sprite with an invisible background (no anti-aliasing though). :)

Well, the problem is that the text is constantly changing (It's the equivalent in english of the "Talk to", "Walk to", "Look at", etc.), that's why is the "sentence" part of the GUI, sorry if I wasn't clear :P (I won't do 1000 sprites for that part, I'd had a 50Mb game, and no hair trying to do that)
Title: Re:Suggestion: Font outline/shadow
Post by: Pumaman on Sat 02/08/2003 23:35:15
You'll have to disable TTF anti-aliasing to fix this, I'm afraid. There's no easy way to work around it.
Title: Re:Suggestion: Font outline/shadow
Post by: AJA on Sun 03/08/2003 18:36:32
Btw, CJ... I noticed this with my credits plugin (I don't know if you're aware of it): DrawText can draw antialiased text onto the screen. So, if you'd just change the way DisplaySpeech etc. works to the way DrawText works we could have antialiased lucasarts style speech. :)
Title: Re:Suggestion: Font outline/shadow
Post by: Pumaman on Sun 03/08/2003 19:09:14
That doesn't work for the same reason as it doesn't on a transparent GUI.

Speech text is initially rendered to a transparent bitmap, which is then drawn onto the screen as necessary. Because of this, the antialiasing makes it merge with the pink transparent area of the bitmap giving the annoying pink edge effect.
Title: Re:Suggestion: Font outline/shadow
Post by: Cerulean on Tue 05/08/2003 07:39:02
Have you considered my suggestion? Try rendering it to a background color equal to the chosen shadow color, and then substituting trans-pink for that color.
Title: Re:Suggestion: Font outline/shadow
Post by: Pumaman on Tue 05/08/2003 19:17:17
Good idea, but that would of course only work when the font had an outline.
Title: Re:Suggestion: Font outline/shadow
Post by: Ciro Durán on Tue 05/08/2003 22:05:37
Quote from: Pumaman on Tue 05/08/2003 19:17:17
Good idea, but that would of course only work when the font had an outline.

Mmm, I don't understand why it would need to have an outline, it would be matter of rendering the font to the selected color (Just like rendering to a non-transparent GUI, i.e., the load and save window), and then replacing the background color. (Well, I don't really know if I'm following Cerulean's idea :P)
Title: Re:Suggestion: Font outline/shadow
Post by: Gregjazz on Tue 05/08/2003 23:42:25
Actully, if you're interested in real-time font ouliners, I just finished the beta version of a font outliner as a function.

You can check it out at http://herculeaneffort.myikonboard.com/viewthread.php?postid=50 (http://herculeaneffort.myikonboard.com/viewthread.php?postid=50)

Have fun!
Title: Re:Suggestion: Font outline/shadow
Post by: TerranRich on Wed 22/10/2003 21:00:08
So, have you gotten any good results yet on TTF outlining, CJ? I'd be really interested to see what you came up with.
Title: Re:Suggestion: Font outline/shadow
Post by: Pumaman on Thu 23/10/2003 20:57:58
Nope, I haven't got round to trying it out yet.