Tk Source Code

View Ticket
Login
Ticket UUID: 442208915de7ae1d36952ed4c104a7c13e3453bc
Title: text widget breaks graphemes with combining diacritical marks
Type: Bug Version: Tcl8.7a6 / Tk9.0b1
Submitter: emiliano Created on: 2024-01-15 21:52:47
Subsystem: 18. [text] Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2024-11-14 16:10:57
Resolution: None Closed By: nobody
    Closed on:
Description:

With Tcl8.7a6 / Tk9.0b1 the following script shows how the text widget breaks graphemes obtained using combining diacritical marks into two distinct chars. This doesn't happen with labels or entries, both tk or ttk ones. Tested on linux 32 bits.

package require Tk
set txt a\u0300e\u0301i\u0302o\u0303u\u0304
pack [label .tkl] [ttk::label .ttkl] [entry .tke] [ttk::entry .ttke] \
     [text .t -width 20 -height 3]
.tkl  configure -text $txt
.ttkl configure -text $txt
.tke  insert 0 $txt
.ttke insert 0 $txt
.t    insert end $txt

User Comments: jan.nijtmans added on 2024-11-14 16:10:57:

I suspect that this ticket is related to:

#define TK_LAYOUT_WITH_BASE_CHUNKS     1
#define TK_DRAW_IN_CONTEXT             1
as defined in the macOS port. On Windows, those are not defined.

Also, see the following note in the TkpDrawCharsInContext() implementation on Windows and UNIX (both X11 and xft):

 *      Note: TK_DRAW_IN_CONTEXT being currently defined only on macOS, this
 *            function is unused (and possibly unfinished). See [7655f65ae7].

If this is the cause, it explains why this issue only shows on Windows and UNIX, and not on MacOS.


fvogel added on 2024-04-14 18:35:08:
With xft I agree with what you wrote.

Without xft however, all widgets are broken.

jan.nijtmans added on 2024-03-19 10:36:09:

On Linux, I see exactly the same as the attached image shows. So on X11 it's not solved. For label and entry everything is fine, but not for the text widget. Work to be done.


jan.nijtmans added on 2024-03-19 10:01:49:

> I cannot reproduce the problem on Windows.

Me neither! That means, probably, one of the fixes in [53fdb87e49] fixed this one at the same time. Good news.

I'll retest on Linux


fvogel added on 2024-03-15 23:46:26:
I cannot reproduce the problem on Windows.

jan.nijtmans added on 2024-03-15 20:06:32:

Now that [53fdb87e49] is fixed, this ticket is the next challenge. Since on MacOS everything works, this means that the MacOS and the generic code is fine. So, the coolpit must be in the win32 (tkWinFont.c) and the X11 code (tkUnixFont.c).

We could split this ticket into 2, one for win32 and one for X11. I could use some help. Christian Werner, maybe? Anyone?


jan.nijtmans added on 2024-01-15 23:05:13:

I see the same on Windows and Linux. On MacOS it works fine. Still some work to do to make full Unicode support 100% right on all platforms

Tk 8.7 still has more problems, I'm aware of. Some code from Tk 9.0 still needs to be backported to 8.7.


Attachments: