Tk Source Code

View Ticket
Login
Ticket UUID: 852669
Title: Fix bugs #478568 and similar
Type: Patch Version: None
Submitter: cc_benny Created on: 2003-12-02 15:30:55
Subsystem: 18. [text] Assigned To: hobbs
Priority: 8 Severity:
Status: Closed Last Modified: 2004-02-14 08:58:38
Resolution: Fixed Closed By: hobbs
    Closed on: 2004-02-14 01:58:38
Description:
Fix tkWinFont.c:Tk_MeasureChars() to *not* measure each
character in isolation.

Todo: Fix Tk_DrawChars() to shift italic char runs to the
right a bit.  Maybe use TextMetrics.tmOverhang for that.
User Comments: hobbs added on 2004-02-14 08:58:38:
Logged In: YES 
user_id=72656

I've applied for 8.4.6 using latest 8.5 tkWinFont.c (that
had further fixes of a mem leak).

hobbs added on 2004-02-14 08:01:34:
Logged In: YES 
user_id=72656

This didn't get applied to 8.4.

vincentdarley added on 2003-12-04 19:11:46:
Logged In: YES 
user_id=32170

That looks like a good fix to me; I've tested it quite
thoroughly and added a new test to textDisp.test.

cc_benny added on 2003-12-03 18:42:34:

File Added - 69413: tkWinFont.c.patch

Logged In: YES 
user_id=143885

Ok, so try this.  Cursor and selection seem good now. 
Underlines
on italics look a bit skewed to the left (;-) but that's a
Windows
problem, we don't draw this ourself.

hobbs added on 2003-12-03 02:27:45:
Logged In: YES 
user_id=72656

ok, updated my local tests.  The patch is at least half way 
there, and could be added without the other end, but the full 
solution needs to get done.

vincentdarley added on 2003-12-03 02:02:58:
Logged In: YES 
user_id=32170

Also look at the insertion cursor position in the latest
attachment as it moves through the italic chars -- this
shows clearly that they're drawn at the wrong place.

vincentdarley added on 2003-12-03 02:01:33:

File Added - 69323: textFont.tcl

vincentdarley added on 2003-12-03 01:57:27:
Logged In: YES 
user_id=32170

This test shows why Tk_DrawChars needs fixing too:

pack [text .t]
font create bi -family [lindex [.t cget -font] 0] -size 24
font configure bi -weight bold -slant italic
.t tag configure bi -font bi
.t insert 1.0 abcd {} efgh bi ijkl {}
console show

hobbs added on 2003-12-03 01:34:38:

File Added - 69319: fontbug.tcl

Logged In: YES 
user_id=72656

The following test indicates that this is correct.  I haven't 
analyzed the patch in depth though.  I think this is good for 
8.5a0 and 8.4.6 though.

vincentdarley added on 2003-12-03 00:42:25:
Logged In: YES 
user_id=32170

This works for me on measuring chars but, as you say,
Tk_DrawChars needs to be fixed to move italic char runs to
the _left_ a bit, presumably by tmOverhang.  Otherwise the
characters will now overlap.

cc_benny added on 2003-12-02 22:30:55:

File Added - 69298: tkWinFont.c.patch

Attachments: