Giter VIP home page Giter VIP logo

Comments (3)

nothings avatar nothings commented on August 15, 2024

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.

rds1983 avatar rds1983 commented on August 15, 2024

I see, thanks for the thorough explanation.

from stb.

rds1983 avatar rds1983 commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.