1.3.1 • Published 10 years ago

font-builder v1.3.1

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

Also generates .scss mixins and classes for you to use, with correct code points and aliases.

Usage

fontBuilder({
  fonts: {
    'fa': './Vendor/font-awesome/fonts/fontawesome-webfont.svg'
  },
  glyphs: {
    'fa:f067': 'plus',
    'fa:f068': 'minus',
    'fa:f021': 'refresh'
  }
});

All available options

var defaults = {
  fontname: 'built-font',
  fonts: {},
  glyphs: {},
  outputScss: true
};
var fontDefaults = {
  fontUnitsPerEm: 512,
  ascent: 480,
  descent: -32,
  horizAdvX: 512
};
var pathDefaults = {
  stylesDirectory: './styles',
  fontsDirectory: './fonts',
  fontsUrl: '../fonts'
};

Example of generated _icons.scss file

@font-face {
  font-family: 'built-font';
  src: url('built-font.eot?e7822c');
  src: url('built-font.eot?e7822c#iefix') format('embedded-opentype'),
    url('built-font.ttf?e7822c') format('truetype'),
    url('built-font.woff?e7822c') format('woff'),
    url('built-font.svg?e7822c#svgfont') format('svg');
  font-weight: normal;
  font-style: normal;
}

@mixin icon {
  display: inline-block;
  font-family: 'built-font';
  font-style: normal;
  font-weight: normal;
  font-size: inherit;
  line-height: 1;
  vertical-align: middle;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon { @include icon; }

@mixin icon-arrow-left   { content: '\e62a'; }
@mixin icon-arrow-right  { content: '\e62b'; }
@mixin icon-search       { content: '\e01f'; }

.icon-arrow-left:before  { @include icon-arrow-left; }
.icon-arrow-right:before { @include icon-arrow-right; }
.icon-search:before      { @include icon-search; }

Example of using the font in HTML

<i class="icon icon-search"></i>

Credits

Most of the (really) hard work here was already done by Vitaly.

1.3.1

10 years ago

1.2.10

10 years ago

1.2.9

10 years ago

1.2.8

10 years ago

1.2.7

10 years ago

1.2.6

10 years ago

1.2.5

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago