SkillAgentSearch skills...

Ttf.js

JavaScript font library for Node.js and browser.

Install / Use

/learn @ynakajima/Ttf.js
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

ttf.js

A JavaScript TrueType font engine for modern browsers and Node.js.

Demo

<a href="http://ynakajima.github.com/ttf.js/demo/glyflist/index.html">ttf.js Demo - Glyph List</a>

<img src="http://ynakajima.github.com/ttf.js/images/demo_screen_thumb.png" alt="ttf.js Demo - Glyph List" />

Development Status

work in progress...

Implementation status of TrueType Tables

sfnt header

<table> <tbody> <tr><th>sfnt version</th><td>Implemented</td></tr> <tr><th>numTables</th><td>Implemented</td></tr> <tr><th>searchRange</th><td>Implemented</td></tr> <tr><th>entrySelector</th><td>Implemented</td></tr> <tr><th>rangeShift</th><td>Implemented</td></tr> </tbody> </table>

Table Directory

<table> <tbody> <tr><th>Table Directory</th><td>Implemented</td></tr> </tbody> </table>

Required Tables

<table> <tbody> <tr><th>cmap</th><td>Part Implemented</td></tr> <tr><th>glyf</th><td>Almost</td></tr> <tr><th>head</th><td>Almost</td></tr> <tr><th>hhea</th><td>-</td></tr> <tr><th>hmtx</th><td>-</td></tr> <tr><th>loca</th><td>Almost</td></tr> <tr><th>maxp</th><td>Almost</td></tr> <tr><th>name</th><td>-</td></tr> <tr><th>post</th><td>-</td></tr> <tr><th>OS/2</th><td>-</td></tr> </tbody> </table>

Optional Tables

<table> <tbody> <tr><th>cvt</th><td>-</td></tr> <tr><th>EBDT</th><td>-</td></tr> <tr><th>EBLC</th><td>-</td></tr> <tr><th>EBSC</th><td>-</td></tr> <tr><th>fpgm</th><td>-</td></tr> <tr><th>gasp</th><td>-</td></tr> <tr><th>hdmx</th><td>-</td></tr> <tr><th>kern</th><td>-</td></tr> <tr><th>LTSH</th><td>-</td></tr> <tr><th>prep</th><td>-</td></tr> <tr><th>PCLT</th><td>-</td></tr> <tr><th>VDMX</th><td>-</td></tr> <tr><th>vhea</th><td>-</td></tr> <tr><th>vmtx</th><td>-</td></tr> </tbody> </table>

API

  • ttf.cmap.getGlyphIndex(charactor)
    • Return glyph index array of the given charactor . The array's length equals to number of the font's cmap subtables.
    • The param charactor only accept a single charactor, if you use multiple charactors , only return the result of the first charactor.
    • This API is working in process , only support cmap format0 and part format4. You can try your font with this , if not support, contact me;

TrueType Specifications

  • <a target="_blank" href="http://www.microsoft.com/typography/SpecificationsOverview.mspx">Microsoft Typography - Features of TrueType and OpenType</a> (Microsoft)
  • <a target="_blank" href="https://developer.apple.com/fonts/TTRefMan/">TrueType Reference Manual</a> (Apple)
View on GitHub
GitHub Stars420
CategoryDevelopment
Updated16d ago
Forks60

Languages

JavaScript

Security Score

80/100

Audited on Mar 16, 2026

No findings