Copy link to clipboard
Copied
The text in my illustrations usually exports as a complete mess in SVG - our developers need something cleaner. i.e. instead of getting something like this:
I usually get a mess like this:
One possible cause of this is nonstandard kerning. Is your type set to something other than 'Metrics'?
What about clearing appearance rather than trashing the fill?
Copy link to clipboard
Copied
One possible cause of this is nonstandard kerning. Is your type set to something other than 'Metrics'?
Copy link to clipboard
Copied
Actually, we need to set it to zero - but you're right inasmuch as it wasn't set to zero, but "auto".
But how can I get "<text id="blah blah"> - currently illustrator SVG export always wraps text in a "<g>" group and names that instead. Our (custom) application that takes our SVGs expects the text to get the ID (as is specified in my illustrator files), not a group (which is non-existent in the illustrator original).
Copy link to clipboard
Copied
I get non-split text objects when using Metrics.
Are you using Save As or Export? What settings? Using 'Layer names' as object ID adds those <g> elements.
Copy link to clipboard
Copied
Just testing options -- if I name the text objects, I get SVG <text> elements with those names as IDs. Still in <g> elements for the layer though.
Copy link to clipboard
Copied
Hmmm... I get the same on a test file too:
Copy link to clipboard
Copied
Looks to me like if you leave the layer names default (i.e. 'Layer 1'), rename the individual text objects, and use Layer Names as Object ID in SVG export objects, you get <text> elements with the IDs as named in the file, and no <g> elements.
Copy link to clipboard
Copied
It seems to be something in the graphic styles.
If I paste some text from the offending file into a test file, I still get <g> ID's. However, if I merely apply the bland "Lorum Ipsum" test style to the pasted text, I get <text> IDs.
I am currently deleting parts of the graphic style to see if I can identify the culprit.
Copy link to clipboard
Copied
OK - I have now got a repeatable example:
1. Create a new Illustrator file:
2. Using the text ("T") tool, click anywhere on the artboard to create "Lorum Ipsum"
3. In the Character properties panel, change the Kerning from "Auto" to "0":
4. In the layers panel, rename it to "Example Text" (this step is important):
5. Now export as an SVG and see sow the ID is associated with the <text> section (this is what we want):
So far, so good... But now, this is where it goes wrong...
6. Now add a new fill from the menu on the Appearance properties panel:
7. Next, immediately press the Trashcan icon in the appearance panel to delete that new fill that you added:
8. Theorectically, you are now back at step 5 - however, when you perform the export, you'll see now it has gained a group, and it is that group which receives the ID:
I've not found a manual way to reset things to step 5, other than by creating a style from freshly-made text, and applying it to the offending item.
Copy link to clipboard
Copied
What about clearing appearance rather than trashing the fill?
Copy link to clipboard
Copied
Yes, that works - the ID goes back into a <text> element.
Thanks for the suggestion!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now