Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: caf3fb47e1dbbf4ff8efa47b23b593636783b5ac
Ticket: 434d294df8b053246ee86e7898d06bc3a6d1d771
fix type mismatch in unix/tkUnixRFont.c
User & Date: yorwba 2017-02-23 07:55:48
Changes

  1. icomment:
    I noticed the bug using Tkinter from Python, but then grabbed the Tk 8.6.6 tarball to reproduce.
    
    Output of unpatched wish:
    % font actual {times -12}
    -family {TeX Gyre Termes} -size 0 -weight normal -slant roman -underline 0 -overstrike 0
    
    Patched:
    % font actual {times -12}
    -family {TeX Gyre Termes} -size 9 -weight normal -slant roman -underline 0 -overstrike 0
    
    While multiple functions of the XftPattern* interface can be used,
    each property must be set with the correct type.
    If you look at the table under
    https://keithp.com/~keithp/talks/xtc2001/paper/xft.html#sec-xft-name
    you can see that both size and pixelsize are supposed to be doubles.
    
    Xft (actually fontconfig) doesn't do any type conversions at the boundary
    when you try to set the pixel size to the integer value 12.
    Instead an integer-valued union field is set and when fontconfig converts
    the pixel size into the point size, it reads the double field, which has
    value 5.9287877500949585e-323. During conversion this value underflows,
    yielding a point size of 0.
    
  2. login: "yorwba"
  3. mimetype: "text/plain"