FreeType bindings for Node.js.

Node FreeType

FreeType bindings for Node.js.

FreeType is a freely available software library to render fonts.

npm install freetype2

var fs = require('fs'),
    ft = require('freetype2');
fs.readFile('/path/to/a/font.woff', function(errbuffer) {
  if (!!err) throw err;
  var face = ft.New_Memory_Face(buffer, 0);

The module exposes the following functions from FreeType:

ft.New_Memory_Face(buffer, face_index)
ft.Select_Size(face, strike_index)
ft.Request_Size(face, type, width, height, horiResolution, vertResolution)
ft.Set_Char_Size(face, char_width, char_height, horz_resolution, vert_resolution)
ft.Load_Glyph(face, glyph_index, load_flags)
ft.Load_Char(face, char_code, load_flags)
ft.Render_Glyph(slot, render_mode)
ft.Get_Kerning(face, left_glyph, right_glyph, kern_mode, akerning)
ft.Select_Charmap(face, encoding)
ft.Set_Charmap(face, charmap_index)
ft.Get_Char_Index(face, charcode)
ft.Get_First_Char(face, agindex)
ft.Get_Next_Char(face, char_code, agindex)

See FreeType documentation for more info.

  • Error checking. Return int error code as needed.
  • Glyph outline processing:
  • Implement following methods:
    • ft.Set_Pixel_Sizes
    • ft.Set_Transform
    • ft.Get_Track_Kerning
    • ft.Get_Glyph_Name
    • ft.Get_Postscript_Name
    • ft.Get_Name_Index
    • ft.Get_SubGlyph_Info

Originally built for