inthedrops - Formatting report on forums. #28


  • New
  • Defect
Open
Assigned to torhal
  • Torhal created this issue Dec 3, 2010
    Owner
  • Torhal added the tags New Defect Dec 3, 2010
  • _ForgeUser300352 posted a comment Dec 3, 2010

    Found something out. The reason the "height" is weird in issue #1 is becomes sometimes the text wraps and sometimes it doesn't. And the height is wrong when it's wrapping.

    Inside of function labelPrototype:SetupCell, if I make a call to fs:SetWordWrap(false) right before fs:SetText(tostring(value)) then issue #1 goes away.

    This obviously breaks word wrapping but its what's happening.

    In regard to issue #2, I now strongly believe it has to do with the font string just EVER so sligthly being cutoff (showing the ellipses ... ) partly as a result of recalculating widths after the cell was already set. We call AddLine, a width is determined (that is or isnt clipped) and then it ultimately gets resized again with the call to SetCell, but only after the line was added. Because in one case "Every Man for Himself" ends up as "Every Man for Hims..." and in the other case it ends up as "Every Man for Himself" this is causing the jitter. The actual pixel width difference between the two is very small.

    To prove this theory, I artificially increased the width of each cell by 5 (1 or 2 wasn't big enough to prevent the ellipses). I also did this inside of labelPrototype:SetupCell.

    The final code changes I made, which solved both problems I described as as follows:

    -- detatch fs from cell for size calculations
    fs:ClearAllPoints()
    fs:SetFontObject(font or (line.is_header and tooltip:GetHeaderFont() or tooltip:GetFont()))
    fs:SetJustifyH(justification)
    fs:SetWordWrap(false) -- ADDED
    fs:SetText(tostring(value))
    
    l_pad = l_pad or 0
    r_pad = r_pad or 0
    
    local width = fs:GetStringWidth() + l_pad + r_pad + 5  -- ADDED 5 MORE
    

    I've obviously not suggesting this as a solution. But clearly the height calculations are taking it's row wrapping height into account when it shouldn't be (because the end result isn't wrapped) and I think there's a strong possibility the "jitter" is due to an invisible ellipses condition. I say this partly because while playing with QTip code I had it showing the original/resized cell text and while fast, I could see it change from the ellipses to the non ellipses version of the text.

    To reproduce this, you need a pretty tight tolerance as concerns the sizing of all the cells and the widths of their text.


    Edited Dec 3, 2010

To post a comment, please login or register a new account.