Bug 81453

Summary: Support more font weights?
Product: fontconfig Reporter: Kan-Ru Chen <kanru>
Component: libraryAssignee: fontconfig-bugs
Status: RESOLVED FIXED QA Contact: Behdad Esfahbod <freedesktop>
Severity: normal    
Priority: medium CC: arthur200126, fitojb, freedesktop
Version: unspecified   
Hardware: Other   
OS: All   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=82228
Whiteboard:
i915 platform: i915 features:

Description Kan-Ru Chen 2014-07-17 05:57:22 UTC
Recently Adobe & Google released a open-source pan-CJK font, Source Han Sans from Adobe or Noto Sans CJK from Google.

This font family features 7 font weights: ExtraLight, Light, Normal, Regular, Meidum, Bold, Heavy and their os2 weight are: 100, 300, 350, 400, 500, 700, 900 respectively.

However, in fontconfig, os2 weight class 350 and 400 both maps to weight 80 and I think this makes fontconfig or pango confuse about how to choose the default font.

In particular in the GktFontChooser user can't choose one of these fonts. To fix this we probably also have to fix Pango.

This issue is also reported to the source-han-sans project: https://github.com/adobe-fonts/source-han-sans/issues/5
Comment 1 Behdad Esfahbod 2014-07-19 20:54:16 UTC
I believe this is a Pango limitation, not fontconfig.  I'll take a look.
Comment 2 Behdad Esfahbod 2014-07-25 19:05:18 UTC
My bad, this *is* a fontconfig issue.  Investigating.
Comment 3 Behdad Esfahbod 2014-07-25 22:09:03 UTC
Fontconfig part fixed.  Pango fix needed.

commit ffda7c0e8130eb107ecbb3bdc48043093b12dff9
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Fri Jul 25 17:59:26 2014 -0400

    Linearly interpolate weight values
    
    Rest of Part of https://bugs.freedesktop.org/show_bug.cgi?id=81453
    
    Adds new API:
    
        FcWeightFromOpenType()
        FcWeightToOpenType()

commit bf9df5ada77469f57101851f6b4e279a4a5ea087
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Fri Jul 25 18:07:10 2014 -0400

    Change DemiLight from 65 to 55
    
    Such that Regular is closer to Medium than to DemiLight

commit be6506ca04ccce10868a8cd51d89e586284d149b
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Fri Jul 25 16:24:26 2014 -0400

    Add FC_WEIGHT_DEMILIGHT
    
    Part of https://bugs.freedesktop.org/show_bug.cgi?id=81453
    Also hooks up FC_WEIGHT_BOOK to fcfreetype.c.
Comment 4 Behdad Esfahbod 2014-07-25 22:13:35 UTC
Tracking pango issue here:
https://bugzilla.gnome.org/show_bug.cgi?id=733764
Comment 5 Behdad Esfahbod 2014-07-26 20:42:43 UTC
Pango fixed.  See screenshots here: https://bugzilla.gnome.org/show_bug.cgi?id=733764
Comment 6 Daphne Pfister 2014-08-06 07:09:56 UTC
(In reply to comment #3)
> Fontconfig part fixed.  Pango fix needed.
> 
> commit ffda7c0e8130eb107ecbb3bdc48043093b12dff9
> Author: Behdad Esfahbod <behdad@behdad.org>
> Date:   Fri Jul 25 17:59:26 2014 -0400
> 
>     Linearly interpolate weight values
>     
>     Rest of Part of https://bugs.freedesktop.org/show_bug.cgi?id=81453
>     
>     Adds new API:
>     
>         FcWeightFromOpenType()
>         FcWeightToOpenType()

Note that this fix introduced bug 82228 as lerp doesn't handle dy == 0.
Comment 7 Behdad Esfahbod 2016-03-12 04:44:48 UTC
*** Bug 94505 has been marked as a duplicate of this bug. ***

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.