Erik: It is nice to see your result. Could you share your direct rendering code with us?
Thanks Fan -----Original Message----- From: Erik Möller [mailto:[email protected]] Sent: Tuesday, February 24, 2009 6:16 PM To: [email protected] Cc: Fan Zhang; 'Mickey Gabel' Subject: RE: [ft] Questions with freetype Hi guys, Here's a quick helpful push in the right direction. I wrote a small font system a few months ago for an indie game I'm working on right now and had to spend some time investigating this. The font system wraps up freetype2 and keeps cached bitmaps of the glyphs drawn with colored outlines and other neat stuff expected in a game. Rendering bold or larger font size characters and then subtracting with a second pass gives horrible result... I've seen that done in some games and that's really not the way to do it, you always end up with artifacts. What you're looking for is freetype2's direct rendering which allows you to get spans and their coverage (opacity). When you need to render a glyph with a different colored outline you need to get the spans of the glyph and then get the spans of the outline and blend your own image from that. Freetype2 only ever gives you shades of gray so you need to manage the color yourself. You can even do gradients on glyphs this way. There's a bit of info here http://www.freetype.org/freetype2/docs/reference/ft2-raster.html and once you know "Direct rendering" is the answer to all you problems it just takes a little bit of coding effort to get some really nice stuff going. Here's a screen from the first test program I wrote http://www.timetrap.se/post_images/font_outlines.png I didn't really have a good code sample to submit here, but it's not that hard. I think my font system turned out to be about 450 lines of code and took me about a day to code up. I hope that helps. Erik Möller, Timetrap http://www.timetrap.se http://www.emberwind.se -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Fan Zhang Sent: den 24 februari 2009 22:40 To: Mickey Gabel Cc: [email protected] Subject: RE: [ft] Questions with freetype How about rewriting or implementing a new render function for hollowing? -----Original Message----- From: Mickey Gabel [mailto:[email protected]] Sent: Tuesday, February 24, 2009 9:26 AM To: Fan Zhang Cc: Werner LEMBERG; [email protected] Subject: Re: [ft] Questions with freetype On 25/02/2009 00:19, Fan Zhang wrote: > One way I am considering is to use emboldening. > > Drawing a emboldening character in the bitmap buffer and erasing > internal part with normal bitmap generated by ft2 engine. > > Did your guys try that direction? > > Thanks > Fan We haven't tried anything yet, this is all still in the planning/experiment phase, so for us it's still theoretical. I think your approach will mangle characters with small details and holes, for example chinese characters. _______________________________________________ Freetype mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype __________ Information from ESET NOD32 Antivirus, version of virus signature database 3886 (20090224) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 3886 (20090224) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 3887 (20090224) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com _______________________________________________ Freetype mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/freetype
