| Ticket UUID: | 2816150 | |||
| Title: | Rotated text displays incorrectly on WinXP | |||
| Type: | Bug | Version: | obsolete: 8.6b1 | |
| Submitter: | yschekin | Created on: | 2009-07-03 06:52:49 | |
| Subsystem: | 05. Canvas Items | Assigned To: | aku | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Open | Last Modified: | 2020-04-22 05:11:20 | |
| Resolution: | None | Closed By: | nobody | |
| Closed on: | ||||
| Description: |
Run this script:
---
canvas .c
grid .c
set id [.c create text 200 100 -text "Angled text" -angle 15 -font {Courier 42}]
for {set f 40} {$f>20} {incr f -2} {
.c itemconfigure $id -font "Courier $f"
update
}
---
I see traces of bigger fonts in window. They dissapear on resizing it.
| |||
| User Comments: |
chrstphrchvz added on 2020-04-22 05:11:20:
Pardon me for reviving this, but I believe some form of this issue is still apparent even in Windows 10 2004. Arial appears to be one of the only fonts easily exhibiting the issue:
Since others have already looked into this and estimated its difficulty working around in the old Win32 API, I wonder if at this point it might be better to instead try using DirectWrite API if available (Windows Vista and later), and not worry about the limitations of the old Win32 API usage (leaving it in if still needed). dkf added on 2010-01-06 23:14:14: I can only duplicate with Arial, not Courier. patthoyts added on 2010-01-06 23:04:58: The above demo code looks fine when run on Windows7. Injecting an [after 250] to slow the resizes just makes it more obvious what steps are being done. Each one looks fine. Win7/Vista GDI has much better handling of fonts generally than the old GDI engine did. Like right-to-left fonts look fine by default and rotation is better supported. So we might just be running into GDI rendering issues for XP. dkf added on 2010-01-06 22:54:54: Examination indicates that a cheap hack won't fix it; to do the job right, we'd need to do the placement of the text ourselves character by character (rotating the character metrics and adding them as doubles). You'll need to find someone to do that for you as I'm not very good at hacking Windows (nor do I have good access to a Windows system to do this). dkf added on 2009-11-19 16:47:32: Yes. The cumulative error problem has been a real issue. The large problem is that a lot of *system* libraries have not been properly tested on rotated text (I encountered this first with Xft, but it's by no means a special problem to them). This has meant that they've not picked up on an issue that I spotted with cumulative errors; they measure individual glyphs correctly and then add the distances in the rotated domain to the offset location of drawing so as to find where to draw the following glyph, but they do this with integer locations, causing rounding errors to accumulate. At some angles, this is really quite terrible and means that the bounding box calculations are totally wrong. My code tries to work around this on the affected platforms by doing its own glyph placement (allowing for correct handling of rounding, which limits error to one pixel if the glyph drawing engine is itself correct) but that's an imperfect solution and there's still some error which I'm not quite sure about (I enlarge the bounding box very slightly to handle that, which helps). The OSX Carbon and Cocoa drawing frameworks are completely unaffected by this problem due to their different drawing model. ferrieux added on 2009-11-19 04:59:23: Works for me on XPSP3. However, putting [after 500] in the loop to see the motion, I see "jerky" movements, with either the string's center moving, or even differential motion between individual chars. Looks like cumulative errors too. dkf added on 2009-11-18 17:44:29: That's because the error is in the computation of the bounding box of the text, which is necessary for working out what the minimal area to redraw is. When you do a full refresh (setting the background color of the canvas is the easiest way to do this from source code, BTW) then the code can just draw and not worry about minimizing the draw area. yschekin added on 2009-11-18 17:11:44: After filing similar bug report about imove, I've noticed that these traces AND imove's line fragment go away if I just minimize/maximize window, or just send it to back, then to front. So it may be connected to canvas refresh. dkf added on 2009-07-05 23:23:20: It's exceptionally difficult to make this work right, as there are two possible areas for things to go wrong. Firstly, it's quite possible that there are rounding problems in the bbox calculation code (I welcome peer review, since I've stared at the code far too long to be able to see problems with it myself) and secondly, many platforms have problems with positioning of characters in text that is not angled parallel to one of the axes (particularly an issue with X11, where there are real issues with cumulative error handling). Which it is here, I don't know yet and I have no timescale for working on this. You can help distinguish by telling me if the problem gets worse as the text gets longer (a cumulative error problem) or stays the same (a bbox rounding problem). nijtmans added on 2009-07-03 15:54:43: Confirmed, I tested it on XP, and see it as well. My first guess is that it is related with the function ComputeTextBbox (in tkCanvText.c), because geometry calculations with rotated text are tricky, there always can be rounding errors. Probably other platforms than win32 have the same problem (can someone confirm that?). | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki
