akrinke / font-stash Goto Github PK
View Code? Open in Web Editor NEWA dynamic font glyph cache for OpenGL.
A dynamic font glyph cache for OpenGL.
Hi,
I'm looking to use bitmap support in fontstash, however the example in the main.c file looks quite primitive.
I used the AngelCode creator to generate the .fnt file with associated .tga. Can fontstash load that .fnt file and set up the bitmap font automatically without having to write my own surface code and adding each glyph individually? If so, is there an example somewhere?
Thanks!
Hi,
One of our developers found a possible memory leak, caught when doing integration tests. Attached is the diff (viewable here: http://code.google.com/p/bitfighter/source/diff?spec=svn4604e38f9ee3b26453e306e2bf43c32d5ee52f13&r=4604e38f9ee3b26453e306e2bf43c32d5ee52f13&format=side&path=/fontstash/fontstash.c)
diff -r 775e2f415e84 -r 4604e38f9ee3 fontstash/fontstash.c
--- a/fontstash/fontstash.c Wed Nov 13 08:06:17 2013 -0600
+++ b/fontstash/fontstash.c Wed Nov 13 12:48:27 2013 -0600
@@ -196,6 +196,8 @@
free(stash);
if (texture != NULL)
free(texture);
+ if (empty_data != NULL)
+ free(empty_data);
return NULL;
}
Hi,
I am curious if you happen to have plans with merging your enhancements with the original fontstash, now found here:
https://github.com/memononen/fontstash
There has since been some major API changes to allow for different rendering backends so I suspect the merging work would be non-trivial.
Thanks!
Also, adding the header files to my project and #including them yield all sorts of linker errors (e.g. the sample code you have in the readme), which is why I tried the Makefile. I thought I could just drop in the header files and include them and things would go cozy, not the case it seems.
Am I missing something?
Not exactly an issue, more a question: is there any way to specify right justification for text when using sth_draw_text(), i.e. so that the x argument would be interpreted as where the text should end, not begin?
Thanks!
Upon losing an OpenGL context with a resolution change in our game, we need to reinitialize the font stashes. However when switching to full screen mode and back to windowed mode, most letters show OK save a few that seem to have artifacts. Here is a screenshot after switching the resolution back and forth:
Note the artifacts on several letters displayed throughout, especially the white text at the top.
After some research, I found this solution to a similar problem:
http://stackoverflow.com/questions/1191093/im-seeing-artifacts-when-i-attempt-to-rotate-an-image/1191281#1191281
However after adding the suggested OpenGL calls to various parts within my application and within fontstash.c, the problem is still there.
Could this just be related to my hardware? (I'm running on an NVidia NVS 3100M chip)
Here is how we're using Font-Stash in our application (we initialize with FontManager::initialize()):
https://code.google.com/p/bitfighter/source/browse/zap/FontManager.cpp
Thanks for a great library!
commit 64e083f breaks GLES compatibility. I think GL_QUADS is unavailable in GLES, you need to use GL_TRIANGLE_FAN or GL_TRIANGLES depending on the call.
When I use sth_dim_text to calculate the width of a string, I get surprising results. I would expect the following two strings to be the same length:
"LLLLL " and "LLL LL".
However, it appears that strings with terminal spaces are reported to be shorter than expected. I have confirmed that in both cases the function iterates properly over all characters in the string, and is selecting what seem to be the proper glyphs. However the length of those glyphs seems to not be consistently calculated.
I have tried this with several TTF fonts, including the venerable OCRA. Is it possible this is somehow related to TTF hinting? Or is it a problem with Font-Stash?
Or at least a batch file to compile.
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.