Create CSSLengthPercentage to keep track of relative font units.
This allows Krita to keep track of (font) relative units in the text tool, unlike the CSS absolute units, font relative units don't have any problems with pixels and pts, being solely font-relative. Inheritance and computing thereof is now dynamic.
I'm still having some trouble with the best units. Tab-size only accepts a length and a number, but the current struct is always lengthPercentage. Then there's text indent which keeps track of percentage separately, because it resolves that differently. Then there's stuff like letter-spacing, word-spacing and inline-size, where for the former two, % was viewport relative in SVG 1.1, and in SVG2 it's em-relative. Inline-size % is always viewport relative. Maybe I need to split up lengthPercentage into percentage and length? I'm loading letter and wordspacing with viewport bounds, and always saving as em, same with tab-size. text-indent is now handled a bit more elegantly.
To do:
-
Font-size -
Text Indent -
Baseline shift -
LineHeight -
Tab size -
letter spacing -
word spacing -
inline size, shape-padding, shape-margin. -- later, this influences behaviour strategies. -
Rework the text-split to avoid inheriting unnecessarily there. -- later, can't tell if required or not at this moment.
Test Plan
- Create a text.
- Open the text with the svg source editor.
- Add a tspan around a subsection to set 'font-size: 2em'.
- After saving the font-size of a given section should be double in size, and in the svg source editor remain 2em.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
TestSvgText -- passes -
TestSvgParser -
TestSvgSavingContext -
TestSvgParserRoundtrip -- failed, but unrelated. -
TestSvgTextRoundtrip -- failed, but unrelated.
-
-
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.