fontforge/fontforge — pull request #1812 by tshinnic (2014-10-18 04:58:13+00:00)
Title: Export initial first font kern class to SVG

Issue #1811 reported that kerning information was lost when generating
an SVG file from a TTF from Google. The first item displayed within
the Element / Font Info / Lookups / GPOS / 'kern' lookup class 2
dialog was not seen in the generated SVG file, while all other shown
kerning classes could be found represented in SVG `` lines.

`fontforge/svg.c` routine `svg_dumpkerns()` first outputs char kern pairs
and then outputs font-based GPOS lookup kern information. It would skip
the first entries in the font `sf->firsts[]` and `sf->seconds[]` lists.
This was reasonable for `sf->seconds[]` as this is a placeholder entry for
the "{Everything Else}" list entry seen in the kerning dialog display.
But the initial entry in the `sf->firsts[]` list *[might](https://github.com/fontforge/fontforge/blob/c53b96929d8878a3dfcac2279c400a34b629bb08/fontforge/parsettfatt.c#L628-L631) [not](https://github.com/fontforge/fontforge/blob/c53b96929d8878a3dfcac2279c400a34b629bb08/fontforge/parsettfatt.c#L105-L106)* be a dummy
entry.

This change has `svg_dumpkerns()` dump the initial entry in `sf->firsts[]`
if it is 'significant', containing information. This has the side-effect
of being a little more careful, checking for non-NULL before using the
pointers.

After this change the generated SVG file contained the desired additional
information, with that being the only change to the SVG output.

This change addresses and should close issue #1811, as class-based kerning
information is now correctly exported to the SVG file.

However there may be other issues with character-based kerning information
export. It is hard to follow the logic, understand the input or output,
and the broken TTF from Google doesn't help...