After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 725558 - Partial textPath support
Partial textPath support
Status: RESOLVED OBSOLETE
Product: librsvg
Classification: Core
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: librsvg maintainers
librsvg maintainers
Depends on:
Blocks:
 
 
Reported: 2014-03-03 10:41 UTC by Mika Heiskanen
Modified: 2017-12-13 18:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to add textPath support (34.26 KB, patch)
2014-03-03 10:41 UTC, Mika Heiskanen
none Details | Review

Description Mika Heiskanen 2014-03-03 10:41:39 UTC
Created attachment 270767 [details] [review]
Patch to add textPath support

librsvg lacks textPath support. The attached patch implements partial support for textPath.

Related issues:

https://bugzilla.gnome.org/show_bug.cgi?id=167708
https://bugzilla.gnome.org/show_bug.cgi?id=644624

The following SVG shows working features:

- relative and fixed length startOffsets
- text alignment on paths
- tspan on text path
- stretching of glyphs



<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="12cm" height="3.6cm" viewBox="0 0 1000 300" version="1.1"
     xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <path id="Wave"
          d="M 100 200 
             C 200 100 300   0 400 100
             C 500 200 600 300 700 200
             C 800 100 900 100 900 100" />
    <path id="Circle" d="M100 100 A 200 200 0 0 0 500 100 L500 70" />
    <path id="Line" d="M100 100 L 900 100"/>
  </defs>

  <use xlink:href="#Wave" fill="none" stroke="red" stroke-width="2" />
  <use xlink:href="#Circle" fill="none" stroke="red" stroke-width="2" />
  <use xlink:href="#Line" fill="none" stroke="red" stroke-width="2" />

  <text font-family="Verdana" font-size="40" fill="blue" >
    <textPath method="stretch" xlink:href="#Wave" startOffset="100px">
      We go
      <tspan dy="-20" fill="red">up</tspan>
      <tspan dy="20">, then we go</tspan>
      <tspan dy="20" fill="red">down</tspan>
      <tspan dy="-20">, then up again</tspan>
    </textPath>
  </text>

  <text font-family="Verdana" font-size="40" fill="blue" text-anchor="middle">
    <textPath method="stretch" xlink:href="#Circle" startOffset="50%">Circle-Circle</textPath>
  </text>

  <text font-family="Verdana" font-size="40" fill="blue" >
    <textPath xlink:href="#Line" startOffset="50%">Line</textPath>
  </text>
</svg>
Comment 1 Emmanuele Bassi (:ebassi) 2014-03-03 11:06:14 UTC
Review of attachment 270767 [details] [review]:

thanks for the patch, and for working on this feature.

I'm not a librsvg hacker or maintainer, but by looking at your patch I have to say that you should really try to conform to the coding style of the project.

for instance, you should (consistently) leave a space between function name and parenthesis, as well as a space between `if` and the condition. also, you inconsistently use `{}` braces around single-statement if's.

consistent coding style makes reviewing patches a lot easier, and maintaining code a lot saner.

again, thanks for the patch.

::: rsvg-text.c
@@ +60,3 @@
+    RsvgLength startOffset;
+    gboolean stretch;		/* true=stretch, false=align */
+    RsvgNode super;

I would not use two booleans here. I would probably use a bitmask instead, something like:

    guint32 flags;

and:

    enum {
      TEXT_NODE_METHOD_STRETCH = 1 << 0,
      TEXT_NODE_METHOD_ALIGN   = 1 << 1,
      TEXT_NODE_SPACING_AUTO   = 1 << 2,
      TEXT_NODE_SPACING_EXACT  = 1 << 3
    };

this should allow easier expansion in case future options get added.
Comment 2 André Klapper 2015-02-15 19:47:41 UTC
Mika: Any plans to rework the patch, based on ebassi's review?
Comment 3 GNOME Infrastructure Team 2017-12-13 18:02:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/87.