Friday, 21 April 2017

JavaScript library, system fonts, and command line interface

I'm writing a JavaScript library which outputs SVG diagrams. To calculate layout of these diagrams the library requires font metrics to make diagram shapes fit text in them.

I want this library to be usable in both web pages and command line for batch rendering.

In the browser, fonts are available and I can get text metrics via Canvas API. It works fine.

In the command line, there are system fonts and stuff like QFontMetric. I can use Qt Script to run the library. It is also quite easy to integrate PDF and PNG exports. But that would mean to write wrapper in Qt.

The question: Does Node.js have a support to access system fonts and get their metric? Or is there a better way to implement such CLI tool based on JS library?



via Josef Kufner

No comments:

Post a Comment