Bug 27765 - FcMatch() returns style in wrong language
Summary: FcMatch() returns style in wrong language
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.7
Hardware: Other All
: medium normal
Assignee: Akira TAGOH
QA Contact: Behdad Esfahbod
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-20 20:47 UTC by Behdad Esfahbod
Modified: 2012-04-23 20:58 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Behdad Esfahbod 2010-04-20 20:47:58 UTC
It simply returns the style (and family I guess?) in the first language (in the FcLangSet order?).

Try with "fc-match arial" or "fc-match freesans" for example.

http://bugzilla.novell.com/show_bug.cgi?id=457427
http://bugs.launchpad.net/ubuntu/+source/fontconfig/+bug/105900
Comment 1 Petr Gajdos 2010-05-27 00:38:08 UTC
Behdad, what's the progress here? Can I help somehow? Or is it fixed yet -- can I download the patch somewhere?
Comment 2 Behdad Esfahbod 2010-06-02 14:54:28 UTC
Not yet.  Working on it this week.
Comment 3 Petr Gajdos 2010-06-14 07:09:27 UTC
(In reply to comment #2)
> Not yet.  Working on it this week.

Ok, thanks a lot!
Comment 4 Mark Russell 2010-10-31 06:48:13 UTC
Hi Behdad.  Anything new on this?
Comment 5 Behdad Esfahbod 2010-10-31 11:21:08 UTC
Not yet, got stuck with harfbuzz hacking.  I'll give fontconfig another push soon.
Comment 6 Behdad Esfahbod 2011-04-06 08:01:21 UTC
From a mail I sent today:

This is how I think this should be fixed:

Add a new element FC_NAME_LANG="namelang".

In FcFreeTypeQuery, perhaps set FC_NAME_LANG to the intersection of
FC_FAMILY_LANG and FC_STYLE_LANG.  Or maybe don't.  Not going to use this
directly.

In FcConfigDefault, if FC_NAME_LANG is empty, fill it in from default locale
language.  Then if FC_FAMILY_LANG is empty, copy it from FC_NAME_LANG.  Same
for FC_STYLE_LANG and FC_FULLNAME_LANG.  This way, FC_NAME_LANG is how the
user will request names in a particular language.

In FcFontRenderPrepare, when deciding what FC_FAMILY and FC_STYLE to choose,
choose the first one that has a _LANG equivalent present in the query
pattern's respective _LANG element.

That should do it.
Comment 7 Akira TAGOH 2012-03-26 00:37:33 UTC
the proposed patch:
http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz27765
Comment 8 Akira TAGOH 2012-04-06 01:50:36 UTC
updated a bit to add *lang object to the pattern like the original behavior.
Comment 9 Akira TAGOH 2012-04-06 03:32:53 UTC
I guess we should change the code for FcFontList() too.
Comment 10 Akira TAGOH 2012-04-08 20:05:41 UTC
updated fclist.c too:
http://cgit.freedesktop.org/~tagoh/fontconfig/commit/?h=bz27765
Comment 11 Akira TAGOH 2012-04-11 00:10:49 UTC
The patch will change the behavior compared to current one. particularly with:
http://cgit.freedesktop.org/~tagoh/fontconfig/tree/src/fcdefault.c?h=bz27765#n196
http://cgit.freedesktop.org/~tagoh/fontconfig/tree/src/fclist.c?h=bz27765#n382

the result on LANG=ja_JP say will looks like:
(On fontconfig-2.9.0)
/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: 文泉驛點陣正黑,WenQuanYi Zen Hei Sharp,文泉驿点阵正黑:style=Regular

(with patch)
/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc: WenQuanYi Zen Hei Sharp,文泉驛點陣正黑,文泉驿点阵正黑:style=Regular

Anyway, that should be trivial.
Comment 12 Akira TAGOH 2012-04-23 20:58:22 UTC
committed with 7587d1c9.


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.