[librsvg: 5/7] Register text-orientation and glyph-orientation-vertical




commit 8f5b945ffce1a2cdbb0b32d6fc18ad00cff902d9
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Oct 26 11:48:52 2021 -0500

    Register text-orientation and glyph-orientation-vertical
    
    See the comment about why we put glyph-orientation-vertical among the
    longhands, while CSS Writing Modes 3 turns it into a shorthand.  We
    will deal with this specially in the text handling code.
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/622>

 FEATURES.md       | 14 ++++++++------
 src/properties.rs | 16 +++++++++++++++-
 2 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/FEATURES.md b/FEATURES.md
index 563859389..dd4cec894 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -279,10 +279,11 @@ The following are shorthand properties.  They are not available as
 presentation attributes, only as style properties, so for example you have to use
 `<path style="marker: url(#foo);"/>`, since there is no `marker` attribute.
 
-| Property | Notes |
-| ---      | ---   |
-| font     |       |
-| marker   |       |
+| Property                   | Notes                                                              |
+|----------------------------|--------------------------------------------------------------------|
+| font                       |                                                                    |
+| glyph-orientation-vertical | Supports only CSS Writing Modes 3 values: auto, 0, 90, 0deg, 90deg |
+| marker                     |                                                                    |
 
 The following are longhand properties.  Most of them are available as
 presentation attributes, e.g. you can use `<rect fill="blue"/>` as
@@ -290,7 +291,7 @@ well as `<rect style="fill: blue;"/>`.  The Notes column indicates
 which properties are not available as presentation attributes.
 
 | Property                    | Notes                                                  |
-| ---                         | ---                                                    |
+|-----------------------------|--------------------------------------------------------|
 | baseline-shift              |                                                        |
 | clip-path                   |                                                        |
 | clip-rule                   |                                                        |
@@ -336,6 +337,7 @@ which properties are not available as presentation attributes.
 | stroke-width                |                                                        |
 | text-anchor                 |                                                        |
 | text-decoration             |                                                        |
+| text-orientation            | Not available as a presentation attribute.             |
 | text-rendering              |                                                        |
 | transform                   | SVG2; different syntax from the `transform` attribute. |
 | unicode-bidi                |                                                        |
@@ -436,4 +438,4 @@ FIXME: `xml:space` attribute
 
 * `glyph-orientation-horizontal` property - SVG1.1 only, removed in SVG2
 
-* The pseudo-classes `:is()` and `:where()` are part of Selectors Level 4, which is still a working draft.
\ No newline at end of file
+* The pseudo-classes `:is()` and `:where()` are part of Selectors Level 4, which is still a working draft.
diff --git a/src/properties.rs b/src/properties.rs
index 051232d47..ea1854c11 100644
--- a/src/properties.rs
+++ b/src/properties.rs
@@ -438,8 +438,19 @@ make_properties! {
         "font-style"                  => (PresentationAttr::Yes, font_style                  : FontStyle),
         "font-variant"                => (PresentationAttr::Yes, font_variant                : FontVariant),
         "font-weight"                 => (PresentationAttr::Yes, font_weight                 : FontWeight),
+
         // "glyph-orientation-horizontal" - obsolete, removed from SVG2
-        // "glyph-orientation-vertical" - obsolete, now shorthand - 
https://svgwg.org/svg2-draft/text.html#GlyphOrientationVerticalProperty
+
+        // "glyph-orientation-vertical" - obsolete, now shorthand -
+        // https://svgwg.org/svg2-draft/text.html#GlyphOrientationVerticalProperty
+        // https://www.w3.org/TR/css-writing-modes-3/#propdef-glyph-orientation-vertical
+        //
+        // Note that even though CSS Writing Modes 3 turned glyph-orientation-vertical
+        // into a shorthand, SVG1.1 still makes it available as a presentation attribute.
+        // So, we put the property here, not in the shorthands, and deal with it as a
+        // special case in the text handling code.
+        "glyph-orientation-vertical"  => (PresentationAttr::Yes, glyph_orientation_vertical  : 
GlyphOrientationVertical),
+
         // "image-rendering"          => (PresentationAttr::Yes, unimplemented),
         "letter-spacing"              => (PresentationAttr::Yes, letter_spacing              : 
LetterSpacing),
         "lighting-color"              => (PresentationAttr::Yes, lighting_color              : 
LightingColor),
@@ -487,6 +498,7 @@ make_properties! {
         "mask-type"                   => (PresentationAttr::Yes, mask_type                   : MaskType),
         "mix-blend-mode"              => (PresentationAttr::No,  mix_blend_mode              : MixBlendMode),
         "paint-order"                 => (PresentationAttr::Yes, paint_order                 : PaintOrder),
+        "text-orientation"            => (PresentationAttr::No,  text_orientation            : 
TextOrientation),
     }
 
     // These are not properties, but presentation attributes.  However,
@@ -700,6 +712,7 @@ impl SpecifiedValues {
         compute!(FontStyle, font_style);
         compute!(FontVariant, font_variant);
         compute!(FontWeight, font_weight);
+        compute!(GlyphOrientationVertical, glyph_orientation_vertical);
         compute!(LetterSpacing, letter_spacing);
         compute!(LightingColor, lighting_color);
         compute!(MarkerEnd, marker_end);
@@ -724,6 +737,7 @@ impl SpecifiedValues {
         compute!(StrokeWidth, stroke_width);
         compute!(TextAnchor, text_anchor);
         compute!(TextDecoration, text_decoration);
+        compute!(TextOrientation, text_orientation);
         compute!(TextRendering, text_rendering);
         compute!(TransformProperty, transform_property);
         compute!(UnicodeBidi, unicode_bidi);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]