|
2026-05-20
| ||
| 15:29 | • Closed ticket [23f52946]: Rotated text for tk labels plus 7 other changes artifact: f8c33819 user: oehhar | |
|
2026-04-21
| ||
| 08:02 | • Ticket [23f52946]: 4 changes artifact: f6c78a5f user: oehhar | |
|
2026-04-20
| ||
| 20:39 | • Ticket [23f52946]: 3 changes artifact: 5a04e7b9 user: emiliano | |
| 16:36 | • Ticket [23f52946]: 4 changes artifact: 66116c91 user: oehhar | |
| 14:02 | • Ticket [23f52946]: 3 changes artifact: f9d0c4f4 user: emiliano | |
| 14:00 | • Add attachment size-const-demo2.tcl to ticket [23f52946] artifact: 605ce1aa user: emiliano | |
|
2026-04-17
| ||
| 22:39 | • Ticket [23f52946] Rotated text for tk labels status still Open with 3 other changes artifact: 7e997a09 user: emiliano | |
| 22:37 | • Add attachment size-const-demo.tcl to ticket [23f52946] artifact: 754417ae user: emiliano | |
| 09:53 | • Ticket [23f52946] Rotated text for tk labels status still Open with 4 other changes artifact: 9e0aeca8 user: oehhar | |
|
2026-04-16
| ||
| 10:31 | • Ticket [23f52946]: 4 changes artifact: 17f6d1b9 user: oehhar | |
|
2026-04-14
| ||
| 16:45 | • Ticket [23f52946]: 4 changes artifact: 41b38b49 user: nemethi | |
|
2026-04-09
| ||
| 12:20 | • Ticket [01153381] Flip ttk:: notebook tab states "first" and "last" for "-tabplacement e*|s* status still Open with 4 other changes artifact: 503102d1 user: oehhar | |
| 12:18 | • Ticket [23f52946] Rotated text for tk labels status still Open with 4 other changes artifact: a61ae487 user: oehhar | |
|
2026-04-02
| ||
| 13:58 | • Ticket [23f52946]: 5 changes artifact: ce81cf96 user: nemethi | |
|
2026-03-30
| ||
| 13:06 | • Ticket [23f52946]: 3 changes artifact: 011fd634 user: oehhar | |
| 11:49 | [23f52946] Christians refinements from https://androwish.org/home/info/ffcf6812d35de3b9. Changes to ttkWinXPTheme.c are applied to ttkWinVistaTheme.c, State USER1/2 are now FIRST/LAST. check-in: dbc9773d user: oehhar tags: 23f52946-rotated-text | |
| 10:35 | [23f52946] Emilianos rotated label patch from https://androwish.org/home/info/de7c0ee843 check-in: 7b003125 user: oehhar tags: 23f52946-rotated-text | |
| 09:33 | • New ticket [23f52946] Rotated text for tk labels. artifact: 7347928e user: oehhar | |
| Ticket UUID: | 23f529464dc31793f919e9adab2616df53455141 | |||
| Title: | Rotated text for tk labels | |||
| Type: | RFE | Version: | main | |
| Submitter: | oehhar | Created on: | 2026-03-30 09:33:39 | |
| Subsystem: | 88. Themed Tk | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-05-20 15:29:13 | |
| Resolution: | Fixed | Closed By: | oehhar | |
| Closed on: | 2026-05-20 15:29:13 | |||
| Description: |
This ticket proposes to add a "-textangle" option to tk/ttk label and a style option. One aim is to have vertical tab labels for a ttk::notebook widget. Implementation is in branch 23f52946-rotated-text. Code provided by Emiliano and Christian. In addition, a bugfix is implemented that ttk::notebook tab flags first/last are flipped when tabs are on right or bottom side of the widget. ExamplesAs noted by Christian, style "clam" is subject of first/last painting differences. So, use this style. Vertical tabs on topttk::style theme use clam ttk::style configure LTab.TNotebook.Tab -textangle 90 pack [ttk::notebook .n -style LTab.TNotebook] -fill both -expand true -padx 10 -pady 10 label .n.l1 -text label -textangle 90 .n add .n.l1 -text 1:label ttk::label .n.l2 -text ttk::label -textangle 90 .n add .n.l2 -text 2:ttk::label Vertical tabs on left sidettk::style theme use clam ttk::style configure LTab.TNotebook -tabposition ws -tabplacement se ttk::style configure LTab.TNotebook.Tab -textangle 90 ttk::configureNotebookStyle LTab.TNotebook pack [ttk::notebook .n -style LTab.TNotebook] -fill both -expand true -padx 10 -pady 10 label .n.l1 -text label -textangle 90 .n add .n.l1 -text 1:label ttk::label .n.l2 -text ttk::label -textangle 90 .n add .n.l2 -text 2:ttk::label Vertical tabs on right sidettk::style theme use clam ttk::style configure LTab.TNotebook -tabposition es -tabplacement sw ttk::style configure LTab.TNotebook.Tab -textangle 90 ttk::configureNotebookStyle LTab.TNotebook pack [ttk::notebook .n -style LTab.TNotebook] -fill both -expand true -padx 10 -pady 10 label .n.l1 -text label -textangle 90 .n add .n.l1 -text 1:label ttk::label .n.l2 -text ttk::label -textangle 90 .n add .n.l2 -text 2:ttk::label Vertical tabs on bottom sidettk::style theme use clam ttk::style configure LTab.TNotebook -tabposition sw ttk::style configure LTab.TNotebook.Tab -textangle 90 ttk::configureNotebookStyle LTab.TNotebook pack [ttk::notebook .n -style LTab.TNotebook] -fill both -expand true -padx 10 -pady 10 label .n.l1 -text label -textangle 90 .n add .n.l1 -text 1:label ttk::label .n.l2 -text ttk::label -textangle 90 .n add .n.l2 -text 2:ttk::label DiscussionStarting on 2026-01-30, there was a thread on the core list titled "Angled text". This ticket is to document the content and possibly continue here. RenéCuriosly, I looked if we could have rotated text in label, entry and button. Currently the following functions (from tkFont.c) are used: Tk_UnderlineTextLayout() Tk_DrawTextLayout() But we already have angled text functions: TkUnderlineAngledTextLayout() TkDrawTextLayout() Currently the usage if #ifdef'd out. Do anyone know the state of these functions and why they are not used? ChristianMy educated guess is they are #ifdef'd out due to performance reasons. The fact that the Tk_DrawAngledTextLayout() and friends aren't used in labels/buttons and most likely entries, too, is that for non X11 platforms the underlying native platform infrastructure is used. But maybe the ttk variants could benefit from the *AngledTextLayout() functions and provide a -angle option. DonalFWIW, in the original implementation of the angled text drawing for the canvas, the guts of the code draws the rotated glyphs (not characters, this is an area where we must be precise) one at a time on platforms other than macOS in order to avoid nasty cumulative grounding bugs in the positioning of the glyphs that meant that the naive approach would have glyphs not being drawn within the rotated bounding box (or even the rectilinear bounding box of that). It was the same bug on both X11 and Windows, despite the likelihood of shared code being essentially zero. In short, the glyph positions were rounded to integer coordinates in the wrong way, so the error in positioning each glyph would accumulate over a line of text; the easiest way to implement things, but wrong! The Tk demo of rotated canvas text that rotates the angle in 1° increments remains a pretty stringent test, and not one that had been previously tried on either platform at that time. Maybe things have been fixed since? That would be nice, as it would let us focus on widgets instead. We don't want to do things a glyph at a time, not really, but we must (or at least had to at the time). Anyway, that's the context for why things are the way they are. The code to split text into chunks of characters that become single glyphs is probably wrong. Inevitably. 😁 EmilianoAbout: TkUnderlineAngledTextLayout() TkDrawTextLayout() Those were implemented by DKF as part of TIP 119. They work on all platforms, but I can only confirm first hand that they work on X11 and Windows. The functions works as intended. I used them in my Rbc fork here: https://chiselapp.com/user/egavilan/repository/rbc-tk9/file?name=generic/rbcText.c&ci=tip and their usage simplified things a lot. Of all the "Angled" family of font functions, I only used TkDrawAngledChars(), as Rbc implements its own text layout code. The only "drawback" is the inclusion of <TkInt.h> since they are not public (yet). ChristianThere's already a hidden undocumented knob named "-tabplacement". Combine it like so ttk::style configure LTab.TNotebook -tabposition ws -tabplacement se ttk::style configure LTab.TNotebook.Tab -textangle 90 ... and the effect is almost as I have imagined. However, there are subtle problems in the ttk layoutery which I tried to solve in this check-in (which includes your enhancements to angled text from today): https://androwish.org/home/info/ffcf6812d35de3b9 The most important takeaway is the reversal of the TTK_STATE_USER1 and TTK_STATE_USER2 bits depending on the placement to flag the first and last tab item, respectively, for rendering in the "clam" theme. There might still be other undetected subtle visual problems. But in principle, everything seems to be in place already. Code import from AndrowishNew branch 23f52946-rotated-text includes the code import:
| |||
| User Comments: |
oehhar added on 2026-05-20 15:29:13:
Fixed by TIP 751, which is merged by commit [2c172fbd]. Thanks for all. Closing bug. Harald oehhar added on 2026-04-21 08:02:59: Thanks for the answer. The substituted font issue is Tk bug 3249f7d4 I would love to get the TIP stabilized, one day left:
Thanks for all, Harald emiliano added on 2026-04-20 20:39:02: @Harald:
This problem occurs elsewhere, as it also affects rotated text on canvas. It also happens in X11 if fontconfig is configured to display bitmap fonts. The summary of the constraints, which applies to text-only labels, is the following:
I can imagine uses where the last described behaviour is desirable, but only for angles of 90-180-270. For all other angles I agree that setting -width and -height to 0 and let the label determine the required space is the best option. Also note that if an image is displayed, all this don't apply as -width/-height are specified in pixels and -angle is completely ignored. oehhar added on 2026-04-20 16:36:47: Dear Emiliano, thanks for the demo. That is great. What I observe:
I have to say, that all those are edge cases. Thanks for all, Harald emiliano added on 2026-04-20 14:02:03: Attached a slightly modified demo. This exercises the difference between "Courier" and "Courier New" fonts on Windows emiliano added on 2026-04-17 22:39:34: Attached a simple demo which exercises the -width and -height constraints on a tk label with animated rotating text. oehhar added on 2026-04-17 09:53:17: After discussion with Emiliano and Christian: * The bug branch is re-renamed [23f52946-rotated-text] * Emilianos branch [label-angled-text] is now the tip branch [tip-751-labels-rotated-text] Christian noted, that Emilianos branch is better suited for 9.1, while his branch is 8.6. Thanks for all, Harald oehhar added on 2026-04-16 10:31:38: This RFE ticket is now TIP-751. The branch was renamed to tip-751-labels-rotated-text. nemethi (claiming to be Csaba Nemethi) added on 2026-04-14 16:45:25: Ticket [01153381] is now fixed and the corresponding code (which contains also several further notebook-related improvements) is now merged to branch 23f52946-rotated-text, too. oehhar added on 2026-04-09 12:18:06: The notepad side paint bugfix by Christian is now in ticket [01153381]. nemethi (claiming to be Csaba Nemethi) added on 2026-04-02 13:58:44: I have made a few additions to the original text, like an example for vertical tabs on bottom side and invocations of the library procedure ttk::configureNotebookStyle, as described in the ttk_notebook man page. | |||
Attachments:
- size-const-demo2.tcl [download] added by emiliano on 2026-04-20 14:00:18. [details]
- size-const-demo.tcl [download] added by emiliano on 2026-04-17 22:37:43. [details]
