Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

font-carrier

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

font-carrier - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

8

lib/class/font.js

@@ -66,8 +66,10 @@ var Base = require('./base.js')

*/
getSvg: function(keys) {
getSvg: function(keys,options) {
var glys = this.getGlyph(keys)
if (!glys) return ''
options = options || {}
if (glys instanceof Glyph) {
return glys.toSvg()
return glys.toSvg(options)
}

@@ -77,3 +79,3 @@

return _.map(glys, function(gly) {
return (gly && gly instanceof Glyph) ? gly.toSvg() : ''
return (gly && gly instanceof Glyph) ? gly.toSvg(options) : ''
})

@@ -80,0 +82,0 @@ }

@@ -92,9 +92,10 @@ var Base = require('./base.js')

* @param {object} options 导入的选项
* @param {string} options.path 导出svg的路径,可以不传,不传就不会写文件
* @param {string} options.width 导出svg的宽度,默认100px
* @param {string} options.height 导出svg的高度,默认100px
* @param {string} options.path 导出svg的路径,可以不传,不传就不会写文件
* @param {string} options.skipViewport 如果为true,那么将不会注入width和height
* @param {string} options.width 导出svg的宽度,默认100px
* @param {string} options.height 导出svg的高度,默认100px
*
* @return {string} svg字符串
*/
toSvg: function(path, options) {
toSvg: function(options) {
var data = _.clone(this.options)

@@ -101,0 +102,0 @@ var ascent = this.__font.__fontface.get('ascent')

@@ -83,3 +83,3 @@ var multiline = require('multiline')

<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="<%= options['width'] %>" height="<%= options['height'] %>" viewBox="0 0 <%= glyph['horizAdvX'] %> <%= glyph['vertAdvY'] %>">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" <% if(!options['skipViewport']){ %> x="0" y="0" width="<%= options['width'] %>" height="<%= options['height'] %>" <% } %> viewBox="0 0 <%= glyph['horizAdvX'] %> <%= glyph['vertAdvY'] %>">
<path d="<%= glyph['d'] %>"/>

@@ -86,0 +86,0 @@ </svg>

{
"name": "font-carrier",
"version": "0.0.10",
"version": "0.0.11",
"description": "字体搬运工,中文字体解决方案,iconfont",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -63,3 +63,5 @@ var fs = require('fs')

var path = font.getSvg('我')
var path = font.getSvg('我',{
skipViewport:true
})
fs.writeFileSync('./test/export.svg',path)

@@ -66,0 +68,0 @@ //测试多个

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc