Skip to content

TextLayers don't combine unicode combining characters #1396

@Adimote-work

Description

@Adimote-work

Checklist

  • 1. My animation doesn't use any unsupported features.
  • 2. I know what part of my animation doesn't work.
  • 3. I have created a simplified version of my animation
  • 4. I have attached the AEP file - You can use this one from a similar bug. I think the json file is invalid so you'll need to re-export and set the FontAssetDelegate to something which returns Typeface.DEFAULT.

Describe the bug
Text which uses unicode combining characters (notably Hindi) is rendered character-by-character, ignoring the need for combining characters to be rendered as one.

Combining characters (i.e. diacritics) are unicode characters representing a modification to a previous character. For example: '​း' is a diacritic which can be added to 'ဆီ' to make 'ဆီး'.

In Lottie android it's rendered as 'ဆီ​း' (the circle denotes a missing previous character for the diacritic) which is invalid Hindi.

I believe this is caused by the text being split into individual characters, then canvas.drawText() is called on each individual character, ignoring the need for combining characters to remain with their preceding characters.

It seems Lottie for web had a similar issue: airbnb/lottie-web#1603 but their fix just handled the hindi characters, it's probably best to support all combining characters.

What version of Lottie did you test this on?

3.0.1 (but this is still an issue at head)

What version of Android did you test this on?

Q and P

Steps To Reproduce
Steps to reproduce the behavior:

  1. Render the animation (set the FontAssetDelegate to something which always returns Typeface.DEFAULT)
  2. See the error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions