gero3 / facetype.js Goto Github PK
View Code? Open in Web Editor NEWtypeface.js generator
Home Page: http://gero3.github.io/facetype.js/
License: MIT License
typeface.js generator
Home Page: http://gero3.github.io/facetype.js/
License: MIT License
occur on convert Microsoft Yahei UI
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.
download here. attempting to use inside of Three.js, but the zero's and O's produce infinite loops.
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.
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
Testable variable font: https://github.com/TypeNetwork/Roboto-Delta
.
ps: SourceHanSans fonts can‘t, SimHei fonts can be converted.
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?
Hi! Would love to talk to you about an AI project. Could you email me at [email protected]?
Hi, I converted tff font file to json file. But now, How I can convert it back to tff file?
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?
It would be extremely useful to be able to put multiple ranges into the character set input field.
e.g
1-123,432-456
Addtionally hexidecimal parsing support would be very useful
e.g
0xE000-0xE200
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:]))
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 "
I would like to be able restrict the glyphs
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.
There is an issue with B character, after conversion, B appears with down hole filled.
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?
For now, if someone has a font that rotates counterclockwise, then you need to manually choose to reverse the font direction. We should make that an automatic decision based on the paths of the font.
Examples of these are #1 and mrdoob/three.js#5943
I have been trying to convert the Quivira Regular font (http://www.quivira-font.com/) to JSON format with Facetype.js and am unable to get all characters converted. In particular, the Evergreen tree (🌲, 1F332) is not showing up. I have confirmed that the glyph is in the original font file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.