We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 190

Summary: TrueType font which has embedded bitmaps was not properly rendered
Product: SDL_ttf Reporter: Kouya Sakamoto <ksr>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: All   
OS: All   
Attachments: SDL_ttf.c.patch
render embbeded bitmap/graymap correctly

Description Kouya Sakamoto 2006-04-01 19:41:25 UTC
Hi,

SDL_ttf can't properly render some size of TrueType font which has embedded bitmaps
in case of using TTF_Render..._Shaded() or TTF_Render..._Blended() function.
As its result, we get block images filled noise.

Attached patch prevent this problem by loading only outlined glyph
if it was called from above functions with scaled font.

Regards.
Comment 1 Kouya Sakamoto 2006-04-01 19:44:43 UTC
Created attachment 99 [details]
SDL_ttf.c.patch
Comment 2 Sam Lantinga 2006-05-01 05:39:25 UTC
Can you attach a link to a test font and a showfont command line, so I can test this out?
Comment 3 Kouya Sakamoto 2006-05-06 22:39:58 UTC
I'm sorry that should have attached this.

Sazanami Font is used well in Linux as Japanese font.
http://osdn.dl.sourceforge.jp/efont/10087/sazanami-20040629.tar.bz2
Following command reproduce the issue:

  showfont sazanami-gothic.ttf

There is no problem when you put a "-solid" option to command line.

  showfont -solid sazanami-gothic.ttf

When I set a ptsize to between 8 and 21 with the font, I get a strange result. And I also reproduce the issue with some truetype fonts using generally in Linux as Japanese font, and fonts that come with Windows.
Comment 4 TOYAMA Shin-ichi 2006-07-21 00:08:21 UTC
We met this bug on Tux Paint(Drawing Program for Children: http://www.newbreedsoftware.com/tuxpaint/), and I confirmed that proposed patch is effective to fix this problem.

Until now, with "Kochi" family fonts which has been mostly used as Japanese font on Linux, this bug appears only when relatively small font size (less than 16 point) is specified, so it seems remained unreported.

But with "Sazanami" font, which should be alternative to "Kochi" fonts somtime soon, this bug appears up to 21 point, so this will become more serious.
Comment 5 KANOU Hiroki 2006-07-29 23:52:15 UTC
Created attachment 155 [details]
render embbeded bitmap/graymap correctly

FT_IS_SCALABLE() means that the font is in outline format,
but does not imply that outline is rendered as 8-bit grayscale,
because embedded bitmap/graymap is preferred (see FT_LOAD_DEFAULT
section of FreeType2 API Reference).

I fixed Load_Glyph() to look at the actual number of depth (bits
per pixel) of rendered bitmap/graymap. This patch includes
additional support for graymap in two- or four-bit per pixel.
(FontForge supports the creation of embedded graymap in TTF).
Comment 6 Sam Lantinga 2007-07-14 23:18:52 UTC
This is fixed in subversion revision 3284, thanks!