Hi Tav,
You can make a merge request if you'd like comments on the branch to be kept together. It's useful even if you don't need the peer check.
I do have a question about text. I'd like a "by width" sizing option for flow text, I can't find anything but I'm pretty sure it's not something that would/should be in the svg3 spec anyway. The option sizes all lines to fit by increasing or decreasing the line's individual font size and turns off word-wrap and font size selection.
Any advice on how you'd make this feature given you've just been through the text code?
Best Regards, Martin Owens
On Wed, 2015-10-28 at 15:41 +0100, Tavmjong Bah wrote:
Hi,
I've implemented the CSS 3 'text-orientation' property which controls how glyphs are rendered in vertical text. This property replaces the 'glyph-orientation-vertical' property which Inkscape never implemented and is deprecated in SVG 2. While doing this work I also corrected some other layout issues with vertical text and with multi-line text. As this work is rather invasive I've pushed my changes to a new branch which can be checked out via:
bzr branch lp:~inkscape.dev/inkscape/writing_modes
Please test this branch!
Here is a list of the most important changes:
- Latin characters in vertical text will be drawn by default sideways.
This is the default direction in both SVG 1.1 and in CSS 3 Writing Modes. Currently Inkscape draws the glyphs upright.
- Punctuation characters in CJK vertical text will be orientated
correctly.
- The Text Toolbar can be used to set 'text-orientation' which controls
how characters are orientated in vertical text (it has no effect on horizontal text). The three choices are 'mixed' where the glyphs are drawn in their Unicode defined natural orientation, 'upright' where all glyphs are drawn upright, and 'sideways' where all glyphs are drawn sideways.
- The new CSS 3 values for 'writing-mode' will be recognized. The
values written out are still the SVG 1.1 values except for the new 'vertical-lr' value which has no equivalent SVG 1.1 value (and is required for Mongolian). A new button appears on the Text Toolbar to select this value. (The SVG 1.1 values are deprecated but must still be recognized by SVG renderers.)
- Fonts without vertical metrics will have a vertical advance of 1em.
The CSS specification explicitly does not define what advance to use but the SVG 1.1 spec suggests 1em and the W3C Japanese text document specified an advance of 1em.
- In laying out multi-line text, any 'leading' value from the font is
ignored. CSS dictates that the font-size corresponds to the em height of a font which is defined as 'ascent' + 'descent'. The change to ignore the "internal" font 'leading' may make small visual changes in how multi-line text appears.
- In flowed text, Inkscape has been using a "scaled" value of 'ascent'
to position the first line. This has been changed to follow the correct CSS prescription of using the value of 'half-leading' + normal 'ascent' for horizontal text (to find the alphabetic baseline) and 'half -leading' + half em width for vertical text (to find the center baseline). (The 'leading' in this case is the extra space needed between lines as dictated by the 'line-height' property. It is not the 'internal' font 'leading'.)
Tav