Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro Character spacing for languages with auxillary characters above/below

Discussion in 'UGUI & TextMesh Pro' started by 5argon, Jan 8, 2019.

  1. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    I don't know what these characters are called in English, but when typing it, it would place the character above or below the current character. Making it a modifier of sorts. It is like you have an individual ` to type and you can add it to A producing À.

    It works fine after importing those characters from a font. However character spacing are applied to them individually making them looked wrong. Could you add some special cases for these characters to use the spacing of it's attached character instead so it goes together? Or a boolean flag manually settable per character so I can go set it for each of such characters. Thank you.

    (If you would like that text : คะแนนคู่แข่ง each individual modifier characters : ่ ู)

    Screenshot 2019-01-08 12.18.55.png
    Screenshot 2019-01-08 12.19.04.png

    This is one more case, with similar reasoning : ทำ

    That word consist of only 2 characters, since ำ is just one keystroke. The attachment goes both on top and the right of the main character this time.

    The current character spacing would separate ำ from ท making it looked weird. The correct character spacing for this character would be again, never separate it from the attached character. In other programs it works like this, which I hope TMP can handle in the same manner :

    adl.gif
     

    Attached Files:

    Last edited: Jan 8, 2019
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for the detailed post / examples.

    These are called Diacritical Marks and are not properly supported yet in TMP. Support for these is part of the larger support for OpenType font features which is planned.

    In terms of their current behavior when using "Character Spacing", let me see what I can do here.

    Update
    I just had a chance to look into this and this is definitely a case where the OpenType support will be needed for proper handling.

    Here is a description of what should be happening and why this is currently an issue with Character Spacing.

    Let's use "ทำ" for our example. As you pointed out, this word is made up of "ท" + " ํ" and "า". So in theory 3 distinct glyphs.

    upload_2019-1-8_16-25-40.png

    However, instead of these 3 distinct glyphs, we get ท + ำ which is now 2 glyphs which properly positioned appears fine but not so much when adding Character Spacing.

    In the OpenType features this 2nd glyph is decomposed whereby ำ or \u0E33 is decomposed into \u0E4D + \u0E32 where another feature (mark to base) positions the u0E4D over the first glyph.

    Unfortunately, I don't have a solution to handle this correctly today. This case will most certainly be handled correctly with the support for OpenType features. However, let me think / see if I can't come up with some alternative solution until then. I'll reply to this thread when I have more information.
     
    Last edited: Jan 9, 2019
    5argon likes this.
  3. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Upon reflection, since by default we already end up with two glyphs \u0E17 and \u0E33 as seen below.

    upload_2019-1-8_17-3-33.png

    For which a kerning pair should be defined to adjust their positioning, kind of as you suggested, I could add a flag on kerning pairs that would define whether or not Character Spacing will affect their positioning. This might be a workable short term solution.

    I need to think a bit more about this and will reply when I have more information.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Did a quick implementation test ...



    In the animated gif above, I am changing the Character Spacing in the editor. The first word is made up of 3 glyphs and the 2nd made up of two.

    As I described in my previous post, I added a new property called ignoreCharacterSpacing that can be set on individual kerning pairs. This results in Character Spacing being ignore on those pairs.

    This will require I update the Kerning Pair Editor / Inspector to expose this new property but I should be able to sneak that into the next release of the TMP package.
     
    Last edited: Jan 9, 2019
    5argon likes this.
  5. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Thank you!! This will do!