diff options
| -rw-r--r-- | WORKLOG.adoc | 2 | ||||
| -rw-r--r-- | data/fonts/noto-serif-bold-italic.ttf | bin | 282600 -> 194452 bytes | |||
| -rw-r--r-- | data/fonts/noto-serif-bold.ttf | bin | 314388 -> 191908 bytes | |||
| -rw-r--r-- | data/fonts/noto-serif-italic.ttf | bin | 274296 -> 166312 bytes | |||
| -rw-r--r-- | data/fonts/noto-serif-regular.ttf | bin | 301532 -> 190608 bytes | |||
| -rw-r--r-- | data/styles/epub3-css3-only.css | 8 | ||||
| -rw-r--r-- | data/styles/epub3.css | 46 | ||||
| -rw-r--r-- | scripts/optimize-noto-serif-fonts.pe | 211 |
8 files changed, 242 insertions, 25 deletions
diff --git a/WORKLOG.adoc b/WORKLOG.adoc index 8968c88..2d608f7 100644 --- a/WORKLOG.adoc +++ b/WORKLOG.adoc @@ -32,6 +32,8 @@ .Fonts * HIGH: continue optimizing subset for Noto Serif +* HIGH: optimizing M+ 1p fonts beyond latin, toss hinting +* document the addition of the word joiner character (U+2060), though technically we no longer need it .Stylesheet * HIGH: image border option (or add drop shadow to screenshots in README) diff --git a/data/fonts/noto-serif-bold-italic.ttf b/data/fonts/noto-serif-bold-italic.ttf Binary files differindex c2cceff..61eba1e 100644 --- a/data/fonts/noto-serif-bold-italic.ttf +++ b/data/fonts/noto-serif-bold-italic.ttf diff --git a/data/fonts/noto-serif-bold.ttf b/data/fonts/noto-serif-bold.ttf Binary files differindex d77d06b..a65f71b 100644 --- a/data/fonts/noto-serif-bold.ttf +++ b/data/fonts/noto-serif-bold.ttf diff --git a/data/fonts/noto-serif-italic.ttf b/data/fonts/noto-serif-italic.ttf Binary files differindex 505b5df..0841f5c 100644 --- a/data/fonts/noto-serif-italic.ttf +++ b/data/fonts/noto-serif-italic.ttf diff --git a/data/fonts/noto-serif-regular.ttf b/data/fonts/noto-serif-regular.ttf Binary files differindex 04895a9..5fae67d 100644 --- a/data/fonts/noto-serif-regular.ttf +++ b/data/fonts/noto-serif-regular.ttf diff --git a/data/styles/epub3-css3-only.css b/data/styles/epub3-css3-only.css index f9eae78..d72311b 100644 --- a/data/styles/epub3-css3-only.css +++ b/data/styles/epub3-css3-only.css @@ -28,6 +28,14 @@ body.gitden-reader a:link { margin: 0 !important; } + /* text-rendering is the only way to enable kerning in Kindle */ + /* personally, I think Kindle overdoes kerning, but oh well */ + h1, h2, h3, h4, h5, h6, + body p, li, dd, blockquote > footer, + th, td, figcaption, caption { + text-rendering: optimizeLegibility; + } + /* hack line height of subtitle using floats on Kindle */ h1.chapter-title .subtitle { margin-top: -0.2em; diff --git a/data/styles/epub3.css b/data/styles/epub3.css index 0a6e77a..b243e85 100644 --- a/data/styles/epub3.css +++ b/data/styles/epub3.css @@ -28,11 +28,8 @@ body { /* don't use !important on margin as it breaks calibre */ margin: 0; font-size: 100%; - /* NOTE putting optimizeLegibility on the body appears to slow down rendering */ - /* + /* NOTE putting optimizeLegibility on the body slow down rendering considerably */ text-rendering: optimizeSpeed; - text-rendering: optimizeLegibility; - */ -webkit-font-smoothing: antialiased; /* appears to be the default */ } @@ -113,9 +110,6 @@ kbd { .menuseq .caret { /* - text-rendering: optimizeLegibility; - */ - /* font-family: "FontAwesome"; font-size: 0.7em; line-height: 1; @@ -132,9 +126,6 @@ kbd { .menuseq .caret::before { font-family: "FontAwesome"; - /* - text-rendering: optimizeLegibility; - */ content: "\f054"; font-size: 0.6em; vertical-align: 0.15em; @@ -207,7 +198,8 @@ td, th { body a:link { color: #333332; - -webkit-text-fill-color: #333332; /* hack for font color in iBooks */ + /* hack for font color in iBooks */ + -webkit-text-fill-color: #333332; /* Kindle requires the !important on text-decoration */ /* In night mode, the only indicator of a link is the underline, so we need it or a background image */ text-decoration: none !important; @@ -228,7 +220,8 @@ body:first-of-type a:link { body a:visited { color: #666665; - -webkit-text-fill-color: #666665; /* hack for font color in iBooks */ + /* hack for font color in iBooks */ + -webkit-text-fill-color: #666665; } code.literal { @@ -247,6 +240,10 @@ h1, h2, h3, h4, h5, h6 { text-align: left; color: #333332; letter-spacing: -0.01em; + /* disable hyphenation, such as in iBooks */ + -webkit-hyphens: none; + /* force super-long words to break */ + word-break: break-word; /* NOTE: Kindle doesn't allow the line-height to be less than the font size (refer to heading font sizes) */ line-height: 1.4; /* or 1.2125 */ @@ -271,6 +268,8 @@ body p { color: #333332; line-height: 1.6; text-align: justify; + /* Signal to iBooks that hypens are okay here */ + -webkit-hyphens: auto; widows: 2; orphans: 2; @@ -296,18 +295,19 @@ code, kbd, pre { } h1, h2, h3, h4, h5, h6, -p, span.principal, th, td, -figcaption, caption, blockquote > footer { - text-rendering: optimizeLegibility; +body p, li, dd, blockquote > footer, +th, td, figcaption, caption { + /* forward-compatible CSS to enable kerning and ligatures */ + -webkit-font-feature-settings: "kern", "liga", "dlig"; + font-feature-settings: "kern", "liga", "dlig"; + font-kerning: normal; + /* => see Kindle hack in epub3-css3-only.css for parallel settings */ } p.last::after { color: #57AD68; display: inline-block; font-family: "FontAwesome"; - /* - text-rendering: optimizeLegibility; - */ font-size: 1em; content: "\f121"; /* </> */ margin-left: 0.25em; @@ -680,7 +680,9 @@ div.abstract > p { } div.abstract > p a:link { - color: #666665 !important; + color: #666665; + /* hack for font color in iBooks */ + -webkit-text-fill-color: #666665; } div.abstract > p:first-child::first-line { @@ -876,9 +878,6 @@ blockquote > p:first-of-type::before { /* using serif quote from entypo */ font-family: "FontIcons"; - /* - text-rendering: optimizeLegibility; - */ /*content: "\f10e";*/ /* quote-right from Entypo */ /* @@ -1020,9 +1019,6 @@ aside.important { aside.admonition::before { display: block; font-family: "FontAwesome"; - /* - text-rendering: optimizeLegibility; - */ font-size: 2em; line-height: 1em; width: 1em; diff --git a/scripts/optimize-noto-serif-fonts.pe b/scripts/optimize-noto-serif-fonts.pe new file mode 100644 index 0000000..557b96f --- /dev/null +++ b/scripts/optimize-noto-serif-fonts.pe @@ -0,0 +1,211 @@ +# Run using: +# $ fontforge -script optimize-noto-serif-fonts.pe +# Run against fonts from https://code.google.com/p/noto/source/browse/#svn%2Ftrunk%2Ffonts%2Findividual%2Funhinted +# IMPORTANT: Must generate Apple format (0x10) or include old-fashioned 'kern' table for kerning to work in Prawn +# generate flags (additive): +# * 0x00 - OpenType +# * 0x10 - Apple +# * 0x80 - OpenType and Apple +# * 0x90 - Neither OpenType or Apple +# * 0x800 - Generate old-style 'kern' table +# * 0x08 - exclude TrueType instructions +# NotoSerif Regular +Open("NotoSerif-Regular.ttf") +SelectAll() +ClearInstrs() +#Simplify() +#RoundToInt() +SelectNone() +# Basic Latin +SelectMore(0u0020,0u007e) +# Latin-1 Supplement +SelectMore(0u00a0,0u00ff) +# Mathematical Operators +SelectMore(0u2200,0u22ff) +# General Punctuation (most) +SelectMore(0u2000,0u203a) +# Trademark sign +SelectMore(0u2122) +# Geometric Shapes +SelectMore(0u25a0,0u25ff) +# Latin Extended-A, Latin Extended-B +SelectMore(0u0100,0u024f) +# IPA Extensions +#SelectMore(0u0250,0u02af) +# Upside-down e +SelectMore(0u0259) +# Spacing Modifier Letters +SelectMore(0u02b0,0u02ff) +# Greek +SelectMore(0u0370,0u03ff) +# Greek Extended +#SelectMore(0u1f00,0u1fff) +# Cyrillic +SelectMore(0u0400,0u04ff) +# Cyrillic Supplement +#SelectMore(0u0500,0u052f) +# Latin Extended Additional +SelectMore(0u1e00,0u1eff) +# Currency Symbols +SelectMore(0u20a0,0u20d0) +# Latin Ligatures +#SelectMore(0ufb00,0ufb06) +# BOM +SelectMore(0ufeff) +# Non-marking return +SelectMore(0u000d) +SelectInvert() +Clear() +SelectNone() +Generate("noto-serif-regular.ttf", "", 0x08) +Close() +# NotoSerif Bold +Open("NotoSerif-Bold.ttf") +SelectAll() +ClearInstrs() +#Simplify() +#RoundToInt() +SelectNone() +# Basic Latin +SelectMore(0u0020,0u007e) +# Latin-1 Supplement +SelectMore(0u00a0,0u00ff) +# Mathematical Operators +SelectMore(0u2200,0u22ff) +# General Punctuation (most) +SelectMore(0u2000,0u203a) +# Trademark sign +SelectMore(0u2122) +# Geometric Shapes +SelectMore(0u25a0,0u25ff) +# Latin Extended-A, Latin Extended-B +SelectMore(0u0100,0u024f) +# IPA Extensions +#SelectMore(0u0250,0u02af) +# Upside-down e +SelectMore(0u0259) +# Spacing Modifier Letters +SelectMore(0u02b0,0u02ff) +# Greek +SelectMore(0u0370,0u03ff) +# Greek Extended +#SelectMore(0u1f00,0u1fff) +# Cyrillic +SelectMore(0u0400,0u04ff) +# Cyrillic Supplement +#SelectMore(0u0500,0u052f) +# Latin Extended Additional +SelectMore(0u1e00,0u1eff) +# Currency Symbols +SelectMore(0u20a0,0u20d0) +# Latin Ligatures +#SelectMore(0ufb00,0ufb06) +# BOM +SelectMore(0ufeff) +# Non-marking return +SelectMore(0u000d) +SelectInvert() +Clear() +SelectNone() +Generate("noto-serif-bold.ttf", "", 0x08) +Close() +# NotoSerif Italic +Open("NotoSerif-Italic.ttf") +SelectAll() +ClearInstrs() +#Simplify() +#RoundToInt() +SelectNone() +# Basic Latin +SelectMore(0u0020,0u007e) +# Latin-1 Supplement +SelectMore(0u00a0,0u00ff) +# Mathematical Operators +SelectMore(0u2200,0u22ff) +# General Punctuation (most) +SelectMore(0u2000,0u203a) +# Trademark sign +SelectMore(0u2122) +# Geometric Shapes +SelectMore(0u25a0,0u25ff) +# Latin Extended-A, Latin Extended-B +SelectMore(0u0100,0u024f) +# IPA Extensions +#SelectMore(0u0250,0u02af) +# Upside-down e +SelectMore(0u0259) +# Spacing Modifier Letters +SelectMore(0u02b0,0u02ff) +# Greek +SelectMore(0u0370,0u03ff) +# Greek Extended +#SelectMore(0u1f00,0u1fff) +# Cyrillic +SelectMore(0u0400,0u04ff) +# Cyrillic Supplement +#SelectMore(0u0500,0u052f) +# Latin Extended Additional +SelectMore(0u1e00,0u1eff) +# Currency Symbols +SelectMore(0u20a0,0u20d0) +# Latin Ligatures +#SelectMore(0ufb00,0ufb06) +# BOM +SelectMore(0ufeff) +# Non-marking return +SelectMore(0u000d) +SelectInvert() +Clear() +SelectNone() +Generate("noto-serif-italic.ttf", "", 0x08) +Close() +# NotoSerif Bold Italic +Open("NotoSerif-BoldItalic.ttf") +SelectAll() +ClearInstrs() +#Simplify() +#RoundToInt() +SelectNone() +# Basic Latin +SelectMore(0u0020,0u007e) +# Latin-1 Supplement +SelectMore(0u00a0,0u00ff) +# Mathematical Operators +SelectMore(0u2200,0u22ff) +# General Punctuation (most) +SelectMore(0u2000,0u203a) +# Trademark sign +SelectMore(0u2122) +# Geometric Shapes +SelectMore(0u25a0,0u25ff) +# Latin Extended-A, Latin Extended-B +SelectMore(0u0100,0u024f) +# IPA Extensions +#SelectMore(0u0250,0u02af) +# Upside-down e +SelectMore(0u0259) +# Spacing Modifier Letters +SelectMore(0u02b0,0u02ff) +# Greek +SelectMore(0u0370,0u03ff) +# Greek Extended +#SelectMore(0u1f00,0u1fff) +# Cyrillic +SelectMore(0u0400,0u04ff) +# Cyrillic Supplement +#SelectMore(0u0500,0u052f) +# Latin Extended Additional +SelectMore(0u1e00,0u1eff) +# Currency Symbols +SelectMore(0u20a0,0u20d0) +# Latin Ligatures +#SelectMore(0ufb00,0ufb06) +# BOM +SelectMore(0ufeff) +# Non-marking return +SelectMore(0u000d) +SelectInvert() +Clear() +SelectNone() +Generate("noto-serif-bold-italic.ttf", "", 0x08) +Close() |
