Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support narrator breaks in PT-BR in dialogue highlighting #2066

Closed
Tracked by #1773
nyex opened this issue Oct 25, 2024 · 5 comments · Fixed by #2068
Closed
Tracked by #1773

Support narrator breaks in PT-BR in dialogue highlighting #2066

nyex opened this issue Oct 25, 2024 · 5 comments · Fixed by #2068
Labels
build tool Component: Exports or the build tool editor Component: Editor enhancement Request: New feature or improvement next release Note: Features planned for next release

Comments

@nyex
Copy link

nyex commented Oct 25, 2024

Right now, I can highlight dialogue by indicating that lines beginning with an em dash are dialogue, but there is no way to alternate the highlighting when there is a narrator break in it.

As mentioned in #1773 (comment):

in Brazilian Portuguese we usually do dialogue like this:

— Tudo bem? — ele pergunta. — Você falou com ele?
— Ainda não — ela responde.
— Está ficando tarde.

Italics are narrator breaks.

Also as mentioned, it would be enough if there was a way to simply alternate the highlighting of dialogue on and off for each em dash (the em dash is the "correct" way of doing it, but I don't know if other people use the en dash when writing).

@nyex nyex added the enhancement Request: New feature or improvement label Oct 25, 2024
@vkbo
Copy link
Owner

vkbo commented Oct 25, 2024

Ah, thanks for creating a new issue! I will close the duplicate #2065 😄

@vkbo vkbo added build tool Component: Exports or the build tool editor Component: Editor next release Note: Features planned for next release labels Oct 25, 2024
@vkbo vkbo added this to the Release 2.6 Beta 1 milestone Oct 25, 2024
@vkbo
Copy link
Owner

vkbo commented Oct 26, 2024

Ok. this code seems to work, and is reasonably fast:

        if self._dialogLine and text.startswith(self._dialogLine):
            if self._narratorBreak:
                tPos = 0
                for tNum, tBit in enumerate(text[1:].split(self._narratorBreak), 1):
                    tLen = len(tBit) + 1
                    if tNum%2:
                        self.setFormat(tPos, tLen, self._hStyles["dialog"])
                    tPos += tLen
            else:
                self.setFormat(0, len(text), self._hStyles["dialog"])

It is run in the syntax highlighter before formatting highlighting is added. It changes the default colour of each section according to the split, and applies dialogue colour to the odd numbered entries, and keeps normal text colour for even numbered entries.

I tested on a couple of lines. I set the dialogue symbol to = just to make sure it could handle the distinction.

image

@vkbo
Copy link
Owner

vkbo commented Oct 26, 2024

It is also possible to apply a dedicated style for the narrator bits. I've tested that here:

image

This will need more settings in Preferences though. Is it always italic?

@nyex
Copy link
Author

nyex commented Oct 26, 2024

This will need more settings in Preferences though. Is it always italic?

Oh the italics was just to mark it for you, we don't use italics like that, no. Sorry i wasn't clear.

@vkbo
Copy link
Owner

vkbo commented Oct 26, 2024

Oh the italics was just to mark it for you, we don't use italics like that, no. Sorry i wasn't clear.

Ah, I see. Then forget that. Although it did make sense to me as a way to make i clearer. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build tool Component: Exports or the build tool editor Component: Editor enhancement Request: New feature or improvement next release Note: Features planned for next release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants