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

Bug#1034050: fonts-creep2: generated font is TrueType, not OpenType



Hi Nate,

2023-04-07 16:14 CEST, nwillis@glyphography.com:
> > The generated font is a TrueType font, not an OpenType font. This does
> > not impact the useability of the package to my knowledge, but would be
>
> On the contrary, all TrueType fonts are also OpenType fonts. OpenType is a
> superset of TrueType, which is older.

Thanks, TIL.

> Similarly, if the intent is to make some sort of distinction based on the
> contents of the tables (e.g., GSUB and GPOS), then the filename extension
> still isn't adequate, because .ttf files can and do include those tables
> (see Noto and many many others).

I do not know how to inspect the tables, but the `file` tool indicates
that creep2.ttf (provided by upstream) and creep2.otb (built by the
package) are reported as TrueType fonts with BDF tables:

    $ file creep2.{ttf,otb}
    $ creep2.ttf: TrueType Font data, 16 tables, 1st "BDF ", 14 names, Macintosh
    $ creep2.otb: TrueType Font data, 15 tables, 1st "BDF ", 14 names, Macintosh

If I take an other font in the opentype directory, the `file` tool
report the file as OpenType:

    $ file /usr/share/fonts/opentype/cantarell/Cantarell-Bold.otf
    /usr/share/fonts/opentype/cantarell/Cantarell-Bold.otf: OpenType font data

> > nice to be fixed. This bug is reported by Lintian under the tag
> > `truetype-font-wrong-filename`.
>
> Well, if that's so, then this indicates that Lintian is likely overdue for a
> refresh on how it determines these things. That might be a big undertaking;
> I don't know at the moment.

I have looked at the source code of Lintian, and the current checks [1]
are quite simple. Quoting:

    return
      unless $file->file_type =~ /^TrueType Font data/;

    $self->pointed_hint('truetype-font-wrong-filename', $file->pointer)
      unless $file->name =~ /\.ttf$/i;

So the check is "if the file type is TrueType and extension != .ttf,
report warning".

[1] https://salsa.debian.org/lintian/lintian/-/blob/ea05801918ed0e87824d89bf16a6ee166450b977/lib/Lintian/Check/Fonts/Truetype.pm

> However, with this particular font:
> >
> > The problem is that the font is located in /usr/share/fonts/opentype
> > instead of /usr/share/fonts/truetype, and that its name is creep2.otb
> > instead of creep2.ttf.
>
> The .otb extension (as well as the .bdf in the package) indicates that this
> is a bitmap font re-wrapped in an OpenType table structure (see
> https://github.com/fonttools/fonttools/issues/684 for the history, and code
> at https://github.com/freedesktop/fonttosfnt or possibly
> https://github.com/ctrlcctrlv/bitmapfont2otb for the internal details); that
> definitely makes it an OpenType font and not a TrueType font, because the
> older TrueType spec did not allow that sort of skullduggery: it required
> vector outlines.

I really have the impression that the generated file has a TrueType
table structure instead of an OpenType table structure according to the
`file` command (and the check done by lintian on the file_type). I
really need to find a way to be sure that the creep2.otb file is really
an Opentype file and not "just" a TrueType file.

I manually add this .otb extension in the fontforge script, but I think
sourceforge is not generating what I want.

> Not all proprietary apps and platforms recognize this usage nor the ".otb"
> extension itself, but HarfBuzz / FreeType / Pango do.

In fact I think that this font is the first "otb" font in Debian, so I
think we should take time to discuss if the resulting font is properly
generated as an example for future other Opentype bitmap fonts.

> > Proposed solution is to rename the directory and the font itself to
> > match the TTF filetype.
>
> Just doing a rename of the binary file could trigger accidental breakage for
> users on apps/stacks who aren't running HarfBuzz / FreeType etc (as above)
> via the standard, modern stack. That would not seem to be a beneficial
> change.
>
> Long term, the underlying fix is that Lintian's font-detection likely needs
> a scrubbing by somebody with a lot more free time at hand than me (although
> billionaires who wish to fund this should still reach out...).
>
> *Long* long term, the FHS and so on likely really need to drop the
> */truetype/ */opentype/ directory distinction, since it's not doing anything
> useful. It's a bit like saying there should be separate /jpg/ and /jpeg/
> directories and older images should only be put in one of them....
>
> I know this TTF/OTF confusion is widespread, but I maintain that fixing it
> is still possible....

You seem to really know your stuff more than I do. I packaged this font
for fun and to use it sometimes. My current problem is that I am not
sure that the creep2.otb font is *actually* an OpenType font.

But if you say that all TrueType fonts are OpenType fonts, then I guess
I cannot verify this easily. I need your expertise to know if the file
is correct and I should ignore lintian, or if the file is incorrect and
I should fix it somehow.

Thanks,

Agathe.


Reply to: