question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run text rendering tests on OpenType.js

See original GitHub issue

Hi all, I’ve started a project for testing text rendering systems; the project is hosted/copyrighted by Unicode. Although this test suite is still very much in its infancy, you might still find it useful. Feel free to change its test framework so it runs node.js + OpenType.js on the test suite when passing --engine=OpenType.js; your pull requests would be very welcome. Also, don’t hesitate to extend the test coverage if you want; you’d help other projects too. https://github.com/icu-project/text-rendering-tests

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
brawercommented, Apr 10, 2017

Friendly ping, since this would have found https://github.com/nodebox/opentype.js/issues/273 much earlier. So here’s an offer. If somebody implements a command line tool in Node that can be called like this:

some-command --testcase=SomeID/1 --font=path/to/testfont.otf --render="Jj"

so the tool writes an SVG file to standard output, like the following output for --testcase=SomeID/1, --font pointing to this test font, and --render="Jj":

<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    viewBox="0 -455 535 1383">
  <symbol id="SomeID/1.J" overflow="visible"><path d="M125,184 L125,599 L57,599 Q41,599 41,613 Q41,620 46,637 L48,645 L261,645 Q265,639 265,629 Q265,618 258,609 L181,601 L181,201 Q181,77 140,0 Q99,-76 -4,-142 Q-22,-127 -29,-107 Q59,-40 92,23 Q125,87 125,184 Z"/></symbol>
  <symbol id="SomeID/1.j" overflow="visible"><path d="M100,134 L100,453 L19,453 Q16,461 16,467 Q16,476 22,486 L126,505 Q143,496 154,483 L154,151 Q154,27 113,-49 Q72,-126 -31,-192 Q-49,-179 -55,-158 Q35,-92 67,-30 Q100,31 100,134 Z M157,632 Q157,590 112,590 Q67,590 67,632 Q67,674 112,674 Q157,674 157,632 Z"/></symbol>
  <use xlink:href="#SomeID/1.J" x="0" y="0"/>
  <use xlink:href="#SomeID/1.j" x="296" y="0"/>
</svg>

If you do that, I’ll make the necessary changes to the Unicode text rendering test suite so it calls your tool for --engine=OpenType.js. Then, we’ll get test reports like this for free.

For the test cases with variable fonts, the test suite also passes an argument --variation=M1:0.2;wght:721.5. This means that axis M1 should be set to 0.2 and axis wght to 721.5. Since OpenType.js doesn’t yet implement variable fonts, you could just ignore the --variation argument for now.

1reaction
fdbcommented, Apr 25, 2017

I’ve added a bin/test-render script that creates the SVG file in the correct format.

I’ve also looked at integrating it into text-rendering-tests, and it shouldn’t be too hard. I’ll try to submit a PR tomorrow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unicode's test suite for text rendering engines - GitHub
Contribute to unicode-org/text-rendering-tests development by creating an account ... the tests are run using OpenType.js, another JavaScript font engine.
Read more >
opentype.js and maker.js rendering incorrect path for text
This one won't run on SO, but it works fine on the console on the website I am programming on. Here is the...
Read more >
JavaScript parser/writer for OpenType and TrueType fonts.
js is an OpenType and TrueType font parser and writer. It allows you to access the letterforms of text from the browser or...
Read more >
Text Rendering - LearnOpenGL
In the early days, rendering text involved selecting a font (or create one yourself) you'd like for your application and extracting all relevant...
Read more >
Techniques for Rendering Text with WebGL - CSS-Tricks
Drawing lines, debugging shaders, text rendering… they. ... Get Bezier curves from your .tff font file using OpenType.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found