maltaisn / msdf-gdx-gen Goto Github PK
View Code? Open in Web Editor NEWUtility for generating BMFont files for msdf-gdx
License: Apache License 2.0
Utility for generating BMFont files for msdf-gdx
License: Apache License 2.0
I'm not sure why this is, but on both TTF files I've run on so far, the char with id 32 (' '
) does not appear in the generated font, regardless of whether I load the list of chars from a file or use an existing name like ascii
. I can manually add space, but I don't know if I have the x-advance right and I don't know if kerning should be different with a space. Here are two fonts generated with msdf-gdx-gen and unaltered since; neither has a char with id=32 (space).
Iosevka-Slab.zip
Generated with: java.exe -jar msdfgen.jar -t mtsdf -d 1024 1024 -s 16 -p 5 -c Iosevka-Slab.txt Iosevka-Slab.ttf
YanoneKaffeesatz.zip
Generated with: java.exe -jar msdfgen.jar -t mtsdf -d 1024 1024 -s 60 -p 5 -c YanoneKaffeesatz-Regular.txt YanoneKaffeesatz-Regular.ttf
If you want, I can try to submit a PR, but like I said, I'm not sure why this happens.
As described in https://libgdx.com/wiki/file-handling
public class MsdfShader extends ShaderProgram {
public MsdfShader() {
super(Gdx.files.classpath("font.vert"), Gdx.files.classpath("font.frag"));
is not supported at runtime in GWT.
My GWT project compiles fine, but running in the browser it fails with above message.
I believe this is due to the code trying to parse it as a list of Ints, but the library used to handle parameters says only lists of Strings are supported due to Java limitations:
https://jcommander.org/#_fixed_arities
Also, note that only List is allowed for parameters that define an arity. You will have to convert these values yourself if the parameters you need are of type Integer or other (this limitation is due to Java’s erasure).
I'm trying to convert a very large charset (17144 characters) with this tool. Note that I've gave 8GB already to JVM, but it still lacks memory and fails on 40% of progress.
java -Xmx8g -jar msdfgen.jar -g ./msdfgen -o output -s 16 -r 4 -c cp949.txt NotoSansCJKkr-Bold.otf
Can this memory problem be fixed? Thanks.
I've noticed that using roboto-regular the glyph placing is a bit odd.
This is a sample render using the shader from msdf-gen and the texture has been generated with this utility.
As you can see the B
is placed a bit too high as well as the l
and the L
. The D
also looks a bit off.
The issues persists when scaling the font to any size, so my guess is that the font generation messes something up?
Running the generator with extended charset ran into a null pointer exception.
Exception in thread "main" java.lang.NullPointerException
at java.base/java.util.TreeMap.rotateLeft(TreeMap.java:2221)
at java.base/java.util.TreeMap.fixAfterInsertion(TreeMap.java:2288)
at java.base/java.util.TreeMap.put(TreeMap.java:580)
at com.maltaisn.msdfgdx.gen.BMFont$generateGlyphs$1$1.invokeSuspend(BMFont.kt:95)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:1738)
This is most likely caused by concurrent modification, as the operation is run in a concurrent context. Replacing the sorted map with a ConcurrentSkipListMap<Char,FontGlyph>()
solved the issue, but might need some more verification.
The line in question:
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.