Menu

#2793 Rotated text on canvas grows larger

obsolete: 8.6b1.1
closed-works-for-me
5
2010-05-18
2010-04-28
No

When a text string is rotated on the canvas (in this case, to 90 degrees), it gets noticeably larger. When it's rotated back to 0 degrees, a portion of the text is not properly removed from the screen. The size of that remaining portion seems to be the difference between the original text size and the now-too-large text size after rotation.

So, for instance, if the original string was 100 pixels wide, it might be 120 pixels high after rotation. When it's rotated back to horizontal, a 20 pixel piece (in this example) would be left behind.

Win 7, x64, AS 8.6b1.1

The attached image should help to explain things better.

Discussion

  • Jeff Godfrey

    Jeff Godfrey - 2010-04-28

    Canvas rotated text details

     
  • Andreas Kupries

    Andreas Kupries - 2010-04-28

    Text rotation was done by Donal Fellows, IIRC.

     
  • Donal K. Fellows

    The code just asks Windows to draw the text using a rotated font. No idea why they're fluffing it so badly. (No, we don't want to get into the game of placing characters individually; that's actually wrong because it defeats handling many other things correctly.)

     
  • Jeff Godfrey

    Jeff Godfrey - 2010-04-28

    At Donal's suggestion, I tested text rotated at 0.01 degrees. It exhibits originally described issue. Attaching a new image with the details.

     
  • Jeff Godfrey

    Jeff Godfrey - 2010-04-28

    Text rotated 0.01 degrees

     
  • Jeff Godfrey

    Jeff Godfrey - 2010-04-29

    Just tested using 8.6b1.1 under WinXP SP3. It also exhibits the originally
    described issue. However, testing with additional fonts seems to indicate
    that the problem is somehow related to mono spaced fonts.

    At least, some cursory testing shows the problem exists with the Consolas
    and Courier fonts (mono spaced), but not with the Tahoma and Verdana fonts
    (proportional).

     
  • Donal K. Fellows

    I can't test this, but I *think* the problem is that we're passing in the pixelSize with the wrong sign in SelectFont (and possibly CanUseFallback as well). I suspect that the fix will be to negate the third argument to GetScreenFont in those two functions.

    All function names relate to tkWinFont.c of course.

     
  • Jeff Godfrey

    Jeff Godfrey - 2010-05-03

    Donal,

    Thanks for the info. It's been a number of years since I built Tcl/Tk from sources, and I've never done it under Win 7. Assuming I can get set up to do that (and I'd guess I can), I should be able to test your theory.

    I'll report back if/when I get that done.

     
  • Jeff Godfrey

    Jeff Godfrey - 2010-05-03

    I just built Tcl/Tk from the HEAD sources (dated 20100430). Upon testing this again, I no longer see the problem. I can now rotate my text strings without seeing the unexpected growth.

    Donal - you haven't already made the change you suggested, have you? As near as I can tell, you haven't, though I really don't have anything to compare to.

    I did have to do something that's possibly suspect in my building of Tk (use the release tcl86.lib file instead of the one I created when I built the Tcl head). I only mention that in case you think it somehow invalidates my test.

    My skill set in this area is quite rusty...

     
  • Donal K. Fellows

    I've not touched anything. I was just trying to work out what to do, and wanted to see if what I had in mind was correct. :-)

    Can I confirm then that the HEAD of Tk does not have this problem?

     
  • Jeff Godfrey

    Jeff Godfrey - 2010-05-03

    > Can I confirm then that the HEAD of Tk does not have this problem?

    Well, the version I just created from the HEAD does not exhibit the problem. So, unless you're concerned that I used the 8.6b1.1 version of tcl86.lib when I built it, it certainly seems OK.

    I'm a bit perplexed regarding why, but I guess beggars can't be choosers... ;^)

     
  • Donal K. Fellows

    I'm perplexed too, but I'll make this Pending/WorksForMe for now just in case it becomes possible to reproduce it.

     
  • Donal K. Fellows

    • assigned_to: hobbs --> dkf
    • status: open --> pending-works-for-me
     
  • SourceForge Robot

    • status: pending-works-for-me --> closed-works-for-me
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).