Skip to main content
artchrome
Inspiring
June 16, 2010
Question

createOutline in symbol

  • June 16, 2010
  • 3 replies
  • 3129 views

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

This topic has been closed for replies.

3 replies

Participant
July 9, 2010

Hi artchrome,

I find something interesting by your script, please take a look.

on the left side I make 3 symbols,

the first one is a editable text "A",convert to a symbol, named "A"

the second is symbol "A" + editable text "B",named "AB"

the third is symbol "AB" + editable text "C",named "ABC"

then run your script(finished without error)

not all fonts change to outline.

I guess making a symbol with another symbol inside is not ok.

Eva

artchrome
artchromeAuthor
Inspiring
July 9, 2010

Eva,

Many thanks for this , and it's curious that your trail doesn't return an error (like as below)

I found something like that ( make a symbol with two others).. my script return error (on CS4) :

Error: an Illustrator error occurred: 558130540 ('!Del')

In fact it can't delete symbol because it's used inside in another one.. grrr..

So my problem now, it's that i can't know if an symbol is used by another one.

Hmm.. i thinking about your missing error, really curious... i though to use errors to put symbol (which is maded error) in standby, continues process and finally re-try with symbol in standby.. but if really your CS3 doesn't return error.. i can't use this way.

I will try another way this afternoon

Thanks,

art.chrome

Participant
July 9, 2010

HI, thanks for your script, I search for outline fonts in symbol and brings me here.

I usually outline all fonts before passing the file to the printer, that's make sure they don't have the missing font problem.

but I found the create outline can't change the fonts used inside symbol, that makes the problem.

I am CS3 and working on some Chinese fonts in symbols.

I tried the script, some works and some failed,

these are the error message:

Error 1200: ana illustrator error occurred:

1346458189('PARM')

Line: 20

-> Ssource.remove(); //remove original

symbol

Thanks.

Eva

artchrome
artchromeAuthor
Inspiring
July 9, 2010

Hi Eva,

Thanks for your report. I will check that today.

Art.chrome

artchrome
artchromeAuthor
Inspiring
June 29, 2010

Up ?


Inspiring
June 29, 2010

Uups. I've tested it some times (cs3) (but forgot to answer)

No Problems.

Works perfect.

Chris

artchrome
artchromeAuthor
Inspiring
June 29, 2010

Many thanks Chris