Comments (1)
尝试以下代码创建时候 字体默认的 xy似乎 不是偏移线产生的
const fontCarrier = require('font-carrier')
const fs = require('fs');
const font = fontCarrier.transfer('./font.ttf')
let writeSvgString = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 1000 1000"><rect y="REPLACEY" width="1000" height="1000" fill="#000"/></svg>'
const blockUnicode = "!";
const blockUnicodeString = String.fromCharCode(0x0021);
const t = font.getGlyph("!");
console.log(t.options.vertAdvY, t);
writeSvgString = writeSvgString.replace("1000", t.options.vertAdvY);
console.log(font.getFontface().options)
const y = font.getFontface().options.descent;
console.log(y);
writeSvgString = writeSvgString.replace("REPLACEY", Math.abs(y));
console.log(blockUnicode, blockUnicodeString, writeSvgString);
font.setGlyph(blockUnicode, {
unicode: blockUnicode,
glyphName: "fullBlock",
svg: writeSvgString,
horizAdvX: parseInt(t.options.vertAdvY),
vertAdvY: t.options.vertAdvY
})
font.output({
path: './test/font',
types: ['ttf']
});
from font-carrier.
Related Issues (20)
- Unicode conversion issues.
- 请停止推荐font-collector HOT 1
- 有闭合区间的字填充规则不正确 HOT 2
- 升级 svg2ttf 到 5.0.0
- OTS parsing error: incorrect file size in WOFF header
- es6中有问题 HOT 1
- 解析字体后,空格字符丢失了 HOT 2
- woff 转 svg有什么好的方案推荐吗?
- 有没有根据字形反转成文字的功能啊? HOT 1
- setSvg,同一个svg文件只修改path中的几个点,生成字体文件之后页面报错Failed to decode downloaded font? HOT 5
- 部分 svg 图标生成字体后,页面引用不显示 HOT 1
- 抽取后,汉字文字高度不同了,竖排差别更大 HOT 1
- 如何取到正确的glyphs对象?
- 什么时候可以支持彩色字体呢? HOT 1
- 我用font-carrier生成的字在记事本里显示正常,但是在word里无法正常显示是怎么回事?
- 为font-carrier开发一个 Declations HOT 1
- 为啥这么一个保存的图标,出来的iconfont效果与svg原图不一致呢?
- Uncaught TypeError: Cannot read properties of undefined (reading 'en')
- 解析tahoma.ttf 报错
- not conrect in function 'function toUnicode(str)'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from font-carrier.