font-stack

1.0.0 • Public • Published

font-stack

build status code style

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 string
  • families [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 string
  • family [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

Readme

Keywords

none

Package Sidebar

Install

npm i font-stack

Weekly Downloads

18

Version

1.0.0

License

MIT

Unpacked Size

8.72 kB

Total Files

10

Last publish

Collaborators

  • cyril.chapon