Tk Source Code

View Ticket
Login
Ticket UUID: 497e7621b4d1ba9bd77f3d02c173c1d3515c1476
Title: Text widget does not honor font option from Tk's database
Type: Bug Version: 8.6.11
Submitter: anonymous Created on: 2021-06-06 16:05:52
Subsystem: 75. wish Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2021-06-06 17:32:38
Resolution: None Closed By: nobody
    Closed on:
Description:

The text widget inherits its default options from Tk's option database. 
However, when a font is only partially specified, the unspecified elements seem 
not to be inherited from Tk's option database.

Demo:

package require Tk
option add *Text.font {-family TkFixedFont -size 48}
pack [text .t -height 5 -width 15]
.t insert end "Line 1\nLine 2"
.t cget -font ; 			# returns: -family TkFixedFont -size 48
					# font is correctly inherited from the option database
.t configure -font {-overstrike 1} ; 	# partial font spec
					# displayed font looks different

The end result seems different in both -family and -size, although only the 
-overstrike option was changed. Which exactly font is used and why, is unclear.

dzach

User Comments: bll added on 2021-06-06 17:32:38:
There was another ticket for this issue, though I cannot find it.

Apparently when configuring a new font, Tk doesn't use any particular default
as the base font.  It doesn't use TkDefaultFont for a baseline.