Tk Source Code

View Ticket
Login
Ticket UUID: fc24165111709d5add5fb7532e30bb18233c0404
Title: Mac OS X: text bbox does not return {} for off-screen characters
Type: Bug Version: 8.6.6, revised_text
Submitter: bll Created on: 2017-06-23 16:48:28
Subsystem: 18. [text] Assigned To: gcramer
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-07-02 15:50:25
Resolution: Fixed Closed By: fvogel
    Closed on: 2017-07-02 15:50:25
Description:
This issue exists in both in 8.6.6 and revised_text.
The negative numbers should not be returned either.

package require Tk
pack [text .t -width 20 -height 10 -wrap char]
.t insert 1.0 "abcd\nefg hijkl mnop qrstuv wxyz"
.t tag configure y -wrap none
update
.t tag add y 1.end 2.2
.t bbox 2.20  ; # should return {}

% .t bbox 2.2 ; # g
18 18 7 14
% .t bbox 2.3 ; # { }
25 18 -7 14
% .t bbox 2.18 ; # t
130 19 -7 15
% .t bbox 2.19 ; # u
137 19 -7 15
% .t bbox 2.20 ; # v  off-screen
144 19 -7 15
% .t bbox 2.21 ; # { } off-screen
151 19 -7 15
% .t bbox 2.22 ; # w
%
User Comments: fvogel added on 2017-07-02 15:50:25:

Testcase added, see [d69c43af2e].


bll added on 2017-06-25 23:11:03:
Closing.
Compiles on Linux and Mac OS X with aea6c01766.

gcramer added on 2017-06-25 20:21:22:
I changed the dependency from TCL_MINOR_VERSION TO TK_MINOR_VERSION, should compile again with [aea6c01766].

bll added on 2017-06-25 17:51:18:
Linux:

In file included from /home/bll/tcl/tk/unix/../generic/tkText.h:22:0,
                 from /home/bll/tcl/tk/unix/../generic/tkTextDisp.c:22:
/home/bll/tcl/tk/unix/../generic/tkInt.h:1257:38: error: expected identifier or ‘(’ before numeric constant
 # define TkpDrawingIsDisabled(tkwin) 0
                                      ^
/home/bll/tcl/tk/unix/../generic/tkTextDisp.c:76:12: note: in expansion of macro ‘TkpDrawingIsDisabled’
 static int TkpDrawingIsDisabled(Tk_Window tkwin) { return 0; }
            ^
Makefile:1149: recipe for target 'tkTextDisp.o' failed

bll added on 2017-06-25 17:37:10:
Mac OS X:

----

/Users/bll/tcl/tk/unix/../generic/tkTextDisp.c:69:1: error: static declaration
      of 'TkpDrawingIsDisabled' follows non-static declaration
TkpDrawingIsDisabled(
^
/Users/bll/tcl/tk/unix/../generic/tkInt.h:1255:18: note: previous declaration is
      here
MODULE_SCOPE int        TkpDrawingIsDisabled(Tk_Window tkwin);

----

duplicate symbol _TkpDrawingIsDisabled in:
    tkTextDisp.o
    tkMacOSXDraw.o

----

textDisp-1.2 passes
textDisp-2.1, 2.2, 2.3, 2.4, 2.5, 2.6 pass

progress!

----

This is a lot better than 149 skipped; There are more textfonts constraints to be removed.  I will have to start going through the failures and see if they are real, or just need modification to be font-agnostic.

all.tcl:        Total   392     Passed  342     Skipped 25      Failed  25

Preliminary, Not reviewed at all:

2.26 is failing (tab handling with bbox)

4.5, 4.6, 24.16, 24.17 have:
2017-06-25 10:22:53.391 tktest[39767:293106] tkMacOSXDraw.c:746: DrawCGImage(): Mismatch of sub CGImage bounds

Most of the other failures just have off-by-one errors.

27.7 another tab issue, off by 19

gcramer added on 2017-06-25 12:57:55:
Thanks for the hint, I must confess that I have forgotten about the context drawing under Mac.

I've found out that the algorithm in CharChunkMeasureChars() did not properly work, thus I did a rework, committed with [ccc76e82f6]. The new algorithm is even quite more efficient than the old one.

I have tested this with an emulation under Linux, a real test under Mac is still needed.

bll added on 2017-06-24 18:22:33:
See also: http://core.tcl.tk/tk/tktview/3df559ef7c7e618a9624

gcramer added on 2017-06-23 21:06:09:
Under Linux it works properly, this seems to be a Mac only problem. Quite obscure, because the related code is platform independent. But it seems that the Mac version still has memory problems; but not with "bool" anymore, I've checked this with an emulation (bool=char) under Linux, with valgrind.

Attachments: