Skip to content

Instantly share code, notes, and snippets.

@jamesl1001
Created May 20, 2013 15:34
Show Gist options
  • Save jamesl1001/5612989 to your computer and use it in GitHub Desktop.
Save jamesl1001/5612989 to your computer and use it in GitHub Desktop.
A function for use when overriding font styles for different scriptures, written with @stefano-belloro.
// ====================
// = Language Scripts =
// ====================
// A function for use when overriding font styles for different scriptures.
// Essentially an associative array loop which first looks for a keypair which matching the $script for that service.
// If that is not found, it will revert to the latin value.
// NOTE: the latin value should ALWAYS be present.
// USAGE:
// $story-body-h1: get-script-value(( latin 1, hindi 1.25 ));
// $story-body-p: get-script-value(( latin 1.25, hindi 1.5 ));
// h1 {
// line-height: $story-body-h1;
// }
// p {
// line-height: $story-body-p;
// }
@function get-script-value($selector) {
$value: '';
@each $scriptvalue in $selector {
@if nth($scriptvalue, 1) == $script {
$value: nth($scriptvalue, 2);
}
@if $value == '' {
@if nth($scriptvalue, 1) == 'latin' {
$value: nth($scriptvalue, 2);
}
}
}
@return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment