PanGorilla Selects Fonts Then Never Uses Them Again



Once pango_fc_font_map_get_patterns gets a font-set from FcSort, it dutifully prepares each one for display, and then throws this font-set into it's cache.

It seems to grab the first font in the font-set to use for display and starts displaying glyphs. For each glyph,it calls Xft convert between gunicode and an internal representation. All is well until Xft returns a 0, which means the currently selected font doesn't have a glyph for that unicode. Try U+4d17 for example, as it's a seldom used Chinese font.

Now, things get interesting.

Instead of moving on to the next font in the font-set, pango says in effect, oh-well, better display a little box with the unicode number in it. It asks for a monospace-5 font-set, which it receives from FcSort, and proceeds to display the little box. When done, it goes back to where it was displaying the glyph string - still using the first font in the font-set.

Why go to all the trouble of managing a font-set, if all you ever do is just use the first font? For my test case, the font-set consisted of 25 fonts that were fully prepared for display.

Or, on the other hand, shouldn't the realization routine try other fonts in the font-set BEFORE it gives up and prints the little box?

Furthermore, the first font selected was a UNICODE scalable font, so pango could have used it to display the little box numbers. Why didn't it do so, and skip all the muck with the monospace-5 font-set? As well, PanGorilla did it's best to go back to LANG = en for the selection of the monospace-5 font-set. It should have stuck with the prefered zh-cn.

Additionally, out of the 25 fonts that were selected in the first font-set, only 6 supported LANG = zh-cn. What business does PanGorilla have with the remaining 19? None.

In short, I've had to change:

1. Get PanGorilla to properly use LANG.

2. Modify the glyph realization routine to try the other fonts before giving up.

3. Hack into pango_fc_font_map_get_patterns so that it will only recognize, setup, and use LANG = zh-cn supported fonts.

---

I can now see why PanGorilla is only used in GTK2, and never spread beyond it. (It's undocumented, it resists internationalization, it doesn't support needed features such as the PINYIN input system, it's buggy, the overall design seems hacked in by a principal software engineer with no consideration to the overall architecture,...)





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]