Chris Andert
My feedback
2 results found
-
18 votesChris Andert supported this idea ·
An error occurred while saving the comment -
1 vote
An error occurred while saving the comment Chris Andert commentedUse a for loop on this action:
app.activeDocument.textFrames[i].contents = "LOL";
Unless the command for this is hidden from me, I cannot seem to find a solution to this age-old problem.
Where I work, I need the three following things to be true:
1) Create an SVG that preserves editing capabilities thereby eliminating the need for more than one file. So, only one SVG file, and not an AI + SVG file.
2) The fonts within that SVG must not break when displayed in a browser. The infamous "ArialMT" problem.
3) Must not require a find-and-replace action to correct the font after the export. All actions must be done in Illustrator.
There are currently two methods of export. Both have their pros and cons.
File > Save As:
Text and shapes are editable as expected; Styles are not separated into new layers.
File > Export > Export As:
Fonts render correctly in browser
Neither option above works for me. “Save As” preserves editing capabilities, but fonts break (“Arial” becomes “ArialMT”). Conversely, “Export As” renders fonts correctly (font-family: ArialMT, Arial;), but wrecks editability.
So I turned to Scripting (JS).
I can set all the ExportOptionsSVG() options I want. This includes:
var svgSaveOpts = new ExportOptionsSVG();
svgSaveOpts.preserveEditability = true;
However, fonts still break.
Next I targeted ArialMT fonts.
var thisFont = app.activeDocument.textFrames[0].textRange.characterAttributes.textFont;
if(thisFont.name == 'ArialMT'){
app.activeDocument.textFrames[0].textRange.characterAttributes.textFont = app.textFonts['Arial']; // throws error
}
"textFonts[]" only accepts the postscript name of the font, which is what “Arial” throws an error.
Is there a way to mimic the export method used in “Export As” which renders fonts correctly AND preserves editing capabilities?