Re: Local patching of fonts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 5, 2013 at 5:29 AM, Paul Flo Williams <paul@xxxxxxxxxxxxx> wrote:
> 1. FontTools/TTX, which can convert a font into XML and back again.
> However, Petr reports that it currently crashes on Open Sans[3], and we
> have no smart way of verifying that the "To XML, patch, compile to TTF"
> cycle produces a font that performs at least as well as the original.

As mentioned downthread, we really ought to switch to Behdad's fork of
fonttools in Fedora.  It would solve a lot of issues we're having.

> I was considering the construction of another, more general, tool that
> would perform adjustments to other OS/2 or name table fields in-place[*],
> adjusting checksums as necessary in order to keep the font consistent, but
> specifically not decompiling the font or attempting to do glyph or GPOS
> type changes.
>
> The proposed method would be to write a very simple recipe for the font
> changes, like this:

I wrote a little utility called ttname for updating the name table to
address concerns about licensing metadata not matching for webfonts.
(Just `yum install ttname` to use it.)  It uses ttx under the hood,
but it avoids serializing anything but the name table to XML to avoid
potential issues messing up the other tables.  (Not that there should
be any issues according to Behdad, who definitely would know.  :-)

With it, this:

>   name.1.0.0.1="Letters Laughing at Their Execution"
>   name.1.0.0.2="Regular"
>   name.1.0.0.4="Letters Laughing at Their Execution"

is just:

ttname -p1 -e0 -l0 \
  --name1="Letters Laughing at Their Execution" \
  --name2="Regular" \
  --name4="Letters Laughing at Their Execution" \
  font.otf

It also has an -a switch to perform the same changes on all
platform/language/encoding combinations instead of having to
inidvidually specify them, and some named arguments for those who
don't know the numbers of the top of their head, so more succinctly:

ttname -a \
  --family="Letters Laughing at Their Execution" \
  --subfamily="Regular" \
  --name="Letters Laughing at Their Execution" \
  font.ttf

It doesn't currently support modifying the OS/2 table but I could add
support for that fairly easily.  (Of course, then the name wouldn't be
very accurate, but oh well.  ;-)

> Note that the patch recipe contains deliberately almost-duplicated lines;
> I'd suggest that it's better to repeat the name record lines for Mac and
> Windows compatibility rather than try to build a cleverer ttpatch that
> would try to keep the names consistent across platforms and fail in the
> case of localisation differences, for instance.

99% of the time there's only one language in the name table, so I
figured the -a switch would be useful.  You can still specify the
individual platform/encoding/lang triplets for the edge cases.

-T.C.
_______________________________________________
fonts mailing list
fonts@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/fonts
http://fonts.fedoraproject.org/





[Index of Archives]     [Fedora Users]     [Font Configuration]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux