On Sun, 02 Jan 2005 17:31:56 +1100, Peter Moulder <Peter.Moulder@...38...> wrote:
Just now I've recommitted the different expansion metric, but this time I've similarly changed the sp_css_attr_scale call in desktop-style.cpp. I'm not very confident with this change, in particular the interaction with letterspacing, kerning etc.
I'm pretty sure this is incorrect too (though I haven't tested yet). sp_desktop_apply_css_recursive is a universal style setting function used for all kinds of style, not only text style. The call to sp_css_attr_scale was added so that when I apply e.g. the stroke-width of 2pt to an object which is scaled 200%, the actual value written to SVG is 1pt so that the _visible_ width is the requested 2pt. Thus sp_css_attr_scale scales all style properties that can have a <length> as value, not only font size. By using fontsize_expansion you fixed font size but likely broke prescaling of all other properties. Please rethink.
I note that sp-text.cpp:sp_text_adjust_fontsize_recursive changes font-size and letter-spacing & word-spacing, but that sp_css_attr_scale in addition changes baseline-shift, stroke-width and kerning. I'd guess that there's a bug in that difference.
No it's not a bug, sp_text_adjust_fontsize_recursive only applies to text objects and therefore scales text properties (others, if needed, are handled at the SPItem level). But sp_css_attr_scale, as I said, is a universal function that "scales" the entire style string that is going to be applied to something.
I'd guess that the other caller of sp_css_attr_scale, in selection-chemistry.cpp (something to do with pasting), should use the same expansion metric, for consistency.
There it's used on copying to clipboard, not pasting. The style of the copied object is saved in style_clipboard, but only after it is also prescaled by the copied object's transform expansion. The combination of two prescalings, on copy and on paste style (which uses sp_desktop_apply_css_recursive) ensures that you can always copy style from one object and paste it to another and get the same visible result, regardless of the transforms of the source and target objects.
I haven't tried your fontsize_expansion, but I'm pretty sure it would be incorrect to apply it to anything but font size. E.g. stroke width should obviously use regular expansion[1] because it cannot depend on the direction of scaling. And I'm not sure that, with the style scaling system in place as explained above, it is possible at all to use two different expansions without messing it all up.
[1] Actually stroke should not use any expansion at all, but be transformed by the transform itself as if it were an object, see http://sourceforge.net/tracker/index.php?func=detail&aid=851008&grou..., but that's another matter entirely.