🔒 Locked
Creating outlined text!
Advertisement
Original Post
CD3DFont in the SDK - you can easily do something similar with either your own bitmap or two passes with 2 different fonts.
Blitting a bitmap font would not be slow. That method is what you see when you see the outlined text on N64 or PS2 games. Another method is like the other guy said, to blit out the text in black, and then blit out the text in white on top of it, but a little smaller so the black will show around it.
dave
--
david@neonstar.net
neonstar entertainment
dave
--
david@neonstar.net
neonstar entertainment
just draw the bitmapped font in ASCII order, so the ASCII value of each character is also the index of that character in the bitmap.
as far as fixed-widthness goes, that''s how i have done it... but i suppose you could make them variable-widthed. you''d have to keep track of the whole rect for each character in a lookup table then, though, instead of just multiplying the offset by the index.
--- krez (krezisback@aol.com)
as far as fixed-widthness goes, that''s how i have done it... but i suppose you could make them variable-widthed. you''d have to keep track of the whole rect for each character in a lookup table then, though, instead of just multiplying the offset by the index.
--- krez (krezisback@aol.com)
One more time...
CD3DFont in the SDK...
CD3DFont in the SDK...
Bitmapped fonts would provide you with a solution but they do not scale very well on different resolutions. Also, creating lots of different typefaces would be a nightmare.
There is a method which would mean a lot more programming but would a) work with any resolution and indeed any size for your font and b) work with any style of font.
By using the Win32 function GetGlyphOutline you can actually get the meta information for drawing characters from a chosen font. For each character it will return a list of drawing primitives, line and curves that make up the shape of the character.
This is a mechanism I used when I first looked at the Macromedia Flash SDK, because it had no functionality for displaying text. Like I said it is more work but it does work.
It will also allow you to change colours easily, and you can then fill the text with a bitmap brush, solid colour, whatever you want.
If you want an example I can post it here, although it''s specifically for the Flash SDK but you could munge it for whatever purpose.
There is a method which would mean a lot more programming but would a) work with any resolution and indeed any size for your font and b) work with any style of font.
By using the Win32 function GetGlyphOutline you can actually get the meta information for drawing characters from a chosen font. For each character it will return a list of drawing primitives, line and curves that make up the shape of the character.
This is a mechanism I used when I first looked at the Macromedia Flash SDK, because it had no functionality for displaying text. Like I said it is more work but it does work.
It will also allow you to change colours easily, and you can then fill the text with a bitmap brush, solid colour, whatever you want.
If you want an example I can post it here, although it''s specifically for the Flash SDK but you could munge it for whatever purpose.
I started putting the example code in but it was just turning into a nightmare because of the other SDK so heavily integrated. Plus the SDK used quadratic splines which made it easy, PolyBezier (the function we would use to draw on a device context) uses bezier curves.
What I''ll do is modify the code so that it works, then post it as a self contained function (hopefully).
In fact, in the meantime I have found an MSDN article that does half the work. Take a look at article #Q243285 - this will convert splines to beziers. This takes the output from the GetGlyphOutline function.
I''ll post the working code, once it works.
What I''ll do is modify the code so that it works, then post it as a self contained function (hopefully).
In fact, in the meantime I have found an MSDN article that does half the work. Take a look at article #Q243285 - this will convert splines to beziers. This takes the output from the GetGlyphOutline function.
I''ll post the working code, once it works.
Goes a little something like this - after a bit of editing 
Note: I have included the MSDN code too because I have modified bits of it. Hope this is OK Microsoft?
This is by no means perfect so please, no flames. I may even post a cleaner solution another time. But now it's past my bedtime so I'll bid you adieu!
Edited by - JY on November 13, 2001 7:20:41 PM
Edited by - JY on November 13, 2001 7:24:22 PM
Edited by - JY on November 13, 2001 7:25:02 PM
Edited by - JY on November 13, 2001 7:26:30 PM
|
Note: I have included the MSDN code too because I have modified bits of it. Hope this is OK Microsoft?
This is by no means perfect so please, no flames. I may even post a cleaner solution another time. But now it's past my bedtime so I'll bid you adieu!
Edited by - JY on November 13, 2001 7:20:41 PM
Edited by - JY on November 13, 2001 7:24:22 PM
Edited by - JY on November 13, 2001 7:25:02 PM
Edited by - JY on November 13, 2001 7:26:30 PM
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement