[Development] QTextFormat::LayoutDirection as a character format property?
Volker Hilsheimer
volker.hilsheimer at qt.io
Sun Nov 3 11:37:08 CET 2024
> On 31 Oct 2024, at 14:51, Igor Khanin <igor at khanin.biz> wrote:
>
> Greetings,
>
> I hope this is the right place to post this. I'm looking for advice as well as any historical context I can get.
>
> The documentation states that the `QTextFormat::LayoutDirection` text format property is both a paragraph and a character property. When set on a block format, it indeed affects the block's base direction via `QTextBlock::textDirection`. However when set on a character format, to the best of my understanding it appears to have no effect whatsoever. I'd expect it to have some sort of similar impact on the BiDi algorithm - perhaps overriding the directional character type of the character to be L or R, or maybe making a sequence of characters with the same property value behave as if they were an isolation run, or some such. But that can't obviously happen currently, as `QBidiAlgorithm` has no access to any formats and finishes its' work before character formats are resolved anyway.
>
> This appears to be the case since Scribe was first released back in Qt 4, or at the very least predates the current Git history. So my question is why then the documentation says that? Was there an intention to implement some behavior that then never happened?
>
> Furthermore - would it make sense for this property to start _actually_ doing anything on individual characters? I have a hacky POC, but don't want to waste my own and other's time if this is something that would be considered too niche or disruptive.
>
> Best,
> Igor
Hi Igor,
It’s the right place to post this, but it would help to understand what you are trying to achieve with an implementation of layout direction on as a character format. My understanding of the subject doesn't go very deep (and I can’t say if the documentation is wrong or simply misleading - perhaps it’s a read-only attribute), but to change layout direction within a block, you’d usually insert Unicode control characters into your text.
Volker
More information about the Development
mailing list