Skip to content

Improve checking of font types and fallbacks in CSS #586

@tofi86

Description

@tofi86

OpenType fonts with TrueType outlines (*.ttf) shouldn't generate a WARNING

WARNING (CSS-007) at "Dummy_EPUB3.epub/OEBPS/stylesheet.css" (line 18, col 71):
   Font-face reference OEBPS/fonts/PT-Sans-Italic.ttf refers to non-standard font type application/x-font-ttf.

This WARNING is not true.
The PT-Sans-Italic.ttf is an OpenType font with TrueType outlines which should be perfectly valid.
However, it's declared as application/x-font-ttf in the content.opf file which may seem wrong, but it's still the correct mime-type for OpenType with TrueType outlines.

Also, epubcheck seems to ignore the format() property of the @font-face declaration:

@font-face{
    font-family: 'PT-Sans';
    font-style: italic;
    font-weight: normal;
    src: url("fonts/PT-Sans-Italic.ttf") format('opentype');
}

Seems as epubcheck only checks the file extension and throws a warning for *.ttf in general instead of checking the format() property and then examining the font file itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions