Git Product home page Git Product logo

ttf.js's Introduction

ttf.js

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

Demo

ttf.js Demo - Glyph List

ttf.js Demo - Glyph List

Development Status

work in progress...

Implementation status of TrueType Tables

sfnt header

sfnt versionImplemented
numTablesImplemented
searchRangeImplemented
entrySelectorImplemented
rangeShiftImplemented

Table Directory

Table DirectoryImplemented

Required Tables

cmapPart Implemented
glyfAlmost
headAlmost
hhea-
hmtx-
locaAlmost
maxpAlmost
name-
post-
OS/2-

Optional Tables

cvt-
EBDT-
EBLC-
EBSC-
fpgm-
gasp-
hdmx-
kern-
LTSH-
prep-
PCLT-
VDMX-
vhea-
vmtx-

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

ttf.js's People

Contributors

ynakajima avatar allenm avatar cookiengineer avatar

Stargazers

 avatar Guanwei Liu avatar Sogrey avatar  avatar Sebastian Schlatow avatar lisper avatar Black Jack avatar  avatar Carson avatar wanma avatar  avatar 一个不知名の睡觉高手 avatar huggy avatar Liu Wenyuan avatar 卜卜口 avatar Han Lee avatar Zhang Zhipeng avatar qiutian00 avatar flying0917 avatar Leon Zhu avatar caoz avatar  avatar  avatar winbin avatar zmmz avatar dongge avatar Kaloyan Ivanov avatar Koji Arai avatar 任羽飞 avatar  avatar Jun avatar Acampbell avatar Kane avatar Mario Loncarek avatar e-lab innovations avatar joy joe avatar  avatar Double Han avatar Fools avatar Lex Lim avatar Cat  avatar  avatar Sun HaoWei avatar Xheowan avatar 程方 avatar Noel Koutlis avatar  avatar YinLu avatar Jack avatar Oğuz Çelikdemir avatar Robert Janes avatar waiting avatar Bill Bai avatar Tufan Demir avatar  avatar Paul Philippov avatar Michal Hotovec avatar Abe avatar Commy avatar Olga Pudrovska avatar Fabrizio Tofanelli avatar Carsten Ganske avatar MacTaylor avatar  avatar Ivo Yankulovski avatar Jaehoon You avatar Eunbin Jeong avatar Narazaka avatar Colin avatar KAI avatar Shun Hosaka avatar Gerbert Olivé Vázquez avatar Poyu Chen avatar DaShun avatar Jonas Nyström avatar Jiří Matoušek avatar T. Nishino avatar  avatar don bright avatar  avatar  avatar lichin-lin avatar  avatar Yuki Akiyama avatar Kengo Nakajima avatar Olli-Pekka Heinisuo avatar  avatar Alex.o0 avatar simon bin wang avatar  avatar  avatar Micah Rich avatar Jeremy Sarda avatar  avatar Blake Bowen avatar kawac avatar Dmitry Iv. avatar 子龙 avatar Francisco Aranda avatar Emilian avatar

Watchers

Martin A. Jackson avatar 古西风 avatar  avatar Maxim Zaslavsky avatar h3nr7 avatar evandrix avatar Saleh Souzanchi avatar Martin Púčala avatar Dave Crossland avatar Alfredo Llanos avatar roadlabs avatar Christian Hochfilzer avatar Paolo Mazzetti avatar Koji Anzai avatar  avatar Alex Rosario avatar Lole Román avatar  avatar Simon Lindsay avatar vizo avatar  avatar timelyportfolio avatar Ryusei Yamaguchi avatar  avatar Hayaki Saito avatar Tsotne Nazarashvili avatar Michael Anthony avatar mkondo avatar boldoo avatar Pablo Impallari avatar Noel Koutlis avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar Elias Zolotas avatar  avatar

ttf.js's Issues

[SimpleGlyph] If the first point of the Contour isn't on a curve, the drawing is lost.

Quivira.ttf -> GID: 0
[ { x: 555, y: 205, on: 0 },
{ x: 510, y: 184, on: 0 },
{ x: 474, y: 137, on: 0 },
{ x: 467, y: 110, on: 1 },
{ x: 463, y: 96, on: 0 },
{ x: 463, y: 83, on: 1 },
{ x: 463, y: 71, on: 0 },
{ x: 467, y: 60, on: 1 },
{ x: 473, y: 36, on: 0 },
{ x: 508, y: 15, on: 0 },
{ x: 529, y: 15, on: 1 },
{ x: 549, y: 15, on: 0 },
{ x: 594, y: 36, on: 0 },
{ x: 630, y: 83, on: 0 },
{ x: 637, y: 110, on: 1 },
{ x: 641, y: 124, on: 0 },
{ x: 641, y: 137, on: 1 },
{ x: 641, y: 149, on: 0 },
{ x: 638, y: 161, on: 1 },
{ x: 631, y: 184, on: 0 },
{ x: 597, y: 205, on: 0 },
{ x: 576, y: 205, on: 1 } ]

Will OTF file work?

At first, thank you for sharing this and it help me to finish the project. On the one hand, it works on almost TTF files. On the other hand, it couldn't parse OTF files. However, OTF files are more popular than other Font files in these days. Hence, I probably do otf.js which might fork from ttf.js which you've done.

But... I don't know how to start because I have no idea at the first step. Could you please tip me how to start if you available? I will extremely appreciate that. :)

ttf format error

/src/ttf.js:239
            throw 'Not support cmap format'+format+' yet! Please submit an iss
                                            ^

Fonts with missing or invalid property values will not be parsed.

An edge case error really, but the ability to open webfonts could be quite handy.

Error: RangeError: argument 1 accesses an index that is out of range
Source File: http://ynakajima.github.com/ttf.js/vendor/jdataview.js
Line: 126

Example files (edited Ostrich Regular fonts):
http://duckduckgo.gr/ttfjs_test_fonts/Ostrich_Regular.ttf [original open source font]
http://duckduckgo.gr/ttfjs_test_fonts/Ostrich_blank_properties.ttf
http://duckduckgo.gr/ttfjs_test_fonts/Ostrich_invalid_properties.ttf
http://duckduckgo.gr/ttfjs_test_fonts/ostrich_protected_squirrel.ttf [webfont made with fontsquirrel generator]

TTFEdit [http://ttfedit.sourceforge.net/] will open the same files properly. No ttf parser that I know of can open such malformed files.

ostrich_protected_squirrel.ttf:
screenshot

Maybe if there was an option to pre-populate or use custom values for any properties of the font would fix this issue?

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.