font-stack
v1.0.0
Published
Database & utils for font-stacks
Downloads
71
Readme
font-stack
Install
yarn add font-stack
// or
npm install --save font-stack
Usage
import { composeStack, FONT_STACKS } from 'font-stack'
const fontStack = composeStack([
'Source Sans Pro',
...FONT_STACKS['Arial']
])
console.log(fontStack)
// 'Source Sans Pro', Arial, 'Helvetica Neue', Helvetica, sans-serif
API
composeStack(families)
Escapes and assemble a font-stack represented in an Array.
returns
[string]: output escaped font stack stringfamilies
[array]: input font-stack families array
(see escape rules)
FONT_STACKS
Common font stacks databases
[key]
[array]: font-stack families array
(see src/font-stack-database.js)
_escapeFamily(family)
Escapes a single family
returns
[string]: output escaped family stringfamily
[string]: input family string
_isUnsafe(family)
Tests if a single family should be escaped
returns
[bool]: wether the family should be escaped (contains' '
)family
[string]: input family string