diff options
author | Rasmus Andersson <rasmus@notion.se> | 2021-03-29 22:30:03 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2021-03-29 22:30:03 +0300 |
commit | 637d0eb1861100028c1fb5159206a8059a658c9b (patch) | |
tree | 0e9cbee88a19873c72748867909a4cef1c21181d | |
parent | bff8f875a27e130145e68612e2ed54d174ccbdcd (diff) | |
download | inter-637d0eb1861100028c1fb5159206a8059a658c9b.tar.xz |
web: Disable subset fonts as it turns out pyftsubset does not correctly handle substitution features causing subs like ccmp to break
-rw-r--r-- | Makefile | 34 | ||||
-rw-r--r-- | docs/_data/feature_samples.yml | 14 | ||||
-rw-r--r-- | docs/_includes/Inter-italic.var.css | 80 | ||||
-rw-r--r-- | docs/_includes/Inter-roman.var.css | 80 | ||||
-rw-r--r-- | docs/_includes/Inter.var.css | 72 | ||||
-rw-r--r-- | docs/_includes/InterDisplay-italic.var.css | 80 | ||||
-rw-r--r-- | docs/_includes/InterDisplay-roman.var.css | 80 | ||||
-rw-r--r-- | docs/_includes/InterDisplay.var.css | 72 | ||||
-rw-r--r-- | docs/index.css | 25 | ||||
-rw-r--r-- | docs/index.html | 6 | ||||
-rw-r--r-- | docs/inter-display.css | 33 | ||||
-rw-r--r-- | docs/inter.css | 34 | ||||
-rw-r--r-- | docs/res/base.css | 5 | ||||
-rwxr-xr-x | misc/tools/subset.py | 151 |
14 files changed, 210 insertions, 556 deletions
@@ -400,10 +400,39 @@ docs_info: docs/_data/fontinfo.json \ docs/glyphs/metrics.json docs_fonts: docs_fonts_text docs_fonts_display + + +# TODO: re-enable this when we have figured out how to make subset VFs work +# with substitution features like ccmp. +# docs_fonts_pre: +# rm -rf docs/font-files +# mkdir docs/font-files $(FONTDIR)/subset +# python misc/tools/subset.py +# docs_fonts_text: docs_fonts_pre +# cp -a $(FONTDIR)/const/*.woff \ +# $(FONTDIR)/const/*.woff2 \ +# $(FONTDIR)/const/*.otf \ +# $(FONTDIR)/var/Inter.var.* \ +# $(FONTDIR)/var/InterDisplay.var.* \ +# $(FONTDIR)/var/Inter*-roman.var.* \ +# $(FONTDIR)/var/Inter*-italic.var.* \ +# $(FONTDIR)/subset/Inter-*.woff2 \ +# $(FONTDIR)/subset/Inter.*.woff2 \ +# docs/font-files/ +# docs_fonts_display: docs_fonts_pre +# cp -a $(FONTDIR)/const/*.woff \ +# $(FONTDIR)/const/*.woff2 \ +# $(FONTDIR)/const/*.otf \ +# $(FONTDIR)/var/Inter.var.* \ +# $(FONTDIR)/var/InterDisplay.var.* \ +# $(FONTDIR)/var/Inter*-roman.var.* \ +# $(FONTDIR)/var/Inter*-italic.var.* \ +# $(FONTDIR)/subset/InterDisplay*.woff2 \ +# docs/font-files/ + docs_fonts_pre: rm -rf docs/font-files mkdir docs/font-files - python misc/tools/subset.py docs_fonts_text: docs_fonts_pre cp -a $(FONTDIR)/const/*.woff \ @@ -413,8 +442,6 @@ docs_fonts_text: docs_fonts_pre $(FONTDIR)/var/InterDisplay.var.* \ $(FONTDIR)/var/Inter*-roman.var.* \ $(FONTDIR)/var/Inter*-italic.var.* \ - $(FONTDIR)/subset/Inter-*.woff2 \ - $(FONTDIR)/subset/Inter.*.woff2 \ docs/font-files/ docs_fonts_display: docs_fonts_pre @@ -425,7 +452,6 @@ docs_fonts_display: docs_fonts_pre $(FONTDIR)/var/InterDisplay.var.* \ $(FONTDIR)/var/Inter*-roman.var.* \ $(FONTDIR)/var/Inter*-italic.var.* \ - $(FONTDIR)/subset/InterDisplay*.woff2 \ docs/font-files/ .PHONY: docs docs_info docs_fonts docs_fonts_pre docs_fonts_text docs_fonts_display diff --git a/docs/_data/feature_samples.yml b/docs/_data/feature_samples.yml index dbd0e6985..30a752f06 100644 --- a/docs/_data/feature_samples.yml +++ b/docs/_data/feature_samples.yml @@ -76,14 +76,16 @@ - "›→‹ ›←‹ ›⟶‹ ›⟵‹ ›−‹ ›-‹ ›–‹ ›—‹ ›:‹" -- title: Ligatures - tag: rlig +- title: Compositions + tag: ccmp description: - Inter provides just a few ligatures for combining characters for which layout - support in various apps is spotty. + Inter provides several custom made glyphs for compositions like + A + enclosed-combining-circle. samples: - - "A›\u20DD‹" - - "#›\u20DE‹" + - "Figure A›\u20DD‹" + - "Figure #›\u20DE‹" + - "Figure ›\u20DD‹3" + - "Figure ›\u20DE‹3" footer: This means that for instance enclosed glyphs works everywhere, not just in apps with correct combining character logic. diff --git a/docs/_includes/Inter-italic.var.css b/docs/_includes/Inter-italic.var.css deleted file mode 100644 index 6b88ce6fb..000000000 --- a/docs/_includes/Inter-italic.var.css +++ /dev/null @@ -1,80 +0,0 @@ -/* extra */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.extra.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01-EE06,U+F6C3; - font-named-instance: 'Italic'; -} -/* alternates */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.alternates.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01-EE06,U+F6C3; - font-named-instance: 'Italic'; -} -/* symbols */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.symbols.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2380,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E164,U+1F130-1F14A,U+1F850,U+1F852; - font-named-instance: 'Italic'; -} -/* cyrillic */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.cyrillic.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F; - font-named-instance: 'Italic'; -} -/* greek */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.greek.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF; - font-named-instance: 'Italic'; -} -/* vietnamese */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.vietnamese.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB; - font-named-instance: 'Italic'; -} -/* latin-ext */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.latin-ext.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20C0,U+2113,U+2C7C,U+2C7F,U+A7FF; - font-named-instance: 'Italic'; -} -/* latin */ -@font-face { - font-family: 'Inter var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-italic.latin.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF; - font-named-instance: 'Italic'; -}
\ No newline at end of file diff --git a/docs/_includes/Inter-roman.var.css b/docs/_includes/Inter-roman.var.css deleted file mode 100644 index 40cfc6361..000000000 --- a/docs/_includes/Inter-roman.var.css +++ /dev/null @@ -1,80 +0,0 @@ -/* extra */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.extra.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01-EE06,U+F6C3; - font-named-instance: 'Regular'; -} -/* alternates */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.alternates.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01-EE06,U+F6C3; - font-named-instance: 'Regular'; -} -/* symbols */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.symbols.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2380,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E164,U+1F130-1F14A,U+1F850,U+1F852; - font-named-instance: 'Regular'; -} -/* cyrillic */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.cyrillic.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F; - font-named-instance: 'Regular'; -} -/* greek */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.greek.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF; - font-named-instance: 'Regular'; -} -/* vietnamese */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.vietnamese.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB; - font-named-instance: 'Regular'; -} -/* latin-ext */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.latin-ext.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20C0,U+2113,U+2C7C,U+2C7F,U+A7FF; - font-named-instance: 'Regular'; -} -/* latin */ -@font-face { - font-family: 'Inter var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter-roman.latin.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF; - font-named-instance: 'Regular'; -}
\ No newline at end of file diff --git a/docs/_includes/Inter.var.css b/docs/_includes/Inter.var.css deleted file mode 100644 index 5339718fa..000000000 --- a/docs/_includes/Inter.var.css +++ /dev/null @@ -1,72 +0,0 @@ -/* extra */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.extra.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01-EE06,U+F6C3; -} -/* alternates */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.alternates.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E081,U+E093-E097,U+E0A5-E0E7,U+E0F3-E11D,U+E11E-E165,U+EE01-EE06,U+F6C3; -} -/* symbols */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.symbols.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2380,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E164,U+1F130-1F14A,U+1F850,U+1F852; -} -/* cyrillic */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.cyrillic.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F; -} -/* greek */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.greek.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF; -} -/* vietnamese */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.vietnamese.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.latin-ext.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20C0,U+2113,U+2C7C,U+2C7F,U+A7FF; -} -/* latin */ -@font-face { - font-family: 'Inter var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/Inter.latin.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF; -}
\ No newline at end of file diff --git a/docs/_includes/InterDisplay-italic.var.css b/docs/_includes/InterDisplay-italic.var.css deleted file mode 100644 index c638d2b37..000000000 --- a/docs/_includes/InterDisplay-italic.var.css +++ /dev/null @@ -1,80 +0,0 @@ -/* extra */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.extra.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E0E7,U+E0F3-E15F,U+F6C3; - font-named-instance: 'Italic'; -} -/* alternates */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.alternates.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E0E7,U+E0F3-E15F,U+F6C3; - font-named-instance: 'Italic'; -} -/* symbols */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.symbols.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E15F,U+1F130-1F14A,U+1F850,U+1F852; - font-named-instance: 'Italic'; -} -/* cyrillic */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.cyrillic.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F; - font-named-instance: 'Italic'; -} -/* greek */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.greek.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF; - font-named-instance: 'Italic'; -} -/* vietnamese */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.vietnamese.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB; - font-named-instance: 'Italic'; -} -/* latin-ext */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.latin-ext.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20BF,U+2113,U+2C7C,U+2C7F,U+A7FF; - font-named-instance: 'Italic'; -} -/* latin */ -@font-face { - font-family: 'InterDisplay var'; - font-style: italic; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-italic.latin.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF; - font-named-instance: 'Italic'; -}
\ No newline at end of file diff --git a/docs/_includes/InterDisplay-roman.var.css b/docs/_includes/InterDisplay-roman.var.css deleted file mode 100644 index 1e690a09f..000000000 --- a/docs/_includes/InterDisplay-roman.var.css +++ /dev/null @@ -1,80 +0,0 @@ -/* extra */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.extra.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E0E7,U+E0F3-E15F,U+F6C3; - font-named-instance: 'Regular'; -} -/* alternates */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.alternates.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E0E7,U+E0F3-E15F,U+F6C3; - font-named-instance: 'Regular'; -} -/* symbols */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.symbols.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E15F,U+1F130-1F14A,U+1F850,U+1F852; - font-named-instance: 'Regular'; -} -/* cyrillic */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.cyrillic.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F; - font-named-instance: 'Regular'; -} -/* greek */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.greek.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF; - font-named-instance: 'Regular'; -} -/* vietnamese */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.vietnamese.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB; - font-named-instance: 'Regular'; -} -/* latin-ext */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.latin-ext.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20BF,U+2113,U+2C7C,U+2C7F,U+A7FF; - font-named-instance: 'Regular'; -} -/* latin */ -@font-face { - font-family: 'InterDisplay var'; - font-style: normal; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay-roman.latin.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF; - font-named-instance: 'Regular'; -}
\ No newline at end of file diff --git a/docs/_includes/InterDisplay.var.css b/docs/_includes/InterDisplay.var.css deleted file mode 100644 index 0ef23e0a6..000000000 --- a/docs/_includes/InterDisplay.var.css +++ /dev/null @@ -1,72 +0,0 @@ -/* extra */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.extra.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E0E7,U+E0F3-E15F,U+F6C3; -} -/* alternates */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.alternates.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+E000,U+E002-E0E7,U+E0F3-E15F,U+F6C3; -} -/* symbols */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.symbols.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+20DD-20DF,U+2190-219A,U+21A9-21AB,U+21B0-21B2,U+21B3-21B6,U+21BA-21BC,U+21D0,U+21D2,U+21D4,U+21DE-21E0,U+21E4-21E6,U+21E7,U+21EA,U+2303,U+2305,U+2318,U+2325-2328,U+232B,U+2387,U+238B,U+23CE-23D0,U+2460-2469,U+24B6-24D0,U+24EA,U+25A0-25A3,U+25B2-25B4,U+25B6-25B8,U+25BA-25BE,U+25C0-25C2,U+25C4-25C8,U+25CB,U+25CF,U+25EF,U+2600,U+2605-2607,U+263C,U+2661,U+2665,U+26A0,U+2713,U+2717,U+2756,U+2764,U+2780-2789,U+27F5-27FB,U+2B06,U+2B12-2B14,U+2B1C,U+E000,U+E12B-E15F,U+1F130-1F14A,U+1F850,U+1F852; -} -/* cyrillic */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.cyrillic.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0400-049E,U+04A0-0500,U+052F,U+20B4,U+2116,U+2DFF,U+A69F; -} -/* greek */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.greek.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0370-0378,U+037A-0380,U+0384-038B,U+038C,U+038E-03A2,U+03A3-03E2,U+03F0-0400,U+1F00-1F16,U+1F18-1F1E,U+1F20-1F46,U+1F48-1F4E,U+1F50-1F58,U+1F59,U+1F5B,U+1F5D,U+1F5F-1F7E,U+1F80-1FB5,U+1FB6-1FC5,U+1FC6-1FD4,U+1FD6-1FDC,U+1FDD-1FF0,U+1FF2-1FF5,U+1FF6-1FFF; -} -/* vietnamese */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.vietnamese.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0102-0104,U+0110-0112,U+0128-012A,U+0168-016A,U+01A0-01A2,U+01AF-01B1,U+1EA0-1EFA,U+20AB; -} -/* latin-ext */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.latin-ext.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0100-0149,U+014A-01C4,U+01C5-0250,U+0259,U+1E00-1F00,U+2020,U+20A0-20AC,U+20AD-20BF,U+2113,U+2C7C,U+2C7F,U+A7FF; -} -/* latin */ -@font-face { - font-family: 'InterDisplay var experimental'; - font-style: oblique 0deg 10deg; - font-weight: 100 900; - font-display: swap; - src: url('font-files/InterDisplay.latin.var.woff2?v={{font_v}}') format('woff2'); - unicode-range: U+0000-007F,U+00A0-0100,U+0131,U+0152-0154,U+02BB-02BD,U+02C6,U+02DA,U+02DC,U+2000-200C,U+2010-2028,U+202F-2060,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+FEFF; -}
\ No newline at end of file diff --git a/docs/index.css b/docs/index.css index 4df566c0b..5b48f4760 100644 --- a/docs/index.css +++ b/docs/index.css @@ -224,18 +224,7 @@ h1 { - -/* FAQ */ -grid.faq { - grid-row-gap: calc(var(--spacingv) * 3); -} -.faq .q { - font-weight: 600; -} -.faq h4:target { - background: var(--yellow); -} - +/* features */ boxes.features { color:#111; } @@ -265,6 +254,18 @@ boxes.features grid .sample em { } +/* FAQ */ +grid.faq { + grid-row-gap: calc(var(--spacingv) * 3); +} +.faq .q { + font-weight: 600; +} +.faq h4:target { + background: var(--yellow); +} + + #sponsor-button { display: inline-block; diff --git a/docs/index.html b/docs/index.html index aff49742e..434de4532 100644 --- a/docs/index.html +++ b/docs/index.html @@ -303,7 +303,6 @@ html { font-family: 'Inter', sans-serif; } <q title='OpenType feature ID'>locl</q>, <q title='OpenType feature ID'>salt</q>, <q title='OpenType feature ID'>aalt</q>, - <q title='OpenType feature ID'>ccmp</q>, <q title='OpenType feature ID'>cpsp</q> and <q title='OpenType feature ID'>ordn</q>. <br> @@ -522,11 +521,12 @@ html { font-family: 'Inter', sans-serif; } <h4 id="faq-subset"><a href="#faq-subset"> How do I subset the font files? </a></h4> - The web fonts provided by <a href="inter.css"><tt>inter.css</tt></a> and + <!--The web fonts provided by <a href="inter.css"><tt>inter.css</tt></a> and <a href="inter-display.css"><tt>inter-display.css</tt></a> are already subset (variable version.) If you need special customized subsets, or subsetting OTF or TTF files, - have a look at + have a look at--> + Have a look at <a href="https://fonttools.readthedocs.io/en/latest/subset/"><tt>pyftsubset</tt></a> and <a href="https://github.com/filamentgroup/glyphhanger"><tt>glyphhanger</tt></a>. diff --git a/docs/inter-display.css b/docs/inter-display.css index 5cd11b392..3a7354551 100644 --- a/docs/inter-display.css +++ b/docs/inter-display.css @@ -1,7 +1,7 @@ --- layout: none --- -{% assign font_v = site.data.fontinfo[0].version | append: "b" %} +{% assign font_v = site.data.fontinfo[0].version %} /* Font families defined by this CSS: @@ -20,8 +20,29 @@ Use like this in your CSS: {% include InterDisplay-static.css %} /* ----------------------- variable ----------------------- */ + +{%- comment -%} {% include InterDisplay-italic.var.css %} {% include InterDisplay-roman.var.css %} +{%- endcomment %} + +@font-face { + font-family: 'InterDisplay var'; + font-style: normal; + font-weight: 100 900; + font-display: swap; + src: url('font-files/InterDisplay-roman.var.woff2?v={{font_v}}') format('woff2'); + font-named-instance: 'Regular'; +} + +@font-face { + font-family: 'InterDisplay var'; + font-style: italic; + font-weight: 100 900; + font-display: swap; + src: url('font-files/InterDisplay-italic.var.woff2?v={{font_v}}') format('woff2'); + font-named-instance: 'Italic'; +} /* ----------- experimental multi-axis variable ----------- @@ -31,4 +52,14 @@ When using this, you will likely need to set font-variation-settings explicitly, * { font-variation-settings: "slnt" 0deg } .italic { font-variation-settings: "slnt" 10deg } */ +{%- comment -%} {% include InterDisplay.var.css %} +{%- endcomment %} + +@font-face { + font-family: 'InterDisplay var experimental'; + font-style: oblique 0deg 10deg; + font-weight: 100 900; + font-display: swap; + src: url('font-files/InterDisplay.var.woff2?v={{font_v}}') format('woff2'); +} diff --git a/docs/inter.css b/docs/inter.css index 66877548f..b812483c6 100644 --- a/docs/inter.css +++ b/docs/inter.css @@ -1,7 +1,7 @@ --- layout: none --- -{% assign font_v = site.data.fontinfo[0].version | append: "b" %} +{% assign font_v = site.data.fontinfo[0].version %} /* Font families defined by this CSS: @@ -20,8 +20,29 @@ Use like this in your CSS: {% include Inter-static.css %} /* ----------------------- variable ----------------------- */ + +{%- comment -%} {% include Inter-italic.var.css %} {% include Inter-roman.var.css %} +{%- endcomment %} + +@font-face { + font-family: 'Inter var'; + font-style: normal; + font-weight: 100 900; + font-display: swap; + src: url('font-files/Inter-roman.var.woff2?v={{font_v}}') format('woff2'); + font-named-instance: 'Regular'; +} + +@font-face { + font-family: 'Inter var'; + font-style: italic; + font-weight: 100 900; + font-display: swap; + src: url('font-files/Inter-italic.var.woff2?v={{font_v}}') format('woff2'); + font-named-instance: 'Italic'; +} /* ----------- experimental multi-axis variable ----------- @@ -31,7 +52,18 @@ When using this, you will likely need to set font-variation-settings explicitly, * { font-variation-settings: "slnt" 0deg } .italic { font-variation-settings: "slnt" 10deg } */ + +{%- comment -%} {% include Inter.var.css %} +{%- endcomment %} + +@font-face { + font-family: 'Inter var experimental'; + font-style: oblique 0deg 10deg; + font-weight: 100 900; + font-display: swap; + src: url('font-files/Inter.var.woff2?v={{font_v}}') format('woff2'); +} /* Legacy name (became legacy on Feb 2, 2019) */ @font-face { diff --git a/docs/res/base.css b/docs/res/base.css index 173bca16b..94d76a2ca 100644 --- a/docs/res/base.css +++ b/docs/res/base.css @@ -642,9 +642,6 @@ box { border-radius: 3px; margin-right:1em; margin-bottom:1em; -} -body.safari box { - /* Fix for broken flex wrap in safari */ flex-basis: 40%; } box:first-child { @@ -738,7 +735,7 @@ instead. */ -.ff-none { font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0; -webkit-font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0; -ms-font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0; -moz-font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0; } +.ff-none { font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0, 'ccmp' 0; -webkit-font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0, 'ccmp' 0; -ms-font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0, 'ccmp' 0; -moz-font-feature-settings: 'kern' 1, 'calt' 0, 'liga' 0, 'ccmp' 0; } .ff-liga, .ff-calt { font-feature-settings: 'liga' 1, 'calt' 1; -webkit-font-feature-settings: 'liga' 1, 'calt' 1; -ms-font-feature-settings: 'liga' 1, 'calt' 1; -moz-font-feature-settings: 'liga' 1, 'calt' 1; } diff --git a/misc/tools/subset.py b/misc/tools/subset.py index 37ed9a596..095c7ed3c 100755 --- a/misc/tools/subset.py +++ b/misc/tools/subset.py @@ -15,6 +15,11 @@ sys.path.append(dirname(abspath(__file__))) from common import BASEDIR, VENVDIR +# FORCE can be set to True to subset all fonts regardless if the input source +# font has changed or not +FORCE = False + + # fonts to subset FONTS = [ @@ -109,6 +114,9 @@ SYMBOL_UNICODES = [ ] +SELF_SCRIPT_MTIME = 0 + + def main(argv): # defines subsets. # Ranges are inclusive. @@ -181,14 +189,22 @@ def main(argv): *genCompactIntRanges(SYMBOL_UNICODES) ), - defsubset('alternates', - # all private-use codepoints are mapped to alternate glyphs, normally accessed by - # OpenType features. - range(0xE000, 0xF8FF), - ), + # defsubset('alternates', + # # all private-use codepoints are mapped to alternate glyphs, normally accessed by + # # OpenType features. + # range(0xE000, 0xF8FF), + # ), + # Note: Disabled so that alternates are all added automatically to the "extra" set. ) + global SELF_SCRIPT_MTIME + SELF_SCRIPT_MTIME = os.path.getmtime(__file__) + + # XXX DEBUG + global FONTS + FONTS = FONTS[1:2] + # generate subset fonts with ProcPool() as procpool: for fontinfo in FONTS: @@ -207,49 +223,6 @@ def main(argv): f.write(css) -def genCSS(fontinfo, subsets): - outfileTemplate = pjoin(BASEDIR, fontinfo['outfile']) - - css_family = fontinfo.get('css_family', 'Inter') - css_style = fontinfo.get('css_style', 'normal') - css_weight = fontinfo.get('css_weight', '400') - css_extra = fontinfo.get('css_extra', '') - if len(css_extra) > 0: - css_extra = '\n ' + css_extra - css = [] - - for subset in list(subsets) + [{ 'name':'extra' }]: - outfile = outfileTemplate.format(subset=subset['name']) - # Read effective codepoint coverage. This may be greater than requested - # in case of OT features. For example, the Latin subset includes some common arrow - # glyphs since "->" is a ligature for "→". - font = ttLib.TTFont(outfile) - unicodes = set(getUnicodeMap(font)) - if min(unicodes) < 0x30: - # the "base" (latin) subset. extend it to include control codepoints - controlCodepoints, _ = genUnicodeRange([range(0x0000, 0x001F)]) - unicodes = unicodes.union(controlCodepoints) - _, unicodeRange = genUnicodeRange(genCompactIntRanges(unicodes)) - css.append(CSS_TEMPLATE.format( - comment=subset['name'], - filename=basename(outfile), - unicode_range=unicodeRange, - family=css_family, - style=css_style, - weight=css_weight, - extra=css_extra, - ).strip()) - - # From the CSS spec on unicode-range descriptor: - # "If the Unicode ranges overlap for a set of @font-face rules with the same family - # and style descriptor values, the rules are ordered in the reverse order they were - # defined; the last rule defined is the first to be checked for a given character." - # https://www.w3.org/TR/css-fonts-4/#unicode-range-desc - css.reverse() - - return '\n'.join(css) - - def subset_font(fontinfo, subsets, procpool): infile = pjoin(BASEDIR, fontinfo['infile']) outfileTemplate = pjoin(BASEDIR, fontinfo['outfile']) @@ -268,18 +241,26 @@ def subset_font(fontinfo, subsets, procpool): extraUnicodes = ucall - covered _, extraUnicodeRange = genUnicodeRange(extraUnicodes) outfile = outfileTemplate.format(subset='extra') - print("write", outfile) subset_range_async(procpool, infile, outfile, unicodeRange) def subset_range_async(procpool :ProcPool, infile :str, outfile :str, unicodeRange :str): - try: - if os.path.getmtime(outfile) > os.path.getmtime(infile): - # print('up-to-date %s -> %s' % (relpath(infile), relpath(outfile))) - return - except: - pass - procpool.apply_async( subset_range,(infile, outfile, unicodeRange) ) + if not FORCE: + try: + outmtime = os.path.getmtime(outfile) + if outmtime > os.path.getmtime(infile) and outmtime > SELF_SCRIPT_MTIME: + print('up-to-date %s -> %s' % (relpath(infile), relpath(outfile))) + return + except: + pass + procpool.apply_async( subset_range,(infile, outfile, unicodeRange), + error_callback=lambda err: onProcErr(procpool, err) ) + + +def onProcErr(procpool, err): + procpool.terminate() + raise err + sys.exit(1) def subset_range(infile :str, outfile :str, unicodeRange :str): @@ -289,6 +270,9 @@ def subset_range(infile :str, outfile :str, unicodeRange :str): pyftsubset, '--unicodes=' + unicodeRange, '--layout-features=*', + '--recommended-glyphs', + '--no-recalc-bounds', + '--no-prune-unicode-ranges', '--no-hinting', '--output-file=' + outfile, infile @@ -302,16 +286,18 @@ def subset_range(infile :str, outfile :str, unicodeRange :str): args, shell=False, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, # combine stdout & stderr into p.stdout + stderr=subprocess.PIPE, encoding='utf-8', # py3 ) - output = p.stdout.strip() if p.returncode != 0: - raise Exception('pyftsubset failed:\n%s\nInvocation:\n%s' % ( - output, + raise Exception( + 'pyftsubset failed:\n-- stdout:\n%s\n\n-- stderr:\n%s\n\n-- invocation:\n%s' % ( + p.stdout.strip(), + p.stderr.strip(), '\n '.join([repr(a) for a in args]), )) - + # sys.exit(p.returncode) + print("write", outfile) # (name, ...[int|range(int)]) -> { name:str codepoints:[int|range(int)] } def defsubset(name, *codepoints): @@ -382,6 +368,49 @@ def genCompactIntRanges(codepoints :[int]) -> [[int]]: return compact +def genCSS(fontinfo, subsets): + outfileTemplate = pjoin(BASEDIR, fontinfo['outfile']) + + css_family = fontinfo.get('css_family', 'Inter') + css_style = fontinfo.get('css_style', 'normal') + css_weight = fontinfo.get('css_weight', '400') + css_extra = fontinfo.get('css_extra', '') + if len(css_extra) > 0: + css_extra = '\n ' + css_extra + css = [] + + for subset in list(subsets) + [{ 'name':'extra' }]: + outfile = outfileTemplate.format(subset=subset['name']) + # Read effective codepoint coverage. This may be greater than requested + # in case of OT features. For example, the Latin subset includes some common arrow + # glyphs since "->" is a ligature for "→". + font = ttLib.TTFont(outfile) + unicodes = set(getUnicodeMap(font)) + if min(unicodes) < 0x30: + # the "base" (latin) subset. extend it to include control codepoints + controlCodepoints, _ = genUnicodeRange([range(0x0000, 0x001F)]) + unicodes = unicodes.union(controlCodepoints) + _, unicodeRange = genUnicodeRange(genCompactIntRanges(unicodes)) + css.append(CSS_TEMPLATE.format( + comment=subset['name'], + filename=basename(outfile), + unicode_range=unicodeRange, + family=css_family, + style=css_style, + weight=css_weight, + extra=css_extra, + ).strip()) + + # From the CSS spec on unicode-range descriptor: + # "If the Unicode ranges overlap for a set of @font-face rules with the same family + # and style descriptor values, the rules are ordered in the reverse order they were + # defined; the last rule defined is the first to be checked for a given character." + # https://www.w3.org/TR/css-fonts-4/#unicode-range-desc + css.reverse() + + return '\n'.join(css) + + def relpath(path): return os.path.relpath(path, os.getcwd()) |