Bug 12939 - API for querying languages and their charsets
Summary: API for querying languages and their charsets
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.4
Hardware: Other All
: medium normal
Assignee: Keith Packard
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 12917
  Show dependency treegraph
 
Reported: 2007-10-25 20:05 UTC by Behdad Esfahbod
Modified: 2007-11-05 12:57 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Behdad Esfahbod 2007-10-25 20:05:54 UTC
Please expose the .orth file data through some API.  I suggest one for enumerating all known languages and the currently private FcCharSetForLang().
Comment 1 Behdad Esfahbod 2007-10-26 00:29:39 UTC
Patch is in master branch of my repo:

git+ssh://people.freedesktop.org/~behdad/fontconfig

Sample usage in:

http://svn.gnome.org/viewvc/pango/trunk/tools/gen-script-for-lang-new.c?view=markup
Comment 2 Nicolas Mailhot 2007-10-26 01:02:05 UTC
Another non-fontconfig user of orth files is dejavu  (used to generate a script coverage table at build-time so users and distribution packagers know what locales to check before deploying a new dejavu version).

That's a common need when a new font is proposed for inclusion in a distro, it's a shame only dejavu does it.

It's probably cleaner to just add a small tool that takes a ttf/otf file as input and outputs its script coverage table to fontconfig rather than expose the orth files themselves tough. The current dejavu method is a rather ugly orth-parsing perl script
Comment 3 Keith Packard 2007-10-26 10:09:19 UTC
uh, you can already get fontconfig to generate coverage information for a font file; just scan it and look at the resulting pattern. Seems like dejavu could create a fairly simple program to do this.
Comment 4 Nicolas Mailhot 2007-10-26 11:05:31 UTC
Well, if the dejavu folks where code-inclined, they'd be rewriting fontforge, not creating fonts

The aforementioned table is this one
http://dejavu.svn.sourceforge.net/viewvc/dejavu/trunk/dejavu-fonts/langcover.txt?revision=1922&view=markup
Comment 5 Behdad Esfahbod 2007-10-26 15:14:31 UTC
I try to write fc-scan to do just that...

Nicolas, the only thing DejaVu will lose is the language names.  They can of course use iso639 package to lookup language names.
Comment 6 Nicolas Mailhot 2007-10-27 01:46:57 UTC
Thanks! If we can have a nice standard tool we may even start adding a language coverage table in %doc to other font packages in Fedora. The table is a quick way for users to check their script is covered by foo font (which may or may not be a problem for them)
Comment 7 Behdad Esfahbod 2007-10-31 21:06:22 UTC
Should be ready to go in.  Renamed FcCharSetForLang() to FcLangGetCharSet() and pushed to my repo.
Comment 8 Keith Packard 2007-11-03 23:48:57 UTC
Please eliminate the 'optimizations' here that cache some of this computation; we don't expect these APIs to be heavily used, and I'd prefer to see simpler code in this case. Also, the documentation should go into the new fclangset.sgml file.

This appears to be the last bug standing before 2.5 can be released, although I need to do another scan over the debian bug database and add anything I find there.
Comment 9 Behdad Esfahbod 2007-11-04 21:12:32 UTC
Ah, just saw this message of yours.

(In reply to comment #8)
> Please eliminate the 'optimizations' here that cache some of this computation;
> we don't expect these APIs to be heavily used, and I'd prefer to see simpler
> code in this case. Also, the documentation should go into the new
> fclangset.sgml file.

Makes sense.  Will do this early tomorrow.
 
> This appears to be the last bug standing before 2.5 can be released, although I
> need to do another scan over the debian bug database and add anything I find
> there.
Comment 10 Behdad Esfahbod 2007-11-05 12:31:24 UTC
Updated my branch.  Had to fix a couple bugs in doc/edit-sgml.c to get it going too.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.