Skip to content

Add four options to control rendering options

Matan Ziv-Av requested to merge matan/konsole:word-mode into master
  • Word mode to render (some) words with one drawText() call, instead of one per character.
    • Ascii - to render words of ASCII characters
    • Brahmic - to render words of Brahmic scripts characters.
  • Option to consider attribute (color, bold, etc.) as word boundary.

Why it is needed?

The ASCII word mode allows for ligatures:

Rendering each character in place:

MR-ligature-noword

Rendering ASCII words:

MR-ligatures-word

A Devanagari sentence (from here)

अनुच्छेद १. सभी मनुष्यों को गौरव और अधिकारों के मामले में जन्मजात

Rendering each character in place:

MR-noword

Rendering Brahmic words:

MR-word

Compare to firefox: image

You can see that some wors are split when not in word mode.

In more details: The older konsole character rendering was also had two modes - each chararcter in place, or combining characters of the same script (misnamed bidi, see !544 (closed)). The inadequacy of the old method for Arabic and Hebrew scripts was discussed in !722 (merged) where the new rendering method was introduced.

Here are the two ways the Devanagari sentence was rendered in 22.08:

No Bidi:

22.08-nobidi

see that some characters do not combine correctly (the dashed circle place holders), and some words are not connected correctly.

Bidi:

28.01-bidi

Here the sentence is rendered correctly when static, but the whole line dances when the character moves. Similar result when selecting text.

The current renderer (character mode):

MR-noword

This is not perfect, but it seems much better than 22.08 character mode. I do not read Devanagari, so I cannot say if it is acceptable.

With this MR, in word mode:

MR-word

This seems to me to be correct when static, and there is a lot less dancing. This is similar to the old renderer with !556 (merged), but everything is done more explicitly, so the users may choose their preferred trade-offs, since no perfect solution is available.

Merge request reports