1
1
mirror of https://github.com/rsms/inter.git synced 2024-11-22 19:14:19 +03:00

web: Disable subset fonts as it turns out pyftsubset does not correctly handle substitution features causing subs like ccmp to break

This commit is contained in:
Rasmus Andersson 2021-03-29 12:30:03 -07:00
parent bff8f875a2
commit 637d0eb186
14 changed files with 210 additions and 556 deletions

View File

@ -400,10 +400,39 @@ docs_info: docs/_data/fontinfo.json \
docs/glyphs/metrics.json docs/glyphs/metrics.json
docs_fonts: docs_fonts_text docs_fonts_display 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: docs_fonts_pre:
rm -rf docs/font-files rm -rf docs/font-files
mkdir docs/font-files mkdir docs/font-files
python misc/tools/subset.py
docs_fonts_text: docs_fonts_pre docs_fonts_text: docs_fonts_pre
cp -a $(FONTDIR)/const/*.woff \ cp -a $(FONTDIR)/const/*.woff \
@ -413,8 +442,6 @@ docs_fonts_text: docs_fonts_pre
$(FONTDIR)/var/InterDisplay.var.* \ $(FONTDIR)/var/InterDisplay.var.* \
$(FONTDIR)/var/Inter*-roman.var.* \ $(FONTDIR)/var/Inter*-roman.var.* \
$(FONTDIR)/var/Inter*-italic.var.* \ $(FONTDIR)/var/Inter*-italic.var.* \
$(FONTDIR)/subset/Inter-*.woff2 \
$(FONTDIR)/subset/Inter.*.woff2 \
docs/font-files/ docs/font-files/
docs_fonts_display: docs_fonts_pre docs_fonts_display: docs_fonts_pre
@ -425,7 +452,6 @@ docs_fonts_display: docs_fonts_pre
$(FONTDIR)/var/InterDisplay.var.* \ $(FONTDIR)/var/InterDisplay.var.* \
$(FONTDIR)/var/Inter*-roman.var.* \ $(FONTDIR)/var/Inter*-roman.var.* \
$(FONTDIR)/var/Inter*-italic.var.* \ $(FONTDIR)/var/Inter*-italic.var.* \
$(FONTDIR)/subset/InterDisplay*.woff2 \
docs/font-files/ docs/font-files/
.PHONY: docs docs_info docs_fonts docs_fonts_pre docs_fonts_text docs_fonts_display .PHONY: docs docs_info docs_fonts docs_fonts_pre docs_fonts_text docs_fonts_display

View File

@ -76,14 +76,16 @@
- "›→‹ ›←‹ ›⟶‹ ›⟵‹ - ›—‹ :" - "›→‹ ›←‹ ›⟶‹ ›⟵‹ - ›—‹ :"
- title: Ligatures - title: Compositions
tag: rlig tag: ccmp
description: description:
Inter provides just a few ligatures for combining characters for which layout Inter provides several custom made glyphs for compositions like
support in various apps is spotty. A + enclosed-combining-circle.
samples: samples:
- "A\u20DD" - "Figure A\u20DD"
- "#\u20DE" - "Figure #\u20DE"
- "Figure \u20DD3"
- "Figure \u20DE3"
footer: footer:
This means that for instance enclosed glyphs This means that for instance enclosed glyphs
works everywhere, not just in apps with correct combining character logic. works everywhere, not just in apps with correct combining character logic.

View File

@ -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';
}

View File

@ -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';
}

View File

@ -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;
}

View File

@ -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';
}

View File

@ -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';
}

View File

@ -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;
}

View File

@ -224,18 +224,7 @@ h1 {
/* features */
/* FAQ */
grid.faq {
grid-row-gap: calc(var(--spacingv) * 3);
}
.faq .q {
font-weight: 600;
}
.faq h4:target {
background: var(--yellow);
}
boxes.features { boxes.features {
color:#111; 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 { #sponsor-button {
display: inline-block; display: inline-block;

View File

@ -303,7 +303,6 @@ html { font-family: 'Inter', sans-serif; }
<q title='OpenType feature ID'>locl</q>, <q title='OpenType feature ID'>locl</q>,
<q title='OpenType feature ID'>salt</q>, <q title='OpenType feature ID'>salt</q>,
<q title='OpenType feature ID'>aalt</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'>cpsp</q> and
<q title='OpenType feature ID'>ordn</q>. <q title='OpenType feature ID'>ordn</q>.
<br> <br>
@ -522,11 +521,12 @@ html { font-family: 'Inter', sans-serif; }
<h4 id="faq-subset"><a href="#faq-subset"> <h4 id="faq-subset"><a href="#faq-subset">
How do I subset the font files? How do I subset the font files?
</a></h4> </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 <a href="inter-display.css"><tt>inter-display.css</tt></a> are already subset
(variable version.) (variable version.)
If you need special customized subsets, or subsetting OTF or TTF files, 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> <a href="https://fonttools.readthedocs.io/en/latest/subset/"><tt>pyftsubset</tt></a>
and and
<a href="https://github.com/filamentgroup/glyphhanger"><tt>glyphhanger</tt></a>. <a href="https://github.com/filamentgroup/glyphhanger"><tt>glyphhanger</tt></a>.

View File

@ -1,7 +1,7 @@
--- ---
layout: none 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: Font families defined by this CSS:
@ -20,8 +20,29 @@ Use like this in your CSS:
{% include InterDisplay-static.css %} {% include InterDisplay-static.css %}
/* ----------------------- variable ----------------------- */ /* ----------------------- variable ----------------------- */
{%- comment -%}
{% include InterDisplay-italic.var.css %} {% include InterDisplay-italic.var.css %}
{% include InterDisplay-roman.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 ----------- /* ----------- 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 } * { font-variation-settings: "slnt" 0deg }
.italic { font-variation-settings: "slnt" 10deg } .italic { font-variation-settings: "slnt" 10deg }
*/ */
{%- comment -%}
{% include InterDisplay.var.css %} {% 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');
}

View File

@ -1,7 +1,7 @@
--- ---
layout: none 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: Font families defined by this CSS:
@ -20,8 +20,29 @@ Use like this in your CSS:
{% include Inter-static.css %} {% include Inter-static.css %}
/* ----------------------- variable ----------------------- */ /* ----------------------- variable ----------------------- */
{%- comment -%}
{% include Inter-italic.var.css %} {% include Inter-italic.var.css %}
{% include Inter-roman.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 ----------- /* ----------- 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 } * { font-variation-settings: "slnt" 0deg }
.italic { font-variation-settings: "slnt" 10deg } .italic { font-variation-settings: "slnt" 10deg }
*/ */
{%- comment -%}
{% include Inter.var.css %} {% 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) */ /* Legacy name (became legacy on Feb 2, 2019) */
@font-face { @font-face {

View File

@ -642,9 +642,6 @@ box {
border-radius: 3px; border-radius: 3px;
margin-right:1em; margin-right:1em;
margin-bottom:1em; margin-bottom:1em;
}
body.safari box {
/* Fix for broken flex wrap in safari */
flex-basis: 40%; flex-basis: 40%;
} }
box:first-child { 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-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; } .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; }

View File

@ -15,6 +15,11 @@ sys.path.append(dirname(abspath(__file__)))
from common import BASEDIR, VENVDIR 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 to subset
FONTS = [ FONTS = [
@ -109,6 +114,9 @@ SYMBOL_UNICODES = [
] ]
SELF_SCRIPT_MTIME = 0
def main(argv): def main(argv):
# defines subsets. # defines subsets.
# Ranges are inclusive. # Ranges are inclusive.
@ -181,14 +189,22 @@ def main(argv):
*genCompactIntRanges(SYMBOL_UNICODES) *genCompactIntRanges(SYMBOL_UNICODES)
), ),
defsubset('alternates', # defsubset('alternates',
# all private-use codepoints are mapped to alternate glyphs, normally accessed by # # all private-use codepoints are mapped to alternate glyphs, normally accessed by
# OpenType features. # # OpenType features.
range(0xE000, 0xF8FF), # 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 # generate subset fonts
with ProcPool() as procpool: with ProcPool() as procpool:
for fontinfo in FONTS: for fontinfo in FONTS:
@ -207,49 +223,6 @@ def main(argv):
f.write(css) 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): def subset_font(fontinfo, subsets, procpool):
infile = pjoin(BASEDIR, fontinfo['infile']) infile = pjoin(BASEDIR, fontinfo['infile'])
outfileTemplate = pjoin(BASEDIR, fontinfo['outfile']) outfileTemplate = pjoin(BASEDIR, fontinfo['outfile'])
@ -268,18 +241,26 @@ def subset_font(fontinfo, subsets, procpool):
extraUnicodes = ucall - covered extraUnicodes = ucall - covered
_, extraUnicodeRange = genUnicodeRange(extraUnicodes) _, extraUnicodeRange = genUnicodeRange(extraUnicodes)
outfile = outfileTemplate.format(subset='extra') outfile = outfileTemplate.format(subset='extra')
print("write", outfile)
subset_range_async(procpool, infile, outfile, unicodeRange) subset_range_async(procpool, infile, outfile, unicodeRange)
def subset_range_async(procpool :ProcPool, infile :str, outfile :str, unicodeRange :str): def subset_range_async(procpool :ProcPool, infile :str, outfile :str, unicodeRange :str):
try: if not FORCE:
if os.path.getmtime(outfile) > os.path.getmtime(infile): try:
# print('up-to-date %s -> %s' % (relpath(infile), relpath(outfile))) outmtime = os.path.getmtime(outfile)
return if outmtime > os.path.getmtime(infile) and outmtime > SELF_SCRIPT_MTIME:
except: print('up-to-date %s -> %s' % (relpath(infile), relpath(outfile)))
pass return
procpool.apply_async( subset_range,(infile, outfile, unicodeRange) ) 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): def subset_range(infile :str, outfile :str, unicodeRange :str):
@ -289,6 +270,9 @@ def subset_range(infile :str, outfile :str, unicodeRange :str):
pyftsubset, pyftsubset,
'--unicodes=' + unicodeRange, '--unicodes=' + unicodeRange,
'--layout-features=*', '--layout-features=*',
'--recommended-glyphs',
'--no-recalc-bounds',
'--no-prune-unicode-ranges',
'--no-hinting', '--no-hinting',
'--output-file=' + outfile, '--output-file=' + outfile,
infile infile
@ -302,16 +286,18 @@ def subset_range(infile :str, outfile :str, unicodeRange :str):
args, args,
shell=False, shell=False,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, # combine stdout & stderr into p.stdout stderr=subprocess.PIPE,
encoding='utf-8', # py3 encoding='utf-8', # py3
) )
output = p.stdout.strip()
if p.returncode != 0: if p.returncode != 0:
raise Exception('pyftsubset failed:\n%s\nInvocation:\n%s' % ( raise Exception(
output, '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]), '\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)] } # (name, ...[int|range(int)]) -> { name:str codepoints:[int|range(int)] }
def defsubset(name, *codepoints): def defsubset(name, *codepoints):
@ -382,6 +368,49 @@ def genCompactIntRanges(codepoints :[int]) -> [[int]]:
return compact 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): def relpath(path):
return os.path.relpath(path, os.getcwd()) return os.path.relpath(path, os.getcwd())