| 1 |
// mixins |
| 2 |
// -------------------------- |
| 3 |
@use 'variables' as v; |
| 4 |
|
| 5 |
// base rendering for an icon |
| 6 |
@mixin fa-icon($family: v.$family) { |
| 7 |
--_#{v.$css-prefix}-family: var(--#{v.$css-prefix}-family, var(--#{v.$css-prefix}-style-family, '#{$family}')); |
| 8 |
-webkit-font-smoothing: antialiased; |
| 9 |
-moz-osx-font-smoothing: grayscale; |
| 10 |
display: var(--#{v.$css-prefix}-display, #{v.$display}); |
| 11 |
font-family: var(--_#{v.$css-prefix}-family); |
| 12 |
font-feature-settings: normal; |
| 13 |
font-style: normal; |
| 14 |
font-synthesis: none; |
| 15 |
font-variant: normal; |
| 16 |
font-weight: var(--#{v.$css-prefix}-style, #{v.$style}); |
| 17 |
line-height: 1; |
| 18 |
text-align: center; |
| 19 |
text-rendering: auto; |
| 20 |
width: var(--#{v.$css-prefix}-width, #{v.$fw-width}); |
| 21 |
} |
| 22 |
|
| 23 |
// sets relative font-sizing and alignment (in _sizing) |
| 24 |
@mixin fa-size ($font-size) { |
| 25 |
font-size: calc(#{$font-size} / #{v.$size-scale-base} * 1em); /* converts a #{$font-size}px size into an em-based value that's relative to the scale's #{v.$size-scale-base}px base */ |
| 26 |
line-height: calc(1 / #{$font-size} * 1em); /* sets the line-height of the icon back to that of it's parent */ |
| 27 |
vertical-align: calc(((6 / #{$font-size}) - (3 / 8)) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */ |
| 28 |
} |