rkusa / ttfjs

TTFjs is a TrueType font parser entirely written in JavaScript and compatible to both Node.js and the Browser
MIT License
21 stars 4 forks source link

A bug when I Covent To Font-Face #3

Open daiyanbao opened 9 years ago

daiyanbao commented 9 years ago

ttfjsbug Convert By https://everythingfonts.com/font-face

And Can't Convert By http://www.fontsquirrel.com/tools/webfont-generator

FontName:FZHCJW.TTF System:Win8.1 Node.js:0.12.4.0

ExampleCode:

var fs = require('fs');
var TTFFont = require('ttfjs');
var font = new TTFFont(fs.readFileSync('D:\\git\\Fonts\\FZHCJW.TTF'));
var subset = font.subset({remap:false});
subset.use('代言宝\r\n')
subset.embed()

fs.writeFileSync('./out/test.ttf', toBuffer(subset.save()), { encoding: 'binary' })

function toBuffer(ab) {
  var buffer = new Buffer(ab.byteLength)
  var view = new Uint8Array(ab)
  for (var i = 0; i < buffer.length; ++i) {
    buffer[i] = view[i]
  }
  return buffer
}
rkusa commented 9 years ago

Thanks for reporting this issue. I'll try to have a look in the next couple of days.

rkusa commented 9 years ago

Which part of the screenshot shows what?

daiyanbao commented 9 years ago

FontLab STudio 5

rkusa commented 9 years ago

What is the part on the left? Is the middle part the with ttfjs generated font and right one the with everything font converted one?

daiyanbao commented 9 years ago

when I Don't Convert To Font-Face 8A00 IS Simple Chinese 言