fontawesome-markers

An export of the fontawesome glyphs into named SVG Paths.

  • 所有者: nathan-muir/fontawesome-markers
  • 平台:
  • 許可證: Other
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

fontawesome-markers

An export of the fontawesome glyphs into named SVG Paths in javascript.

All glyphs have the same names as font-awesome, except they are capitalised, and underscored, eg "exclamation-circle" becomes "EXCLAMATION_CIRCLE"

Usage

Install on bower with bower install fontawesome-markers
Or, install with NPM with npm install fontawesome-markers
Or, just add fontawesome-markers.min.js to your page and reference it like the examples below.

If you're a masochist, you can try extracting other webfonts (or newer versions of Font Awesome) using the scripts in extractor/

Example - Font Awesome on Google Maps

You can use these paths, in products like Google Maps, for example:

new google.maps.Marker({
    map: map,
    icon: {
        path: fontawesome.markers.EXCLAMATION_CIRCLE,
        scale: 0.5,
        strokeWeight: 0.2,
        strokeColor: 'black',
        strokeOpacity: 1,
        fillColor: '#f8ae5f',
        fillOpacity: 0.7,
    },
    clickable: false,
    position: new google.maps.LatLng(lat, lng)
});

Example - Font Awesome on Canvas

You can also draw them to canvas, using the new Path2D api, you may need to use a polyfill for unsupported browsers

var canvas = document.getElementsByTagName('canvas')[0];
var ctx = canvas.getContext("2d");
var path = new Path2D(fontawesome.markers.EXCLAMATION_CIRCLE);
ctx.strokeStyle="#ff0000";
ctx.lineWidth=2;
ctx.fillStyle="#0000ff";
ctx.translate(0, 64);
ctx.fill(path);
ctx.stroke(path);

Example - Loading Font Awesome Markers via JSON/ XHR

Instead of including it as an inline script, you can also load it with JSON/XHR.

var fontawesome = {
   markers: null
};
var xhr = new XMLHttpRequest();
xhr.onload = function(){
  fontawesome.markers = JSON.parse(this.responseText);
}
xhr.open("get", "fontawesome-markers.json", true);
xhr.send();

Update

  • 18th April 2016 - Made it super easy to build for new versions of fontawesome. Released on Bower & NPM.
  • 16th October 2014 - Updated to fontawesome 4.2.0
  • 7th August 2014 - Updated to fontawesome 4.1.0, see the Fontawesome Upgrade Guide for the list of changed names.
  • 26th September 2013 - Changed font extraction process - Glyph size is a much more manageable 64px now, and rotation / flip corrected.

主要指標

概覽
名稱與所有者nathan-muir/fontawesome-markers
主編程語言PHP
編程語言PHP (語言數: 3)
平台
許可證Other
所有者活动
創建於2013-06-26 01:48:36
推送於2016-04-18 01:54:37
最后一次提交2016-04-18 11:54:30
發布數15
最新版本名稱v4.6.1 (發布於 )
第一版名稱release/3.2.1 (發布於 )
用户参与
星數155
關注者數8
派生數69
提交數21
已啟用問題?
問題數9
打開的問題數5
拉請求數1
打開的拉請求數0
關閉的拉請求數3
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?