createOutline in symbol
Hi All,
I've maked a script to create outline text included in symbol:

Below the script:
#target illustrator
var doc=activeDocument;
VectorizSymbolAll(doc);
//************************* functions for Vectorise Symbol ********************************//
function VectorizSymbolAll(Sfile){
var SLen=Sfile.symbols.length-1;
for (si=SLen;si>-1;si--){VectorizSymbol(Sfile.symbols[si]);}
return true;
}
function VectorizSymbol(Ssource){
var a=UnlinkSymbol(Ssource); // unlink
gpOutline(a); // create outline for text
var Scopy=Ssource.parent.symbols.add(Ssource.parent.layers.getByName(a.name).groupItems[0]); //make copy of symbol
Scopy.name="Vect of "+Ssource.name; // name it
Ssource.parent.layers.getByName(a.name).remove(); // remove temp layer
replaceSymbol(Ssource,Scopy); // exchange them
Ssource.remove(); //remove original symbol
}
//******************************//
function UnlinkSymbol(symb){
var Ltemp=symb.parent.layers.add()
Ltemp.name="temp"+Math.random(1)*100000; // useless
var D=symb.duplicate();
Ltemp.symbolItems.add(D);
D.remove()
return Ltemp;
}
//******************************//
function gpOutline (groupRef) {
var textItemsList = new Array();
if (groupRef.groupItems.length > 0) {
for (var i = 0 ; i < groupRef.groupItems.length; i++) {
var theGroupItems = (gpOutline (groupRef.groupItems));
for (var j = theGroupItems.length -1; j> -1; j--) {theGroupItems.createOutline();}
}
}
if (groupRef.textFrames.length > 0) {
for (var i = 0 ; i < groupRef.textFrames.length; i++) {groupRef.textFrames.createOutline();}
}
if (groupRef.legacyTextItems.length > 0) {
for (var i = 0 ; i < groupRef.legacyTextItems.length; i++) {
var theTextFrame = groupRef.legacyTextItems.convertToNative()
theTextFrame.createOutline();
}
}
return textItemsList
}
//******************************//
function replaceSymbol(S,C){
for (i=S.parent.symbolItems.length-1;i>-1;i--){if (S.parent.symbolItems.symbol==S){S.parent.symbolItems.symbol=C}}
}
//************************* End of function for Vectorise Symbol ********************************//
It seems works perfectly, but once time, it return an error (i don't remember which.. sorry), and now i'm unable to reproduce it ![]()
So if anyone can test / martyrize / stress this script and report me any error / mistake / malfunction / a lapse of memory, i will be happy
.
Many thanks at all,
art.chrome
