GithubHelp home page GithubHelp logo

gero3 / facetype.js Goto Github PK

View Code? Open in Web Editor NEW
630.0 630.0 118.0 84 KB

typeface.js generator

Home Page: http://gero3.github.io/facetype.js/

License: MIT License

CSS 53.90% HTML 16.32% JavaScript 29.77%

facetype.js's People

Contributors

andrewraycode avatar felthy avatar gero3 avatar mikaelgramont avatar shuaibird avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facetype.js's Issues

error when loading helvetiker_regular after adding new symbol

hello, I am trying to add a missing symbol to the helvetiker_regular font used in three.js. I didn't found the original ttf file anywhere, neither by looking as "helvetiker" in google.. so I assumed it was "helvetika" but after using that font in facetype website, the three.js fails loading, with different internal errors if I try with reverse order or not.

Handle variable fonts

Currently when testing a variable font, the variable headers and instance tables are attributing unknownN as the key name. Variable fonts and their respective variable settings are not usable as a result.

The variable headings are in the font's Naming table (name), but show up as numbers - which are translating them into UnknownN values.

screen shot 2019-02-28 at 10 40 58 am

Currently the fonts fvar table is being dropped: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fvar.html

Ideally the fvar table should appear as a font object key.

Per: https://opentype.js.org/font-inspector.html
screen shot 2019-02-28 at 10 48 06 am

Testable variable font: https://github.com/TypeNetwork/Roboto-Delta

Is this library still maintained?

I just tried to convert "Bravura" (and OSS SmuFL), but I get an error message: "Unsupported OpenType version".

Since the last commit for this library was 5 years ago, I wonder, if there is still active maintenance?

Conversion not working

I am trying to convert few fonts (.ttf) into typeface.json. When I hit convert nothing happens. I have tested it in all browser and even downloaded the standalone from github. Any help?

Consecutive move commands in generated shapes

For SF Cartoonist Sans Bold (https://www.fontsquirrel.com/fonts/sf-cartoonist-hand) we noticed that consecutive move commands were generated in some shapes; this happens for many accented letters for this font. For example, for ä, the following commands are generated:

"m 3 0 m 540  38 q 463 -14 496 -14 q 424 31 440 -14 q 250 -23 340 -23 q 65 65 134 -23  q 3 267 3 146 q 97 484 3 390 q 315 578 191 578 q 419 559 370 578 q 471  586 439 586 q 538 465 538 586 q 534 314 538 414 q 530 163 530 214 q 540  38 530 100 m 407 410 q 363 431 408 410 q 313 442 335 442 q 192 386 243  442 q 140 259 140 330 q 166 163 140 203 q 247 115 195 115 q 404 189 328  115 q 407 410 407 262 m 553 764 q 529 701 553 728 q 468 673 504 673 q  420 697 441 673 q 399 749 399 722 q 421 810 399 785 q 479 834 442 834 q  531 813 508 834 q 553 764 553 792 m 334 746 q 306 687 334 709 q 239 666  278 666 q 193 686 213 666 q 172 732 172 705 q 203 799 172 766 q 267 831  234 831 q 334 746 334 831 z "

The main problem (for us) is that three.js crashes when trying to process this (see discussion in mrdoob/three.js#14929). So it would be helpful if facetype could not issue consecutive move commands. (three.js will probably have the same problem with a trailing move command.)

I don't know enough about font files, but it could well be that the font file already has this problem. So this would be a post-processing step.

In any case, if anyone else has this problem, here's a simple Python script to postprocess the generated .json file:

#!/usr/bin/python3

import collections
import json
import sys


def process(filename):
    with open(filename, "rb") as f:
        data = json.JSONDecoder(object_pairs_hook=collections.OrderedDict).decode(f.read().decode('utf-8'))

    for ch, glyph in data['glyphs'].items():
        old = glyph['o']
        o = old.split(' ')
        i = 0
        cnt = 0
        while i < len(o):
            if o[i] == 'm' and i + 3 < len(o):
                if o[i + 3] == 'm':
                    del o[i:i+3]
                    cnt += 1
                    continue
            i += 1
        new = ' '.join(o)
        glyph['o'] = new
        if old != new:
            print('{0} {1}: {2} reduction(s)'.format(filename, ch, cnt))

    with open(filename, "wb") as f:
        f.write(json.dumps(data, separators=(',', ':'), ensure_ascii=False, indent=None).encode('utf-8'))


def main(program_name, args):
    if not args:
        print("Synax: {0} <font name>...".format(program_name))
        return -1
    for font in args:
        try:
            process(font)
        except Exception as e:
            print("Error while processing {1}: {0}".format(e, font))
            return -2
    return 0


sys.exit(main(sys.argv[0], sys.argv[1:]))

Invalid icon conversion "coffee" from Material Design

When converting material design font, we have noticed that icon "F176" coffee cup is not converted correctly. But at the same time "F177" coffee with arrow is displayed fine

Got:
"m 117 0 l 1158 0 l 1158 117 l 117 117 l 117 0 m 1158 751 l 1042 751 l 1042 925 l 1158 925 l 1158 751 m 1158 1042 l 231 1042 l 231 464 q 298 298 233 363 q 464 231 363 233 l 811 231 q 974 298 909 233 q 1042 464 1039 363 l 1042 637 l 1158 637 q 1240 670 1207 637 q 1272 751 1272 703 l 1272 925 q 1240 1009 1272 977 q 1158 1042 1207 1042 z "

Should be:
"m 117 0 l 117 117 l 1158 117 l 1158 0 l 117 0 m 985 751 l 985 925 l 868 925 l 868 751 l 985 751 m 985 1042 q 1066 1008 1034 1042 q 1099 925 1099 974 l 1099 751 q 1066 670 1099 703 q 985 637 1034 637 l 868 637 l 868 578 q 800 415 865 480 q 637 347 735 350 l 404 347 q 241 415 307 350 q 174 578 176 480 l 174 1042 l 985 1042 z "

FontLoader Error

Hey! I'm trying to load the typeface.json file using three.js/FontLoader, this json file is converted from a .tff file by http://gero3.github.io/facetype.js/, now I caught an error: "Uncaught SyntaxError: Unexpected token < in JSON at position 0". This means the json file is damaged, i tried several times and i got the same error.

OTF fonts doesn't work with three.js

Hi!
I have some fonts that does not work with three.js. I got this error:

TypeError: Cannot read property 'length' of null
    at Object.THREE.Shape.Utils.triangulateShape (three.min.js:666)
    at THREE.ExtrudeGeometry.addShape (three.min.js:722)
    at THREE.ExtrudeGeometry.addShapeList (three.min.js:717)
    at THREE.ExtrudeGeometry (three.min.js:716)
    at new THREE.TextGeometry (three.min.js:

The ttf files works correclty, the oft not.

Any advice?

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.