-
Notifications
You must be signed in to change notification settings - Fork 2
/
_otfeatures.scss
111 lines (96 loc) · 4.69 KB
/
_otfeatures.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* This mixin is meant to help enable/disable OpenType features in your web pages with web fonts that support them */
@mixin otfeatures($c2sc: 0, $calt: 0, $clig: 0, $dlig: 0, $frac: 0, $hist: 0, $hlig: 0, $kern: 0, $liga: 0, $nalt: 0, $ncase: 0, $nspace: 0, $salt: 0, $smcp: 0, $ss01: 0, $ss02: 0, $ss03: 0, $ss04: 0, $ss05: 0, $swsh: 0, $zero: 0) {
$fraclabel: 'frac' !default;
$fracval: 0 !default;
@if $frac == 0 {
$fracval: 0;
$fraclabel: 'frac';
} @else if $frac == 'frac' {
$fracval: 1;
$fraclabel: 'frac';
} @else if $frac == 'afrc' {
$fracval: 1;
$fraclabel: 'afrc';
}
$ncaselabel: null !default;
$ncaselabelalt: null !default;
$ncaseval: null !default;
@if $ncase == 0 {
$ncaseval: null;
$ncaselabel: null;
$ncaselabelalt: null;
} @else if $ncase == 'lnum' {
$ncaseval: '1,';
$ncaselabel: 'lnum';
$ncaselabelalt: '"lnum=1",';
} @else if $ncase == 'onum' {
$ncaseval: '1,';
$ncaselabel: 'onum';
$ncaselabelalt: 'onum=1,';
}
$nspacelabel: null !default;
$nspacelabelalt: null !default;
$nspaceval: null !default;
@if $nspace == 0 {
$nspaceval: 0;
$nspacelabel: 'snum';
$nspacelabelalt: 'snum=0';
} @else if $nspace == 'pnum' {
$nspaceval: 1;
$nspacelabel: 'pnum';
$nspacelabelalt: 'pnum=1';
} @else if $nspace == 'tnum' {
$nspaceval: 1;
$nspacelabel: 'tnum';
$nspacelabelalt: 'tnum=1';
}
-moz-font-feature-settings : 'c2sc=#{$c2sc}','calt=#{$calt}','clig=#{$clig}','dlig=#{$dlig}','#{$fraclabel}=#{$fracval}','hist=#{$hist}','hlig=#{$hlig}','kern= #{$kern}','liga=#{$liga}','nalt=#{$nalt}','salt=#{$salt}','smcp=#{$smcp}','ss01=#{$ss01}','ss02=#{$ss02}','ss03=#{$ss03}','ss04=#{$ss04}','ss05=#{$ss05}','swsh=#{$swsh}','zero=#{$zero}', #{$ncaselabelalt} $nspacelabelalt;
-moz-font-feature-settings : "c2sc" $c2sc,"calt" $calt,"clig" $clig,"dlig" $dlig,"#{$fraclabel}" $fracval,"hist" $hist,"hlig" $hlig,"kern" $kern,"liga" $liga,"nalt" $nalt,"salt" $salt,"smcp" $smcp,"ss01" $ss01,"ss02" $ss02,"ss03" $ss03,"ss04" $ss04,"ss05" $ss05,"swsh" $swsh,"zero" $zero, $ncaselabel #{$ncaseval} $nspacelabel $nspaceval;
-webkit-font-feature-settings : "c2sc" $c2sc,"calt" $calt,"clig" $clig,"dlig" $dlig,"#{$fraclabel}" $fracval,"hist" $hist,"hlig" $hlig,"kern" $kern,"liga" $liga,"nalt" $nalt,"salt" $salt,"smcp" $smcp,"ss01" $ss01,"ss02" $ss02,"ss03" $ss03,"ss04" $ss04,"ss05" $ss05,"swsh" $swsh,"zero" $zero, $ncaselabel #{$ncaseval} $nspacelabel $nspaceval;
-ms-font-feature-settings : 'c2sc=#{$c2sc}','calt=#{$calt}','clig=#{$clig}','dlig=#{$dlig}','#{$fraclabel}=#{$fracval}','hist=#{$hist}','hlig=#{$hlig}','kern= #{$kern}','liga=#{$liga}','nalt=#{$nalt}','salt=#{$salt}','smcp=#{$smcp}','ss01=#{$ss01}','ss02=#{$ss02}','ss03=#{$ss03}','ss04=#{$ss04}','ss05=#{$ss05}','swsh=#{$swsh}','zero=#{$zero}', #{$ncaselabelalt} $nspacelabelalt;
-o-font-feature-settings : "c2sc" $c2sc,"calt" $calt,"clig" $clig,"dlig" $dlig,"#{$fraclabel}" $fracval,"hist" $hist,"hlig" $hlig,"kern" $kern,"liga" $liga,"nalt" $nalt,"salt" $salt,"smcp" $smcp,"ss01" $ss01,"ss02" $ss02,"ss03" $ss03,"ss04" $ss04,"ss05" $ss05,"swsh" $swsh,"zero" $zero, $ncaselabel #{$ncaseval} $nspacelabel $nspaceval;
font-feature-settings : "c2sc" $c2sc,"calt" $calt,"clig" $clig,"dlig" $dlig,"#{$fraclabel}" $fracval,"hist" $hist,"hlig" $hlig,"kern" $kern,"liga" $liga,"nalt" $nalt,"salt" $salt,"smcp" $smcp,"ss01" $ss01,"ss02" $ss02,"ss03" $ss03,"ss04" $ss04,"ss05" $ss05,"swsh" $swsh,"zero" $zero, $ncaselabel #{$ncaseval} $nspacelabel $nspaceval;
}
/*
OpenType Features Key
@mixin otfeatures($c2sc: 0, $calt: 0, $clig: 0, $dlig: 0, $frac: 0, $hist: 0, $hlig: 0, $kern: 0, $liga: 0, $nalt: 0, $ncase: 0, $nspace: 0, $salt: 0, $ss01: 0, $ss02: 0, $ss03: 0, $ss04: 0, $ss05: 0, $swsh: 0, $zero: 0)
// Ligatures
"liga" : common ligatures
"dlig" : discretionary ligatures
"clig" : contextual ligatures
"hlig" : historical ligatures
// Alternate Characters
"swsh" : swashes
"calt" : contextual alternates
"hist" : historical character alternatives
"salt" : stylistic alternatives
// Kerning
"kern" : enable use of embedded kerning table
// Letter Case
"smcp" : small caps
"c2sc" : small caps from caps
// Stylistic Alternates
"ss01" : alternate stylistic set 1
"ss02" : alternate stylistic set 2
"ss03" : alternate stylistic set 3
"ss04" : alternate stylistic set 4
"ss05" : alternate stylistic set 5
// Numeric Extras
"zero" : slashed-zero
"nalt" : alternate annotation
The following OT Features are either/or rather than single choices, so require some 'if/else' logic
// Number Case
"ncase" : number case
0: default
lnum: lining figures
onum: old style figures
// Number Spacing
"nspace": number spacing
0: default
pnum: proportional spacing
tnum: tabuplar spacing
"frac" : fractions
0: off
frac: normal fractions
afrc: alternate fractions
*/