Git Product home page Git Product logo

Comments (6)

nicklockwood avatar nicklockwood commented on July 17, 2024

Yes. It turns out that sizeWithFont rounds up to the nearest whole point, which makes the calculations totally wrong when I'm drawing everything character-by-character (it wasn't an issue previously when I was drawing a whole line of text at a time).

If you aren't using the characterSpacing feature you'd be better off using the previous stable version of FXLabel instead of the current beta version, but I'd be interested to know what warnings you are seeing?

from fxlabel.

EranBoudjnah avatar EranBoudjnah commented on July 17, 2024

Super fast response! I was getting countless warnings because context was not yet initialized (sorry, now that I modified the class I'm no longer getting them so can't quote them). Keep in mind you are actually drawing the text twice, which also affects quality around the edges, I'd imagine.

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

I'm not drawing it twice because the text drawing mode is set to kCGTextInvisible prior to drawing, but yes it is certainly non-optimal, hence the beta status.

from fxlabel.

EranBoudjnah avatar EranBoudjnah commented on July 17, 2024

Cool, hope I pointed out something worth considering. Maybe even consider using a font ten times larger to achieve the precision you require? Just from the top of my head. Would require benchmarking etc...

from fxlabel.

nicklockwood avatar nicklockwood commented on July 17, 2024

I've just updated with a fix that works by creating a new context specifically for doing the sizing logic. Can you check if the new version fixes the errors you were seeing?

from fxlabel.

EranBoudjnah avatar EranBoudjnah commented on July 17, 2024

Wonderful. No warnings now :) Thanks!

from fxlabel.

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.