GNOME Bugzilla – Bug 137624
Font dialog preview strings should be customizable
Last modified: 2006-05-20 23:11:29 UTC
The two font previews that are currently given in the font dialog are not useful for non-latin text. The two previews are the "Aa" button, lets call it the short preview, and the string that is shown when M1 is clicked on the short prieview, let's call it the long preview. The font dialog should add an interface that allows changing the contents of both the long and the short previews. Changing them through the locale is not an acceptable solution since during the same session of gimp I may want to work with two different sub-groups of glyphs. One less than optimal solution would be to change the strings somewhere in the Preference dialog.
*** Bug 158152 has been marked as a duplicate of this bug. ***
Instead of, or in addition to, having the user being able to change the "Aa" it would be a good idea to use heuristics to find out what's the primary script for which the font is designed. For instance, if a font contains OpenType layout tables for the "beng" script, one can be pretty sure it is designed for Bengali, and it would be a good idea to use whatever would be the suitable Bengali alternative to "Aa". If there are no OpenType layout tables, the next step could be to check the font's coverage. Presumably one could use the UnicodeRange and CodePageRange values for TrueType fonts and not have to calculate the exact coverage. Or can this information be had through fontconfig in a simpler way?
Created attachment 62650 [details] [review] First version of patch to HEAD This patch implements script-specific sample strings. It still needs a bit of work, because for fonts that cover lots of scripts (like Arial which covers Greek, Cyrillic, Arabic and Hebrew) it happens to choose the Arabic sample string. One probably should display the traditional Aa for fonts like that. Or maybe a sample string that corresponds to the user's locale? Or give scripts "weights", and add some heuristics. I assume that for fonts that cover Chinese minority scripts like Tibetan (no political standpoint implied) it makes sense to display the Han sample string anyway, even if Tibetan is the more "rare" language? On the other hand, for a font that covers Thai and Latin (and nothing else), for instance, it's definitely the Thai sample string that should be displayed.
The inclusion of PANGO_ENABLE_ENGINE could bite us later. But then, we are already doing that in the current code. I was hoping though that we could get rid of this by porting the GIMP text renderer to PangoRenderer. Anyway, this patch looks interesting and should go in as soon as the issue with fonts that cover lots of scripts has been addressed.
Will work on this more this evening to resolve the pending issues and commit.
Committed to HEAD: 2006-04-04 Tor Lillqvist <tml@novell.com> * app/text/gimpfont.c (gimp_font_get_new_preview): Provide script-specific short sample strings instead of "Aa" for fonts that seem to be designed for some specific non-Latin script. Pending a complete redesign and reimplementation of font selection, this is at least an improvement, and a partial solution to #137624.
I've done some minor cleanups to your code. Please review. 2006-04-04 Sven Neumann <sven@gimp.org> * app/text/gimpfont.c: moved new code to a utility function. Avoid use of deprecated Pango API. Removed tabs and trailing whitespace.
It looks to me appropriate to resolve this as FIXED, and have a new bug report for remaining issues. Based on the comments here, there probably are some, but they are not easy to pick out.