Text indentation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hearsedriver
Posts: 19
Joined: Tue Dec 17, 2019 6:16 am

Text indentation

Post by hearsedriver »

Hi,

I've just started using Dialogue System. One inspiration for the visual appearance of the dialogue UI is Disco Elysium.
Can you tell me how text indentation like on this screenshot could work?

Thanks
Matt
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text indentation

Post by Tony Li »

Hi Matt,

Thanks for using the Dialogue System!

Please see this post. (Briefly: Use TextMesh Pro and the <indent> tag.)
hearsedriver
Posts: 19
Joined: Tue Dec 17, 2019 6:16 am

Re: Text indentation

Post by hearsedriver »

Thanks Tony, that worked and also gave me an idea how/where to uppercase the speaker names. And glad to see that all the pitfalls are well documented! (Enabling TMP support, rewiring subtitle reference, reimporting directories)

I have one issue, though. I unticked "Add Speaker Name" and cleared the "Add Speaker Name Format" as I understand this is now handled by the OnConversationLine method. Yet, the speaker name and the following subtitle text overlap. It looks as if the 10% indentation is applied to the first line already:

Screenshot 2019-12-17 at 23.52.20.png
Screenshot 2019-12-17 at 23.52.20.png (148.15 KiB) Viewed 1222 times

I use the code from your post (plus ToUpper() on the speaker name), the Dialogue Text of this conversation is defined as:

Code: Select all

"Guten Abend, werter Herr! Herzlich Willkommen im Hotel zur Post! Ich hoffe, Sie hatten eine bequeme Anreise?"\.
...
If I understand the TMP indent documentation correctly, the indentation is indeed applied on the first line already? (The space between "1." and "It is" in their sample image doesn't seem to be a regular space.)

EDIT: Another effect I'm seeing is that the TMP Typewriter Effect pauses in the middle of a line.

Any pointers?

Matt
hearsedriver
Posts: 19
Joined: Tue Dec 17, 2019 6:16 am

Re: Text indentation

Post by hearsedriver »

After digging into the TMP source code, I found a solution that seems to be working as expected. In TMP_Text.cs line 8342 of TMP preview.2 2.1.0, I changed

Code: Select all

m_xAdvance = tag_Indent;
to

Code: Select all

if (m_xAdvance < tag_Indent)
{
    m_xAdvance = tag_Indent;
}
Meaning: only if the cursor is not yet further than the requested indentation, move it to the desired position; otherwise ignore it for the current line.

Screenshot 2019-12-18 at 00.42.07.png
Screenshot 2019-12-18 at 00.42.07.png (150.82 KiB) Viewed 1218 times

I am just leaving this here because it might help other Dialogue System users, but it's probably more a bug / suggestion for improvement for the TMP forums. Also, it needs refinement in case of RTL texts.

Tony, the typewriter pause issue still persists, though. Any advice appreciated!

Matt
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Text indentation

Post by Tony Li »

Hi,

I'm back in the office and see you started a separate thread for the typewriter topic. I'll check it out and reply there.
Post Reply