Skip to content

Instantly share code, notes, and snippets.

@curiositry
Created March 4, 2014 05:51
Show Gist options
  • Save curiositry/9340964 to your computer and use it in GitHub Desktop.
Save curiositry/9340964 to your computer and use it in GitHub Desktop.
A basic SASS mixin that makes OpenType features easier to work with on the web.
@mixin openTypeFeatures(
$discretionary,
$historical,
$proportional-nums,
$tabular-nums,
$oldstyle-nums,
$lining-nums,
$superscript,
$subscript,
$scientific-inferiours,
$ordinals,
$slashed-zero,
$fractions,
$caps-to-sc,
$lowercase-to-sc,
$caps-to-pc,
$lowercase-to-pc,
$uppercase-varients,
$uppercase-spacing,
$swashes,
$contextual-swashes,
$historical-forms,
$titling-alternates
){
$standard-syntax: "dlig" $discretionary, "hlig" $historical, "pnum" $proportional-nums, "tnum" $tabular-nums, "onum" $oldstyle-nums, "lnum" $lining-nums, "sups" $superscript, "subs" $subscript, "sinf" $scientific-inferiours, "ordn" $ordinals, "zero" $slashed-zero, "frac" $fractions, "c2sc" $caps-to-sc, "smcp" $lowercase-to-sc, "c2pc" $caps-to-pc, "pcap" $lowercase-to-pc, "case" $uppercase-varients, "cpsp" $uppercase-spacing, "swsh" $swashes, "cswh" $contextual-swashes, "hist" $historical-forms, "titl" $titling-alternates;
$legacy-syntax: 'dlig='+$discretionary+', hlig='+$historical+', pnum='+$proportional-nums+', tnum='+$tabular-nums+', onum='+$oldstyle-nums+', lnum='+$lining-nums+', sups='+$superscript+', subs='+$subscript+', sinf='+$scientific-inferiours+', ordn='+$ordinals+', zero='+$slashed-zero+', frac='+$fractions+', c2sc='+$caps-to-sc+', smcp='+$lowercase-to-sc+', c2pc='+$caps-to-pc+', pcap='+$lowercase-to-pc+', case='+$uppercase-varients+', cpsp='+$uppercase-spacing+', swsh='+$swashes+', cswh='+$contextual-swashes+', hist='+$historical-forms+', titl='+$titling-alternates;
-moz-font-feature-settings: $standard-syntax;
-moz-font-feature-settings: $legacy-syntax;
-ms-font-feature-settings: $standard-syntax;
-o-font-feature-settings: $standard-syntax;
-webkit-font-feature-settings: $standard-syntax;
font-feature-settings: $standard-syntax;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment