A few more changes have been checked in:
* x-height is taken from font if in the OS/2 font-metrics table otherwise it is measured with the 'x' glyph. At the moment, the value is only used in deriving baselines.
* The 'dominant-baseline' property is implemented (but w/o GUI). The position of the 'mathematical' and and 'hanging' baselines are determined from the font.
I cannot test the code changes work on Windows. It would be quite useful is someone that can compile Inkscape on Windows could at least see that the source compiles.
The source can be obtained via:
bzr branch lp:~inkscape.dev/inkscape/writing_modes
I will give people a couple of days to test before checking it into trunk
Tav
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