Comments (3)
I assume this is a one-pixel-wide error that you're blowing up with bilinear resampling hence the blurriness? In this sort of scenario (debugger/reporting bugs) you should generally resize with nearest-neighbor ("fat bits") so the actual pixels can be seen, without the bilerp blurring confusing things, or at least mention that this is what you're doing instead of saying that THIS is the actual output. Always, always think about what information the library maintainer has and needs to understand your problem. (If this is what text actually looks like in your application, you're using it wrong.)
Anyway, this is an expected difference between the old rasterizer and the new rasterizer if the font is not defined "correctly", that is in the way that TrueType fonts are traditionally defined (but not actually part of the spec).
Specifically, this is the behavior you would get if the T was defined as two separate overlapping rectangles; the pixels where they overlap will be "double darkened" in the new rasterizer, which doesn't affect the opaque pixels inside the shape, but does affect the AA edge pixels.
Traditional TrueType fonts define a single contiguous outer border, rather than overlapping shapes, as this allows things like classic-style "outline" text effects to be created by simply drawing the lines defining the shape. If my guess about what's going on here is correct, those effects would also not work correctly with that method. However, I'm not sure if there are any modern programs that do that that would demonstrate the effect.
I switched to the new rasterizer on the assumption that fonts that violated this rule were rare, which seems to be true since this is one of very few (or maybe the only) reports of this issue. So I believe this is working as intended, and switching to the old rasterizer is the appropriate solution if you need to use fonts that don't follow these rules and that produce objectionable one-pixel-wide artifacts. It literally cannot be fixed in the new rasterizer.
from stb.
I see, thanks for the thorough explanation.
from stb.
Just wanted to clarity that those pics arent from my application, but from the attached sample. And the attached sample simply rasterizes letter 'T' and then saves it as PNG. Which I then opened in the Windows Photos and zoomed. That where those pics came from.
Happy New Year!
from stb.
Related Issues (20)
- Signed integer overflow in `convert_channels_short_interleaved`
- Wild address read in stbi__gif_load_next (`GHSL-2023-145/CVE-2023-45661`)
- Multi-byte read heap buffer overflow in `stbi__vertical_flip` (`GHSL-2023-146/CVE-2023-45662`)
- Disclosure of uninitialized memory in `stbi__tga_load` (`GHSL-2023-147/CVE-2023-45663`)
- Double-free in `stbi__load_gif_main_outofmem` (`GHSL-2023-148/CVE-2023-45664`)
- Null pointer dereference in `stbi__convert_format` (`GHSL-2023-149`) HOT 1
- Possible double-free or memory leak in `stbi__load_gif_main` (`GHSL-2023-150/CVE-2023-45666`)
- Null pointer dereference because of an uninitialized variable (`GHSL-2023-151/CVE-2023-45667`)
- `0` byte write heap buffer overflow in `start_decoder` (`GHSL-2023-165/CVE-2023-45675`)
- (Docs Update Request) stb_image_write.h supports PNG/BMP/TGA/JPEG/HDR HOT 2
- Is the "DETAILED USAGE" section of `stb_truetype.h` correct/updated? HOT 3
- A way to reuse a buffer when reading `.gif` files HOT 2
- GCC warnings for the hmdel macro HOT 1
- stb_sprintf: not working with 'j' 'z' modifiers
- [text.txt](https://github.com/nothings/stb/files/13457062/text.txt)
- Segmentation fault when load an corruption pictures in stbi_load_from_memory HOT 2
- stb_image incorrectly sees png as 16bit. HOT 5
- Completion of error handling
- Request for CMakeLists.txt Integration for Improved Build System
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 stb.