Comments (5)
Hi maxstepin.
This is a problem I have known of pretty much from the start. It's not really a bug, and more a limitation of the underlying algorithm. These rows of not-quite-black pixels are the result of a combination of quantization errors and general numerical instability.
It is very likely that you can find the same behaviour with other font renderers that use a similiar algorithm such as stb_truetype.
Is this only an annoyance to you, or does this actually pose a potential problem?
from libschrift.
Yeah, it's not really a problem.
Thanks!
from libschrift.
I tried switching to floating point here:
struct cell { double area, cover; };
and invoke quantize() at the last possible moment in post_process()
and artifacts seems to disappear completely.
Just thought you might consider it.
I looked into stb_truetype and they also seems to be doing float->int conversion at the last possible moment.
from libschrift.
Hi maxstepin,
So I just tested this for myself. And you're right, the background is now completely black!
I would've thought the error caused by numerical instability would be much greater.
Actually, last time I measured it it was in fact bigger than the quantization error!
But since then, the algorithm has been changed dramatically, so I really should have updated my measurements.
I was a bit worried about the performance implications, but apparently this is pretty much exactly as fast as before. This is pretty shocking, considering we're now reading and writing 4x the amount of data to the buffer! Just in the last major version release, I got a 15% speedup overall by reducing the data size of the outline struct - I would have expected a comparable slowdown here. I guess draw_lines
and post_process
just aren't that memory-bound in the first place. Oh well, at least this turns out to be an easy fix now!
I'll probably put this in the next minor version (v7.1).
Thanks!
SideNote: I also tested this with float instead of double, but the slowdown from double-to-float conversion makes this much slower, so it's currently not worth it.
from libschrift.
You might simplify quantize() now, considering it's only used in one place, and in that place (x >= 0.0) condition is always true.
from libschrift.
Related Issues (20)
- Darwin compilation HOT 8
- Tutorial for OpenGL? HOT 4
- support anti-aliasing? HOT 7
- Add travis CI or any other CI HOT 1
- How Can I Compile For Windows? [Question] HOT 2
- Does libschrift support colored emojis? HOT 1
- Stack overflow in render_outline due to 256KB stack allocation HOT 3
- demos depend on graphics environment HOT 1
- draw_line function algorithm HOT 2
- Review usage of intenal csearch() function
- Whitespaces are not being rendered HOT 2
- typo in docs
- guard unix-y implementation details
- Empty rendering output under windows HOT 4
- Function that returns a list of all glyphs
- Sample code that just outputs the line points HOT 1
- Insufficiently wide char code on some platforms HOT 2
- C++ support HOT 2
- Support for RTL languages HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libschrift.