GNOME Bugzilla – Bug 112503
pango should use the same font for entire script run
Last modified: 2004-12-22 21:47:04 UTC
Right now if a run of non-basic characters are input, e.g. by inserting ABC DEF where ABC and DEF e.g. indicate Hebrew characters, the words ABC and DEF are separately rendered in a Hebrew font and the space between the words is rendered in an "Latin" font. Very often the space of the "Latin" font has a height that is larger than the space of the Hebrew font. As a result the height of the line changes once the space is typed. The solution is to render spaces according to the font of surrounding characters. If the two sides have different fonts, it would make sense to use the largest font height of the two fonts.
What I was thinking was right is that after we determine the script for each character as in bug 91542, we try to find a font that covers the _entire_ script run instead of finding the font individually for each character. Only when we can't find a font that satisfies the entire run, do we switch to a different font. Though actually, this isn't quite right since you never want to use something other than the default font for for the script range for the whole range.
What I ended up doing was picking fonts for rendering characters individually, then picking fonts for non-rendering characters based on the adjacent rendering characters. This is to deal with things like ZWJ/ZWNJ which might not even be in the fonts. The changes I checked in also help in this regard because they correct language tags based on script information ... if you have "ABC DEF" and the language tag is "en" but the script is HEBREW, then Pango corrects the language tag to "he" for the entire run.