Comments (6)
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.
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.
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.
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.
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.
Wonderful. No warnings now :) Thanks!
from fxlabel.
Related Issues (20)
- Crash when text is long Chinese or long words HOT 5
- Crash in FXLabel_linesWithFont:constrainedToSize:lineBreakMode:lineSpacing:allowOrphans: HOT 2
- 'adjustsFontSizeToFitWidth' doesn't seem to work ... HOT 6
- Deprecations in iOS 7 HOT 6
- bug when gradientcolors + text insets HOT 3
- 1.5.3 FXLabel sometimes ignores the UILabel textColor property HOT 5
- 1.5.4 has infinite loop with iOS 7 only deployment target. HOT 1
- New Line Characters on arm64? HOT 2
- 'adjustsFontSizeToFitWidth' doesn't seem to work HOT 5
- if set lineSpacing, sizeThatFits not support chinese characters
- FXLabel Animate Font Size HOT 1
- size to fit fails with numberOfLines = 2 and lineSpacing != 1
- FXLabel does not support attributedStrings ? HOT 1
- Support for TV?
- Do you plan Swift version ?
- Can you provide an effect chart in README.md?
- Update cocoa pods? HOT 3
- Disabling orphans seems to have no effect HOT 1
- Have the glow/shaddow inherit the gradient HOT 2
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 fxlabel.