LTMorphingLabel icon indicating copy to clipboard operation
LTMorphingLabel copied to clipboard

Attributed Text Support

Open freshking opened this issue 9 years ago • 10 comments

I believe the current version doesn't support morphing for attributed text. Will this be a feature in the near future?

freshking avatar Jul 23 '15 10:07 freshking

It requires tons of tweaks. I hope I have enough time to do it.

lexrus avatar Jul 23 '15 13:07 lexrus

Here is the concept.

┌─────────────────────────────────────────────────────────────┐
│        self.attributedString = ...SOME_NEW_STRING...        │
└─────────────────────────────────────────────────────────────┘
                               │                               
               ┌───────────────┘                               
               ▼                   ┌──────────────────────────┐
┌─────────────────────────────┐ ┌─▶│ enumerate each character │
│ draw the string off screen  │─┘  └──────────────────────────┘
└─────────────────────────────┘                  │             
                               ┌─────────────────┘             
                               ▼                               
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃     return ([rectOfChar], [colorOfChar], [fontOfChar])      ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
                               │                               
                               ▼                               
┌─────────────────────────────────────────────────────────────┐
│     calculate the new tuple by current morphingProgress     │
└─────────────────────────────────────────────────────────────┘
                               │                               
                               ▼                               
┌─────────────────────────────────────────────────────────────┐
│    draw each character on screen between display blinks     │
└─────────────────────────────────────────────────────────────┘

lexrus avatar Jul 23 '15 13:07 lexrus

+100 for the effort! I tried approaching this but could not get it to work…

On Jul 23, 2015, at 4:27 PM, Lex Tang [email protected] wrote:

It requires tons of tweaks. I hope I have enough time to do it.

— Reply to this email directly or view it on GitHub.

jkritikos avatar Jul 23 '15 13:07 jkritikos

Oh :( I needed this feature too because I use attributed string :(

LivioGama avatar Mar 17 '16 16:03 LivioGama

Brilliant library!! That would be amazing if it supported Attributed String. @lexrus you wrote your last comment a year ago; is there any news for attributed string enhancement? In my case, the only reason I wanted to use attributed string is to be able to give 'character spacing'

sentiasa avatar May 06 '16 14:05 sentiasa

+1

36bydesign avatar Jul 07 '16 03:07 36bydesign

Any update on NSAttributedString or character spacing support?

rakeshtookan avatar Feb 21 '17 06:02 rakeshtookan

This is definitely more of a work around than a solution, but if you're trying to set character spacing you can play around with these whitespace characters and insert one between every character in your label when setting the text. I've found that thin space and punctuation space look nice, but you'll have to play around with a few to find one that fits your style guide best.

Not ideal, but it works ¯_(ツ)_/¯

elfanek avatar May 05 '18 02:05 elfanek

+1

tkirby avatar Nov 23 '18 06:11 tkirby

i want to

holla-lishuangcheng avatar Sep 22 '22 03:09 holla-lishuangcheng