font.scss 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Adds a font specification to an element.
  3. * Uses a single "font" property if possible, otherwise uses separate font-family, font-size,
  4. * font-weight and line-height properties.
  5. *
  6. * @param {number/string} [$font-weight=null]
  7. * The font-weight
  8. *
  9. * @param {number/string} [$font-size=null]
  10. * The font-size
  11. *
  12. * @param {number/string} [$line-height=null]
  13. * The line-height
  14. *
  15. * @param {string} [$font-family=null]
  16. * The font-family
  17. *
  18. * @member Global_CSS
  19. * @private
  20. */
  21. @mixin font(
  22. $font-weight: null,
  23. $font-size: null,
  24. $line-height: null,
  25. $font-family: null
  26. ) {
  27. @if $font-family == null or $font-size == null {
  28. // if font-family or font-size is null we cannot use a single "font" declaration
  29. font-weight: $font-weight;
  30. font-size: $font-size;
  31. line-height: $line-height;
  32. font-family: $font-family;
  33. } @else if $line-height == null {
  34. font: $font-weight $font-size $font-family;
  35. } @else {
  36. font: $font-weight #{$font-size}/#{$line-height} $font-family;
  37. }
  38. }