Git Product home page Git Product logo

node-freetype2's Introduction

Node FreeType

NPM version Build Status

FreeType bindings for Node.js.

FreeType is a freely available software library to render fonts. http://www.freetype.org/

Install

npm install freetype2

Usage

var fs = require('fs'),
    ft = require('freetype2');

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

The module exposes the following functions from FreeType:

ft.New_Memory_Face(buffer, face_index, aface);
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.Set_Pixel_Sizes(face, pixel_width, pixel_height);
ft.Load_Glyph(face, glyph_index, load_flags);
ft.Load_Char(face, char_code, load_flags);
ft.Set_Transform(face, matrix, delta);
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_Charmap_Index(face);
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.

To do


Originally built for https://github.com/ericfreese/font-viewer.

node-freetype2's People

Contributors

aminya avatar ericfreese avatar igorklopov avatar mattdesl avatar protryon avatar romgrk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.