svgObjectModelGenerator icon indicating copy to clipboard operation
svgObjectModelGenerator copied to clipboard

Text on path not working

Open dirkschulze opened this issue 10 years ago • 9 comments

With Generator 1.2.0 text on path is not working anymore. The segment coordinates were stored in number values but changed to objects with the number value as property and a unit as string.

This effects the test text-on-path

dirkschulze avatar Jan 14 '15 14:01 dirkschulze

I tried latest master and either I didn't set it up correctly or it's not working. my testfile https://drive.google.com/a/601t.com/file/d/0B1M3zV5eEym9OVlvdk5nNk1mdTg/edit (change from PNG to SVG when exporting) this is what I'm getting in SVG file:

watson bug 3833730

imaderyc avatar Jan 14 '15 20:01 imaderyc

Looks like you have the commit before the last commit. I did not try with Crema but I get something meaningful:

<path id="text-path-1" d="M640,702c0,0,31.488,123.117,180.175,48.961S1008,802,1008,802"/>
<path id="text-path-2" d="M1019,701a63,63,0,0,0-63,63Z"/>

dirkschulze avatar Jan 14 '15 21:01 dirkschulze

while testing this, noticed another case of text on path not working correctly which seems different from original issue; I'm getting zero-bytes SVG files when exporting from one file. https://watsonexp.corp.adobe.com/#bug=3921139

imaderyc avatar Jan 15 '15 00:01 imaderyc

Irina's test case 1 isn't rendering quite right for me as well: screen shot 2015-01-15 at 12 00 43 pm screen shot 2015-01-15 at 12 01 14 pm

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="145" height="126" viewBox="0 0 145 126">
  <defs>
    <style>

      .cls-2, .cls-4 {
        font-size: 36px;
      }

      .cls-4 {
        fill: #226b26;
        font-family: "Optima-ExtraBlack";
      }
    </style>

    <path id="text-path-1" d="M1019,701a63,63,0,0,0-63,63Z"/>
  </defs>
  <text class="cls-2"><textPath xlink:href="#text-path-1">
    <tspan class="cls-4">text on a path</tspan>
  </textPath></text>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" width="223" height="71" viewBox="0 0 223 71">
  <defs>
    <style>

      .cls-2, .cls-4 {
        font-size: 36px;
      }

      .cls-4 {
        fill: #226b26;
        font-family: "Optima-ExtraBlack";
      }
    </style>

    <path id="text-path-1" d="M640,702c0,0,31.488,123.117,180.175,48.961S1008,802,1008,802"/>
  </defs>
  <text class="cls-2"><textPath xlink:href="#text-path-1">
    <tspan class="cls-4">text on a path</tspan>
  </textPath></text>
</svg>

Seems like the path points are positioned relative to the original doc, not the new asset bounds.

mvujovic avatar Jan 15 '15 20:01 mvujovic

Regarding Irina's second test case 2, two of the layers throw some JS errors in the console for me:

[info:crema 12:08:32.596 rendermanager.js:157:30] RenderManager active
[info:crema 12:08:32.612 rendermanager.js:179:26] Rendering: Text on Path.svg (2;1)
[info:crema 12:08:32.896 rendermanager.js:179:26] Rendering: Plain text.svg (1;2)
[info:crema 12:08:32.911 rendermanager.js:179:26] Rendering: more path text.svg (0;3)
Ex: TypeError: Cannot read property 'right' of undefined
TypeError: Cannot read property 'right' of undefined
    at SVGWriterPreprocessor.shiftBounds (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:258:52)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:367:22)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:381:26)
    at Array.forEach (native)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:379:26)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:381:26)
    at Array.forEach (native)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:379:26)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:381:26)
    at Array.forEach (native)
GET /extractasset/258/3/0/Text%20on%20Path.svg?v=1 200 2ms
GET /extractasset/258/4/1/Plain%20text.svg?v=1 200 1ms
Ex: TypeError: Cannot read property 'right' of undefined
TypeError: Cannot read property 'right' of undefined
    at SVGWriterPreprocessor.shiftBounds (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:258:52)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:367:22)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:381:26)
    at Array.forEach (native)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:379:26)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:381:26)
    at Array.forEach (native)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:379:26)
    at SVGWriterPreprocessor.processSVGNode (/Users/mvujovic/Code/svgObjectModelGenerator/svgWriterPreprocessor.js:381:26)
    at Array.forEach (native)
[info:crema 12:08:34.393 rendermanager.js:191:38] RenderManager idle

mvujovic avatar Jan 15 '15 20:01 mvujovic

@mvujovic I can not reproduce it when generating the SVG for the whole document. It passes just fine. Maybe it happens when Crema tries to get the layer data of a specific layer. Then omIn._parentBounds might either not be an object or does not have the property. I'll upload the Generator file in a separate pull request so that we can test it.

dirkschulze avatar Jan 15 '15 21:01 dirkschulze

@imaderyc I and @mvujovic opened new bug reports for all the unrelated issues that were mentioned in this bug. Apparently the path is created properly for @mvujovic with Crema. Could you try to set up Crema again please?

dirkschulze avatar Jan 15 '15 22:01 dirkschulze

I'm exporting single layer, not entire document.

imaderyc avatar Jan 15 '15 23:01 imaderyc

can't reproduce the issue with 'ZZZZZ' in path anymore (not sure what 'fixed' it because I'm using the same build/same setup)

but text is still not rendered correctly in SVG file; path seems correct (numbers, not 'z' anymore), but when previewing in Crema or Browser, text is not shown (same as screenshot mvujovic posted above)

imaderyc avatar Jan 23 '15 18:01 imaderyc