<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Writing name.preferredFamilyname of a font in <prefer> tag messes up with name.font{,sub}Family"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=94505">94505</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Writing name.preferredFamilyname of a font in <prefer> tag messes up with name.font{,sub}Family
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>fontconfig
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>library
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>fontconfig-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>arthur200126@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>freedesktop@behdad.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Many True/OpenType fonts, like Noto Sans CJK ("notocjk") in this example, uses
a pattern in "name" table where:

* name.fontFamily gives the full name (with style) of the font and Subfamily is
always Regular
* name.preferredFamily gives the actual family name and Subfamily is the actual
weight

Fontconfig doesn't seem to be capable of handling such a case. Specifically,
given a config file which <prefer>s notocjk:

        <alias>
                <family>sans-serif</family>
                <prefer>
                        <family>Noto Sans CJK SC</family>
                        <family>Noto Sans CJK TC</family>
                </prefer>
        </alias>

Fontconfig will produce a match like:

$ fc-match --verbose
Pattern has 38 elts (size 48)
        family: "Noto Sans CJK SC"(s) "Noto Sans CJK SC DemiLight"(s)
        familylang: "en"(s) "en"(s)
        style: "DemiLight"(w) "Regular"(w)
        stylelang: "en"(w) "en"(w)
        fullname: "Noto Sans CJK SC DemiLight"(w)
        fullnamelang: "en"(w)
        [...]

Now here is the problem. By preferring the preferredFamily "Noto Sans CJK SC",
fontconfig ended up also preferring "Noto Sans CJK SC DemiLight", and matched
"Noto Sans CJK SC DemiLight" "Regular" for the implicit "Regular".

See <a href="https://bugs.launchpad.net/ubuntu/+source/language-selector/+bug/1468027">https://bugs.launchpad.net/ubuntu/+source/language-selector/+bug/1468027</a>
for a context of this problem.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>