[haiku-development] Re: How to identify an Fixed font
- From: Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Tue, 15 May 2012 08:48:10 +0200
2012/5/15 韩鹏飞 <pengphei@xxxxxxxxx>:
> Hello all.
Hi,
> As for the tickets about Chinese fonts issues. I found that the key of them
> is Fixed font.
>
> for some apps or web pages, Fixed font is used as the default font showing
> them, but
> the Fixed fonts setting by Haiku can't be set as Chinese font, like
> WenQuanYi fonts.
That's because those fonts (like, AFAIK, every other CJK font) are not
fixed fonts.
Unlike a traditional fixed font, where all the glyphs have the same
width, CJK fonts contains glyphs of two different widths (called
fullwidth and halfwidth).
http://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms
Haiku has an api to identify these kind of fonts
(BFont::IsFullAndHalfFixed()), although it's not implemented
correctly, at the moment, because freetype (the library we use for
handling fonts) doesn't return this information.
What can be done:
the app_server could, on font load, check all the glyphs contained in
a given font to see if they are of just two different widths, and then
add a flag to mark it as "full and half fixed".
I have no idea if this would have acceptable performances.
Then, when this api works, applications could chose to handle these
kind of fonts (Terminal does, for example).
> So when they are displaying, the Chinese chars can't be rendered correctly
> instead of
> a rectangle box.
>
> So how does Haiku font server identify Fixed Fonts?
We check a flag returned by freetype, which (correctly) doesn't
classify these fonts as fixed fonts, because they are not.
> As far as I known, WenQuanYi ZenHei font is Fixed width, but it can't be
> identified as
> Fixed. If we can fix this problem, then the Chinese fonts displaying problem
> will be solved.
See above.
Hope it's clear enough.
Bye!
Other related posts: