Laerdal / opentype.hx

Cross platfrom Opentype support library for Haxe written in Haxe.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

opentype.hx

Cross platfrom Opentype support library for Haxe. The idea of Opentype.hx is to port of https://github.com/opentypejs/opentype.js and deliver a platform independent font library.

Current release is the initial Alpha release

Getting started

  1. Install the lib:

haxelib install opentype.hx

  1. Create a file called Main.hx:
import opentype.OpenType;
import opentype.Font;
import haxe.io.Bytes;

class Main {
    static function main() {
        var fontBytes : Bytes;
        OpenType.loadFromFile("path/to/truetype-font.ttf", (b) -> {
            fontBytes = b;
            var font : Font;
            font = OpenType.parse(fontBytes);
        }, (e) -> { trace(e); }
        );
    }
}
  1. Compile to eg. JavaScript for Nodejs by creating file build.hxml with the following content:
-lib opentype.hx
-lib hxnodejs
--js js/app.js
--main Main
  1. And build it with the commmand:
haxe build.hxml

About

Cross platfrom Opentype support library for Haxe written in Haxe.

License:MIT License


Languages

Language:Haxe 100.0%