Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JS: How to determine if font have glyph for character?

Tags:

javascript

How to determine if font have glyph for character?

Is this even possible?

var a = glyph_exist('0x00A1')
console.log(a)

true or false
like image 458
J. Doe Avatar asked Aug 31 '25 22:08

J. Doe


1 Answers

Fontkit appears to support this use case:

Fontkit is an advanced font engine for Node and the browser, used by PDFKit. It supports many font formats, advanced glyph substitution and layout features, glyph path extraction, color emoji glyphs, font subsetting, and more.

[...]

font.hasGlyphForCodePoint(codePoint)

Returns whether there is glyph in the font for the given unicode code point.

like image 146
TimoStaudinger Avatar answered Sep 03 '25 13:09

TimoStaudinger