source-foundry / Hack

A typeface designed for source code
http://sourcefoundry.org/hack/
Other
16.52k stars 613 forks source link

Use systemId urn:fontconfig:fonts.dtd to reference the fonts.dtd type defintion #644

Open hegjon opened 2 years ago

hegjon commented 2 years ago

When packaging font for Fedora Linux, the RPM macro will check if the fontconfig is valid by running the xmllint command.

Before:

Hack/config/fontconfig on  master
❯ xmllint --loaddtd --valid --nonet 45-Hack.conf
45-Hack.conf:2: warning: failed to load external entity "fonts.dtd"
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
                                        ^
45-Hack.conf:3: validity error : Validation failed: no DTD found !
<fontconfig>
           ^
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <!-- Declare Hack a monospace font -->
  <alias>
    <family>Hack</family>
    <default><family>monospace</family></default>
  </alias>
  <!-- if this file is put in user’s configuration, unset sans-serif family -->
  <match>
    <test compare="eq" name="family">
        <string>sans-serif</string>
    </test>
    <test compare="eq" name="family">
        <string>Hack</string>
    </test>
    <edit mode="delete" name="family"/>
  </match>
</fontconfig>

After:

Hack/config/fontconfig on  fontconfig
❯ xmllint --loaddtd --valid --nonet 45-Hack.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
  <!-- Declare Hack a monospace font -->
  <alias>
    <family>Hack</family>
    <default><family>monospace</family></default>
  </alias>
  <!-- if this file is put in user’s configuration, unset sans-serif family -->
  <match>
    <test compare="eq" name="family">
        <string>sans-serif</string>
    </test>
    <test compare="eq" name="family">
        <string>Hack</string>
    </test>
    <edit mode="delete" name="family"/>
  </match>
</fontconfig>