Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

TextMesh Pro Pages Feature with Vertical Alignment

Discussion in 'UGUI & TextMesh Pro' started by Rocco_B, Jan 23, 2019.

  1. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    Running TMP v1.3.0 from the Package Manager.

    My current issue is that Page vertical alignment does not seem to work the same way that it is displayed in this video.

    In the video above when he changes from Top, Center and Bottom vertical alignment the text aligns properly. However attached are some images of what happens when I use Overflow set to Page and change the vertical alignment to any of the three options. They seem to all align by the first line for some reason making only Top alignment work correctly.

    I have also gone back and even tried using older packages and they all perform the same. I feel like I am just missing something obvious.

    Top Vertical Alignment (seems to work correctly)
    Screen Shot 2019-01-23 at 1.29.09 PM.png

    Center Vertical Alignment (centers based off the first line)
    Screen Shot 2019-01-23 at 1.29.17 PM.png

    Bottom Vertical Alignment (bottom aligns based off the first line)

    Screen Shot 2019-01-23 at 1.29.26 PM.png
    I threw in Baseline, Midline and Capline too just in case it helps someone figure out.

    Baseline Vertical Alignment
    Screen Shot 2019-01-23 at 1.29.36 PM.png
    Midline Vertical Alignment
    Screen Shot 2019-01-23 at 1.29.44 PM.png
     
  2. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    Threw the last one in here due to a 5 file upload limit.

    Capline Vertical Alignment

    Screen Shot 2019-01-23 at 1.29.53 PM.png
     
  3. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    Just wanted to bump this up. Hoping someone has tried to use this feature of TMP.
     
  4. MarcCelma

    MarcCelma

    Joined:
    Feb 4, 2019
    Posts:
    2
    Bumping. I'm having the same issue. I don't understand why alignment in page mode takes only the first line of the page into consideration, and not the whole page's text, like in the video.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    It appears that I missed @Rocco_B initial posts on this topic. My apologies for that.

    I just had a chance to look into this and can confirm this is not working as intended. Fortunately, resolving this issue was simple and the fix will be included in the next release of the TMP package which will be version 1.4.2 for Unity 2018.3 and 2.02. for Unity 2019.x.
     
    Rocco_B and MarcCelma like this.
  6. MarcCelma

    MarcCelma

    Joined:
    Feb 4, 2019
    Posts:
    2
    Wow thanks so much! Looking forward to the release then : ) Oh and that is some incredible response time. Cheers!
     
    Rocco_B and Stephan_B like this.
  7. Rocco_B

    Rocco_B

    Joined:
    Oct 28, 2016
    Posts:
    34
    That's great news Stephan! I used another solution as the project was nearing its end date but it's good to know this is being addressed!
     
    Last edited: May 31, 2019
  8. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
    Sorry to bring up an old thread, but any idea when the patch for this bug is gonna land in the package? Thanks!
     
  9. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Still working on the next package and currently making some improvements to Overflow modes. Just finishing some tweaks to the Overflow Linked mode and still have to review the Overflow Page mode to make sure all is good.

    Like I said in some previous post, the new package release is a week to week thing. Unfortunately, the release got delayed as I had to take a detour to address some IME issues which have been affecting our users for years. Although IME handling isn't part of the Text System / TMP, it certainly impacts text users so this had to be addressed.
     
  10. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
    No problem! Thanks for answering.
     
  11. renatop

    renatop

    Joined:
    Aug 7, 2018
    Posts:
    11
    @Stephan_B any updates on this? Just had this problem on 1.4.1. Tried 1.5.0-preview.3 and it still doesn't work :(
    Baseline, midline and capline basically can't be used from what I tested.
     
    Rocco_B likes this.
  12. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Baseline, Midline and Capline vertical alignments were designed for single lines of text and typically used to align the text vertically in some shape like a button for instance.

    Midline does work with multiple lines since it is actually based on the geometry.

    I still need to review the initial post to make sure the basic Top, Middle and Bottom vertical alignment modes work as expected in Page mode. While at it, we may as well discuss these vertical alignment modes and their expected behaviors.

    Below is an image showing the editable font metrics in the Font Asset Inspector.

    upload_2020-1-22_22-5-10.png

    Note these font metrics are defined by whoever designed the font and to achieve whatever design goal they had in mind in terms of balance / alignment. It is common for these metrics to not always match up with with the visual appearance of glyphs.

    For instance, the Cap Line is normally placed at the top of capital letters but in many fonts, it can be above or even below that for certain glyphs. The same is true for Mean Line which is normally placed at the top of lower case letters. Descent Line which is normally places at the bottom of letter with descenders. Again this is all up to the designer.

    The following describes how the vertical alignment is applied to a text object using these font metrics.
    • Top Alignment - Uses the max Ascent Line of the first line and aligns it with the top of the text container.
    • Middle Alignment - Uses the max Ascent Line of the first line and min Descent Line of the last line and aligns it within the vertical height of the text container.
    • Bottom Alignment - Uses the min Descent Line of the last line and aligns it with the bottom of the text container.

    • Baseline Alignment - Uses the Base Line of the first line and aligns it with the middle / vertical center of the text container. Note: I am not sure how Base Line could be used to achieve some type of viable vertical alignment with multiple lines of text.
    • Midline Alignment - Uses the max geometry of the first line and min geometry of the last line and aligns it within the height of the text containers. This could be revised or new mode added to use the Cap Line to Descent Line which would be more stable than using geometry. For instance, the line above would shift vertically if the text only contained "Ap" as the "`" is higher or if the line didn't contain a letter with descender. Using Cap Line to Descent Line is based on the font metrics and not individual characters and thus why it would be consider stable / non shifting based on the text but most likely achieve the desired visual results.
    • Capline Alignment - Uses the max Cap Line of the first line and the min Base Line of still the first line. The idea behind this mode is to ignore the descenders which are less common and visually less dominant. Revising this mode to work with multiple lines is possible as it would go from max Cap Line of first line to min Base Line of last line. Not sure if it would look good from a visual standpoint.
    Given these font metrics can be adjusted in the Font Asset Inspector, having a new mode that uses Cap Line to Descent Line and another using Cap Line to Base Line might make sense and like I said be more flexible and stable in the sense of not being affected by the actual text but driven solely by the font metrics. Thoughts?

    Subsequently, I could look at revising how these are handled in Page mode.
     
  13. renatop

    renatop

    Joined:
    Aug 7, 2018
    Posts:
    11
    I think I misinterpreted the original post into thinking it was the same problem as mine, but it's actually another issue. First of all, thanks for all the explanation. I was thinking the *line alignments had a totally different function. I thought baseline, midline and capline were similar to bottom, middle and top, but aligned by geometry instead of ascent / descent lines.

    I'm finishing up a rough Text to TextMesh Pro migrator that does the heavy work and only leaves to me some adjustments to be made manually. One issue that I'm having is that I can't find a way to replicate Text alignment (top, middle, bottom) when "align by geometry" is checked.

    Is there a way to achieve that?
     
  14. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    There is no specific option to align by geometry other than the exiting options available.

    Alignment by geometry is fine from a technical standpoint but it is not proper text alignment. Text alignment is driven by glyph / text metrics such as X and Y bearing and Advance values, Ascender, Descender, etc. So other than for some special circumstances like centering some text inside a shape like a button (for which Geometry Center and Midline are available) using the text metrics for alignment is always the preferred way and what is used in all text tools like Word processors, email clients, etc.
     
  15. renatop

    renatop

    Joined:
    Aug 7, 2018
    Posts:
    11
    @Stephan_B Thanks again for the explanation. I understand and agree with you! Guess I'll just use top / middle / bottom and readjust manually.
     
  16. NatMonney

    NatMonney

    Joined:
    Dec 8, 2014
    Posts:
    4
    Sorry for reviving this old thread. @Stephan_B is there any way to display the lines as shown in you screenshot in order to tweak their offsets ? Without visualization it's quite hard to know what I'm doing. Very informative post btw.

    EDIT: found it !
     
    Last edited: Nov 15, 2022