font-feature-settings() is a Sass mixin for enabling OpenType features via CSS. Support for these features varies based on browser and also based on the fonts that you've chosen to use. Only OpenType (.otf) fonts have support for font features.
===
SASS syntax:
// Import the rem partial
@import "my-partials-path/font-feature-settings"
// Pass a Sass list of features into the mixin to enable those features
table.accounting-style
+font-feature-settings(lnum tnum)
SCSS syntax:
// Import the rem partial
@import "my-partials-path/font-feature-settings";
// Pass a Sass list of features into the mixin to enable those features
table.accounting-style {
@include font-feature-settings(lnum tnum);
}
The following CSS will be produced:
table.accounting-style {
-moz-font-feature-settings: "lnum" 1, "tnum" 1;
-moz-font-feature-settings: "lnum=1", "tnum=1";
-ms-font-feature-settings: "lnum" 1, "tnum" 1;
-o-font-feature-settings: "lnum" 1, "tnum" 1;
-webkit-font-feature-settings: "lnum" 1, "tnum" 1;
font-feature-settings: "lnum" 1, "tnum" 1;
}
===
The following list details font features that you can enable (assuming the chosen font supports it). This list was taken from Microsoft's OpenType Layout tag registry.
aalt
- Access All Alternatesabvf
- Above-base Formsabvm
- Above-base Mark Positioningabvs
- Above-base Substitutionsafrc
- Alternative Fractionsakhn
- Akhandsblwf
- Below-base Formsblwm
- Below-base Mark Positioningblws
- Below-base Substitutionscalt
- Contextual Alternatescase
- Case-Sensitive Formsccmp
- Glyph Composition / Decompositioncfar
- Conjunct Form After Rocjct
- Conjunct Formsclig
- Contextual Ligaturescpct
- Centered CJK Punctuationcpsp
- Capital Spacingcswh
- Contextual Swashcurs
- Cursive PositioningcvNN
- Character Variants (NN is a two digit number)c2pc
- Petite Capitals From Capitalsc2sc
- Small Capitals From Capitalsdist
- Distancesdlig
- Discretionary Ligaturesdnom
- Denominatorsexpt
- Expert Formsfalt
- Final Glyph on Line Alternatesfin2
- Terminal Forms #2fin3
- Terminal Forms #3fina
- Terminal Formsfrac
- Fractionsfwid
- Full Widthshalf
- Half Formshaln
- Halant Formshalt
- Alternate Half Widthshist
- Historical Formshkna
- Horizontal Kana Alternateshlig
- Historical Ligatureshngl
- Hangulhojo
- Hojo Kanji Forms (JIS X 0212-1990 Kanji Forms)hwid
- Half Widthsinit
- Initial Formsisol
- Isolated Formsital
- Italicsjalt
- Justification Alternatesjp78
- JIS78 Formsjp83
- JIS83 Formsjp90
- JIS90 Formsjp04
- JIS2004 Formskern
- Kerninglfbd
- Left Boundsliga
- Standard Ligaturesljmo
- Leading Jamo Formslnum
- Lining Figureslocl
- Localized Formsltra
- Left-to-right alternatesltrm
- Left-to-right mirrored formsmark
- Mark Positioningmed2
- Medial Forms #2medi
- Medial Formsmgrk
- Mathematical Greekmkmk
- Mark to Mark Positioningmset
- Mark Positioning via Substitutionnalt
- Alternate Annotation Formsnlck
- NLC Kanji Formsnukt
- Nukta Formsnumr
- Numeratorsonum
- Oldstyle Figuresopbd
- Optical Boundsordn
- Ordinalsornm
- Ornamentspalt
- Proportional Alternate Widthspcap
- Petite Capitalspkna
- Proportional Kanapnum
- Proportional Figurespref
- Pre-Base Formspres
- Pre-base Substitutionspstf
- Post-base Formspsts
- Post-base Substitutionspwid
- Proportional Widthsqwid
- Quarter Widthsrand
- Randomizerkrf
- Rakar Formsrlig
- Required Ligaturesrphf
- Reph Formsrtbd
- Right Boundsrtla
- Right-to-left alternatesrtlm
- Right-to-left mirrored formsruby
- Ruby Notation Formssalt
- Stylistic Alternatessinf
- Scientific Inferiorssize
- Optical sizesmcp
- Small Capitalssmpl
- Simplified Formsss01
- Stylistic Set 1ss02
- Stylistic Set 2ss03
- Stylistic Set 3ss04
- Stylistic Set 4ss05
- Stylistic Set 5ss06
- Stylistic Set 6ss07
- Stylistic Set 7ss08
- Stylistic Set 8ss09
- Stylistic Set 9ss10
- Stylistic Set 10ss11
- Stylistic Set 11ss12
- Stylistic Set 12ss13
- Stylistic Set 13ss14
- Stylistic Set 14ss15
- Stylistic Set 15ss16
- Stylistic Set 16ss17
- Stylistic Set 17ss18
- Stylistic Set 18ss19
- Stylistic Set 19ss20
- Stylistic Set 20subs
- Subscriptsups
- Superscriptswsh
- Swashtitl
- Titlingtjmo
- Trailing Jamo Formstnam
- Traditional Name Formstnum
- Tabular Figurestrad
- Traditional Formstwid
- Third Widthsunic
- Unicasevalt
- Alternate Vertical Metricsvatu
- Vattu Variantsvert
- Vertical Writingvhal
- Alternate Vertical Half Metricsvjmo
- Vowel Jamo Formsvkna
- Vertical Kana Alternatesvkrn
- Vertical Kerningvpal
- Proportional Alternate Vertical Metricsvrt2
- Vertical Alternates and Rotationzero
- Slashed Zero
===
Inspired by and based on Richard Rutter's excellent CSS3 OpenType Sandbox tool.