Parsing on node.js, rendering in browser
See original GitHub issueExpected Behavior
Feature request / help needed: we’d like to parse fonts on the server side (Node.JS) and only render the parsed font in the client (Browser).
Current Behavior
The server part is a REST api endpoint which returns a JSON object containing all font information - basically the result of the opentype.js font instance. This enables us to do validation (font support) and caching the results of each parsed font. Output looks like this:
{
"supported": true,
"glyphs": {
"glyphs": {
"0": {
"index": 0,
"name": ".notdef",
"unicodes": [],
"advanceWidth": 748,
"leftSideBearing": 67
},
...
},
...
},
...
}
Goal: using the returned object in the client so we can skip parsing an ArrayBuffer
on the client - to improve performance and reducing file size on the client.
Possible Solution
Idea: to create an opentype.js
instance in the client with an object as source.
Other ideas to get this working would be greatly appreciated.
Your Environment
- Version used: 0.10.0
- Font used: all
- Browser Name and version: Chrome
- Operating System and version (desktop or mobile): All
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Web Scraping and Parsing HTML in Node.js with jsdom - Twilio
With Node.js tools like jsdom, you can scrape and parse this data directly ... first take a look at the HTML that's rendered...
Read more >The Ultimate Guide to Web Scraping with Node.js
So what's web scraping anyway? It involves automating away the laborious task of collecting information from websites.
Read more >Parsing HTML in Node.js with Cheerio - LogRocket Blog
Manipulating and rendering markup with Cheerio is incredibly fast because it works with a concise and simple markup (similar to jQuery). And ...
Read more >Web Scraping With NodeJS and Javascript - ScrapFly
In this tutorial, we'll learn web scraping with NodeJS and Javascript. We'll cover an in-depth look at HTTP connections, HTML parsing, ...
Read more >HTML, CSS Parsing and Web Page Rendering Process in ...
After fetching HTML from the server, the browser starts parsing it and creating DOM, This process itself is divided into many further steps...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since we’re doing custom rendering on the client, we’ve used opentype to parse the font on the server side, returning a plain object that’s consumed on the client (were we don’t use opentype).
This class allows us to parse a font using opentype as a plain object (pseudo code)
This object can be used on the client as you wish, assuming you don’t want to import the entire library there.
Great! Thanks 😉