Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unwanted info warnings from EPUBCheck when TTF font files are used #1119

Open
SteelWagstaff opened this issue Oct 13, 2022 · 0 comments
Open
Assignees

Comments

@SteelWagstaff
Copy link
Member

SteelWagstaff commented Oct 13, 2022

Issue: Our EPUB exports now generate validation warnings. These are technically not errors -- they're "Info" notes, which are defined by EPUBCheck as "A noteworthy information about your content." However, the message we display to users is "Warning: The export has validation errors. See logs for more details." See https://github.com/pressbooks/pressbooks/blob/51612fbe611a0d70883c588f0a9f4701f2a550de/inc/modules/export/class-export.php#L777-L838.

This repo bundles a lot of TTF files which are used in the font stacks of several of its child themes: https://github.com/pressbooks/pressbooks-book/tree/dev/assets/book/typography/fonts. These are referenced in the font stack SCSS partials: https://github.com/pressbooks/pressbooks-book/tree/dev/assets/book/typography/styles. See https://github.com/pressbooks/pressbooks-book/search?q=ttf.

We also include references to TTF files as part of a Pressbooks theme option: https://github.com/pressbooks/pressbooks/blob/9512bc006b5f193da3321a52cac451bcb747ec14/inc/class-globaltypography.php#L295-L422 and in a few other places/tests in that repo: https://github.com/pressbooks/pressbooks/search?q=ttf

Proposed solution:

  1. Remove all unneeded TTF files (i.e. those used only by deprecated/retired themes): Remove fonts only used by retired themes #1120.
  2. For those that remain, we should replace the TTF files with WOFF files. https://google-webfonts-helper.herokuapp.com/ can help generate the needed files. See https://www.oreilly.com/library/view/epub-3-best/9781449329129/ch04.html#how_to_embed for recommendations for how to embed fonts properly in EPUB3

Notes

Prince supports the use of WOFF or WOFF2 files: https://www.princexml.com/doc/styling#fonts

EPUB reader support for embedded fonts has been a mess for a long time. See https://www.oreilly.com/library/view/epub-3-best/9781449329129/ch04.html and https://www.oreilly.com/library/view/epub-3-best/9781449329129/ch04.html

The new EPUB3 spec now requires reading systems to support OpenType and WOFF font formats. See https://idpf.org/epub/30/spec/epub30-contentdocs.html#sec-css-fonts + https://idpf.org/epub/30/spec/epub30-changes.html#sec-new-changed-embedded-fonts

Browser support for OTF/TTF and WOFF is essentially interchangeable: https://caniuse.com/ttf + https://caniuse.com/woff
OTF files for the Noto fonts we use are available at https://github.com/googlefonts/noto-fonts/tree/main/unhinted/otf
On the difference between TTF and OTF: https://www.makeuseof.com/tag/otf-vs-ttf-fonts-one-better/
On the difference between TTF/OTF and WOFF: https://fonts.google.com/knowledge/glossary/web_font
See also https://www.news47ell.com/blog/host-google-fonts-locally-wordpress + https://www.news47ell.com/blog/host-google-fonts-locally-wordpress
Related issues: pressbooks/pressbooks#1629 + #752 + pressbooks/ideas#408 + pressbooks/pressbooks-book-directory-fe#423

Here's some sample log output:

Array
(
    [time] => Thu Jun  9 02:12:59 2022
    [user] => steel
    [site_url] => https://integrations.pressbooks.network/epubtest
    [blog_id] => 536
    [theme] => Malala
)
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(3,3): Font-face reference "EPUB/assets/EncodeSans-Regular.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(8,3): Font-face reference "EPUB/assets/EncodeSans-Bold.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(13,3): Font-face reference "EPUB/assets/EncodeSans-ExtraBold.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(18,3): Font-face reference "EPUB/assets/EncodeSans-Light.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(23,3): Font-face reference "EPUB/assets/Raleway-Bold.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(28,3): Font-face reference "EPUB/assets/Raleway-BoldItalic.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(33,3): Font-face reference "EPUB/assets/Raleway-SemiBold.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(38,3): Font-face reference "EPUB/assets/Raleway-SemiBoldItalic.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(43,3): Font-face reference "EPUB/assets/Raleway-Regular.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(48,3): Font-face reference "EPUB/assets/Raleway-Medium.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(53,3): Font-face reference "EPUB/assets/Raleway-MediumItalic.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(58,3): Font-face reference "EPUB/assets/Raleway-RegularItalic.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(63,3): Font-face reference "EPUB/assets/Raleway-Light.ttf" refers to non-standard font type "font/sfnt".
INFO(CSS-007): /srv/www/integrations.pressbooks.network/releases/20220608202328/web/app/uploads/sites/536/pressbooks/exports/EPUB-Test-1654740770.epub/EPUB/malala.css(68,3): Font-face reference "EPUB/assets/Raleway-LightItalic.ttf" refers to non-standard font type "font/sfnt".
See https://www.w3.org/publishing/epubcheck/docs/messages/

Font-face reference "%1$s" refers to non-standard font type "%2$s". Explanation: Font core-types are "TrueType", "OpenType", "WOFF" and "WOFF2"
@SteelWagstaff SteelWagstaff self-assigned this Oct 13, 2022
@SteelWagstaff SteelWagstaff changed the title Weed and update bundled font files Fix unwanted info warnings from EPUBCheck when TTF font files are used Feb 17, 2023
@SteelWagstaff SteelWagstaff changed the title Fix unwanted info warnings from EPUBCheck when TTF font files are used Unwanted info warnings from EPUBCheck when TTF font files are used Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant