Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ldiconfont

loadingio32MIT0.2.8

iconfont dedicated for loading.io

readme

ldIconFont

ldiconfont preview

Build icon font with SVGs, along with a pixel-perfect line icon set in 24x24 / 16x16 resolution, along with source Ai files and SVG files. Check our Live Demo for ldiconfont in action.

Usage

include ldif.min.css file and specify font url:

<link rel="stylesheet" type="text/css" href="ldif.min.css"/>
<style type="text/css">
  @font-face {
    font-family: 'ldi';
    font-weight: normal;
    font-style: normal;
    src: url('path/to/your/ldif.ttf') format('truetype');
  }
</style>

Then, use icon via classes:

<i class="i-plus"></i>

Tweak

You can make customized builds to tweak icon alignment, but even with the same font sometimes it doesn't align properly with different font size.

You can customize icon vertical position with following CSS:

i.ldif:before
  position: relative
  top: 0

replace ldif with your custom class and tweak top value to match your font.

Custom build

run ./bin/makefont.js to make a custom build. available parameters:

  • map ( -m ) - optional unicode / icon name mapping file. check src/unicode.json for format.
  • units-per-em ( -u ) - glyph size ( default 900 )
  • input ( -i ) - input directory of SVGs. file name of SVG will be its icon name.
  • ascent ( -a ) - ascent for tweaking icon vertical alignment. default 700
  • offset-y ( -y ) - adjust glyph vertical position. negative toward down, positive toward up. default -130
  • dir ( -d ) - output directory. dist if omitted.

Additionally, you can add a config.json under your input directory, makefont will parse and use it to config build automatically. Check src/vector-files/line/svg/config.json as an example.

You can also use ldiconfont to build your own iconfont by installing ldiconfont then run:

npm install --save ldiconfont
npx ldif  ... ( parameters ) ...

sample command for 800 x 800 SVGs:

npx ldif -u 800 -i ~/path/to/svg -a 700.5 -y -90.5 -d out

We suggest using units-per-em greater than 800 to prevent precision loss when converting to ttf.

Verify Your Build

use npx ldif-server -d <your-font-dist-folder> to start up a test server for viewing the result of your customized build.

Challenges

SVG Font

Basic construct of SVG Font:

svg: defs: font
  font-face
  glyph
  ...
  missing-glyph

Structure

ldiconfont provides different variants and favors. You can find all of them in dist/<favor>, with source counterparts under src/vector-files/<favor>, including source illustrator file ( raw paths and merged composite shape ) and generated SVG files.

Currently we only provide 3 favors:

  • Line 24 x 24 bold ( default font after 0.1.0 )
  • Line 16 x 16 light
  • Legacy ( icons used in 0.0.1 )

TODO

  • refine the list of icon that we should make including following scenario:
    • Generic Set
    • Text Editor
    • Source Control
    • Media Player
  • refine icons to make them more consistent and pixel-perfect, in 12px ~ 18px.
  • support (light, regular, bold) x (solid, line) = 6 different styles.
  • support SVG fragment and SVG embed with proper document and even API.
  • refine icon development process
  • add additional preview scenario such as a sample view when using in GitHub.

Reference

License

MIT

changelog

Change Logs

v0.2.8

  • add alignment icons

v0.2.7

  • tweak lock / unlock icon

v0.2.6

  • add paste icon

v0.2.5

  • audit fix for vulnerabilities fixing
  • add new-page icon

v0.2.4

  • upgrade modules for vulnerabilities fixing
  • add qrcode icon

v0.2.3

  • upgrade jsdom from 15.0.0 to 20.0.0
  • upgrade svgo from 1.2.2 to `2.8.0'
  • rebuild after module upgrade
  • add descent config and tweak all fonts for better alignment

v0.2.2

  • add icons for spreadsheet, question and discuss in line-24-bold and line-16-light.

v0.2.1

  • add icon for globe

v0.2.0

  • don't specify src by default in ldi font-face since it's usually in other path.
  • add bundled index.min.css to simplify icon font loading

v0.1.10

  • republish to add missing files

v0.1.9

  • upgrade modules
  • release with compact directory structure
  • add style in package.json
  • patch test code to make it work with upgraded modules

v0.1.8

  • add fonts in woff2 format

v0.1.7

  • add icons: radiobox-semi / checkbox-semi / sad / heart-fill / star-fill
  • check and update all current line-24 icons to make them pixel perfect.

v0.1.6

  • add caret icons ( right, left, up, down ) in both line-24-bold and line-16-light
  • hide fallback font to prevent flash of emojis by setting font-display to block
  • upgrade modules
  • tweak line-24-bold iconfont alignment and rebuild all fonts

v0.1.5

  • rebuild icons

v0.1.4

  • tweak line-24-bold upload icon alignment
  • add info-circle icon in line-24-bold and line-16-light

v0.1.3

  • fix line-16-light icon bug ( icons don't match their names )
  • add style switcher in demo page

v0.1.2

  • add icons for keys shift, alt and cmd.

v0.1.1

  • upgrade packages including template, fedep, livescript.
  • rebuild dist with upgraded packages.
  • add demo link to github page.

v0.1.0

icon update:

  • rename
    • check-o -> check-circle
    • search -> magnify
    • circle -> radiobox-off
  • completely re-design as pixel-perfect 16px icons, in line-light style.
  • update buliding process and add preview functionality.
  • support custom build in place or as a module.