Skip to content

Conversation

@itslenny
Copy link

@itslenny itslenny commented Sep 28, 2020

Hi, this should maybe be an "issue" but I needed a fix right away for my own uses so this is my little hack fix. Hoping this can open a discussion. Obviously, I don't expect this to PR to be merged as-is.

In my app I'm using glyph fonts to represent numbers. There are several labels some with words and some with numbers. Two labels display a score to the user which needs to be modified at runtime. In our AE file we include numbers 0-9 to enable the use of glyph fonts for this, but for some reason when the text delegate is used glyph fonts are disabled... why?

Simply adding the text delegates causes all glyphs in the entire animation to break...

delegates: LottieDelegates(
          text: (text) => text
)

This simple PR just re-enables it and adds delegate support to the text_layer code. Works perfectly.

Why were glyph fonts disabled when text delegate is used? How can this be changed to provide the user the option to use font text of glyph font (regardless of if the delegate is used)?

For now we're using this forked version to un-break our app, but I'd love to switch back to your package.

@xvrh
Copy link
Owner

xvrh commented Oct 12, 2020

Hi @itslenny,
Thank you for the PR.

This package is a pure translation of the Lottie-android project and that condition seems to exist in the original library: https://github.com/airbnb/lottie-android/blob/master/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java#L896

So, to be honest, I don't known why glyph font are disabled when there is a delegate.

If you think it doesn't have side effects. I'm totally ok to remove the check and merge your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants