GNOME Bugzilla – Bug 323661
pango-querymodules sort order
Last modified: 2015-08-15 03:09:44 UTC
from bug #322869 I'd like the ability for the order that the modules come in the pango.modules file be something other than random (so that graphite can be last in the list). Behdad would like the logic to be in querymodules. Currently querymodules opens each directory in the config and reads the modules in that directory in the order glib gives it. An alternative is to put the logic into update-pango-modules(bug #322869). (I don't care where as long as it is something that works and is acceptable). This assumes that the fact that modules later in the pango.modules file are preferred to those before them won't change.
As I recall, at GUADEC, I suggested deleting all the { PANGO_SCRIPT_ARMENIAN, "*" }, and so forth out of basic-fc.c and leave just { PANGO_SCRIPT_COMMON, "" } That shouldn't have any affect on choice of the basic modules unless the graphite module is installed, and then it will always prefer the graphite module (If the graphite module lists itself as { PANGO_SCRIPT_COMMON, "*" }) This doesn't encapsulate some of the tricky font-choice issues, but ordering wouldn't help there either. There's no way by controlling ordering that you can win over arabic-fc.c when there is a Silf table and not when there is a GSUB table. Did you try that?
Created attachment 58617 [details] [review] test for a graphite subdir after other modules I still have to do the test for correct behaviour that Owen proposed wrt graphite, opentype and 'dumb' arabic fonts getting the right shaper. I've found that Doulos SIL still uses the basic shaper (as latin) unless latin:* is specified so I think that means that just having common just isn't enough. This patch adds a special case - if a pangorc file hasn't been used to specify the directories to check then pango-query-modules will check a graphite subdir and add those modules last if they are found.
A definitely better approach is to scan the default directory (or any set directory) recursively. I prefer to solve the problem such that modules do not need special support from Pango to work.
Created attachment 61444 [details] [review] check subdirs of default modules directory for modules as well I've made it so it checks just the subdirectories of the default directory. Do you want me to go ahead and change it to search recursively, and search subdirs in non-default directories - though that might get confusing if you put a subdir into PangoModules and get modules appearing more than once in the file.
Well, with recursive comes infinite recursion avoidance and other nasty stuff. Unless there's some glib magic to do it for us, I won't require it. Duplication avoidance on the other hand seems easy enough to be worth doing.
Created attachment 68220 [details] [review] pango-querymodules to check sub-directories and check for duplicates added a check for duplicates (store gquarks of the module filenames in a GSlist). outputs a warning comment if there is a duplicate and only uses the first module. made patch against current cvs. Thanks, Daniel
Thanks Daniel for the patch. I wanted to commit it to put in today's devel release, but I highly prefer if the patch is reworked to: 1) Instead of appending subdirs to the path string and later breaking it, I suggest writing a function to process a directory, and it then can handle modules. 2) Make the subdir-searching logic fetch the list of subdirs and sort them first. 3) Given above, it makes sense to move modules we install into a subdir called 50default, such that you can put modules before or after them. 4) A hashtable instead of a GSList makes more sense. Thanks
While we're at it, it makes sense to make pango install its modules in say $libdir/pango-1.13.3/modules, and also scan the current place as it's been doing already. This way, multiple versions of the library can coexist and share external modules. It defeats the ordering though, forcing all pango modules before or after external modules.
Just dumping ideas... Another approach that may actually make more sense is to not make directory search recursive, but make it possible to have multiple pango.modules defined in the pangorc file. Next, make pango read all files inside a directory instead of one pangorc file. So: Pango sorts and parses /etc/pango/pangorc/* Default configuration, if any, can go into /etc/pango/pangorc/50default And an external library installing modules somewhere, can drop a file in there, appending to ModuleFiles. I'll try to give these more thought and come up with a proposal.
Another idea, given Owen's approach to bug 458674, would be to get rid of pango.modules files on Linux and make pango-querymodules generate fontconfig config files, so we can use fontconfig's directory scanning that is already there.
no longer relevant.