View previous topic :: View next topic |
Author |
Message |
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Sat Feb 17, 2007 9:27 am Post subject: Fonts! Some sizes glitchy with some fonts |
|
|
In the ftgldemo on Windows, if I choose to use the fonts 'msmincho.ttc' or 'msgothic.ttc', then FaceSize 18 which is used for the infoFont doesn't work. All the characters look like garbage. Sizes 10--22 are all bad in fact. Smaller is ok, and bigger is also ok.
Those are the only two fonts I've found that have the problem, though I haven't tried them all.
If you don't have them in you c:\windows\fonts dir you can get them by enabling Japanese in the "Regional and Language Options" control panel, then click on "Install files for East Asian langauges".
Any idea what the problem is? |
|
Back to top |
|
|
Bradley Smith
Joined: 20 Jun 2006 Posts: 60
|
Posted: Sat Feb 17, 2007 7:59 pm Post subject: |
|
|
No. I don't off-hand have an idea what the problem is. As a workaround, can you use one of the larger sizes and scale it down with OpenGL?
I won't be able to look into this immediately. My Windows is behaving very badly, I need to reinstall Windows first. |
|
Back to top |
|
|
rsl
Joined: 04 Jan 2006 Posts: 47
|
Posted: Wed Feb 21, 2007 3:31 am Post subject: |
|
|
That problem is caused by embedded bitmap.
'msgothic.ttc' use embedded bitmap, font size 10-22.
it need to pass FT_LOAD_NO_BITMAP to FT_Load_Glyph.
or disable TT_CONFIG_OPTION_EMBEDDED_BITMAPS when build freetype. |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Wed Feb 21, 2007 11:58 am Post subject: |
|
|
rsl wrote: | That problem is caused by embedded bitmap.
'msgothic.ttc' use embedded bitmap, font size 10-22.
it need to pass FT_LOAD_NO_BITMAP to FT_Load_Glyph.
or disable TT_CONFIG_OPTION_EMBEDDED_BITMAPS when build freetype. |
Excellent tip rsl! That makes a lot of sense. And sure enough, if I change infoFont in the ftgldemo.d from a FTGLPixmapFont into an FTGLBitmapFont, everything works fine.
Also confirmed that adding the FT_LOAD_NO_BITMAP flag to ftglpixmap.d:107 fixes it:
Code: |
FTGlyph MakeGlyph(uint g) {
FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING|FT_LOAD_NO_BITMAP);
if( ftGlyph)
{
FTPixmapGlyph tempGlyph = new FTPixmapGlyph( ftGlyph);
return tempGlyph;
}
err = face.Error();
return null;
}
|
I'm not sure what the thinking is behind the embedded bitmaps, but I did find that with a 10 pt MSMINCHO font, pixmaps were pretty much illegible, while bitmaps were still ok. At 18pts however, the pixmaps looked as good as the bitmaps (a little better really because of the antialiasing).
So that suggests to me that the FT_LOAD_NO_BITMAP should just be set by default in the MakeGlyph methods of all non-bitmap font types. Let the user decide whether or not to use embedded bitmaps based on choice of FTGL font type. That seems to make the most sense given FTGL's purposes. |
|
Back to top |
|
|
Bradley Smith
Joined: 20 Jun 2006 Posts: 60
|
Posted: Wed Feb 21, 2007 4:23 pm Post subject: |
|
|
baxissimo wrote: | So that suggests to me that the FT_LOAD_NO_BITMAP should just be set by default in the MakeGlyph methods of all non-bitmap font types. Let the user decide whether or not to use embedded bitmaps based on choice of FTGL font type. That seems to make the most sense given FTGL's purposes. |
I agree. I'll make that change soon.
Thanks for tracking this down. |
|
Back to top |
|
|
|