harfbuzz / harfbuzzjs

Providing HarfBuzz shaping library for client/server side JavaScript projects
https://harfbuzz.github.io/harfbuzzjs/
Other
204 stars 35 forks source link

No shaping happening? #18

Closed simoncozens closed 4 years ago

simoncozens commented 4 years ago

Getting this both on Node and web:

$ node hbjs.example.node.js
[
  { g: 97, cl: 0, ax: 0, ay: 0, dx: 0, dy: 0 },
  { g: 98, cl: 1, ax: 0, ay: 0, dx: 0, dy: 0 },
  { g: 99, cl: 2, ax: 0, ay: 0, dx: 0, dy: 0 }
]
simoncozens commented 4 years ago

But nohbjs.html does work.

simoncozens commented 4 years ago

Here's the difference. This works:

      var buffer = hbjs.createBuffer();
      buffer.addText('abc');
      buffer.guessSegmentProperties();
      buffer.shape(font);

This doesn't:

      var buffer = hbjs.createBuffer();
      buffer.addText('abc');
      buffer.guessSegmentProperties();
      hbjs.shape(buffer, font); // features are not supported yet

Yes, I know it should be the same code. No, I don't know why.

ebraminio commented 4 years ago

No, I don't know why.

wrong calling order on that example 🤦‍♂️, fixed