Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Up ?
Copy link to clipboard
Copied
Uups. I've tested it some times (cs3) (but forgot to answer)
No Problems.
Works perfect.
Chris
Copy link to clipboard
Copied
Many thanks Chris
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi Eva,
Thanks for your report. I will check that today.
Art.chrome
Copy link to clipboard
Copied
Hi Eva,
First thanks for your report.
But i need more informations to reproduce this error and correct it.
At this moment, i can't reproduce it . So please could tell me when this error happend, which differencies between works files and no-works files ?
Thanks in advance, art.chrome
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi,
evacompany wrote:
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
Finally, i didn't find any issue satisfactory
If anyone find a fix for this, please advise me
art.chrome
Copy link to clipboard
Copied
if i run it a second time i got an error "name is limited to 63...."
just to top the confusion
(but, as eva, no delete error)
can't you catch the delError, Art?
something like that:
fun del():
for i in symbols
try delete
catch continue
while symbols.length>0: del()
Copy link to clipboard
Copied
Hi Chris,
chris gebab a écrit:
can't you catch the delError, Art?
Yes, i can, no problem for me (it seems problem come from eva ).
But real problem it's not here.
How to vectoriz (i mean createoutline) "AB" which is include in "A". because when "A" is vectorized , link is lost for "AB" but this included "A" isn't vectorized, same for "ABC".
So..
1) need to know which symbol contains another symbols (we can know if we duplicate on new document, for one duplicated symbol, there will be all included symbol in panel symbol)
2) vectorize each symbols and respect each links (here the problem)
3) return to previous document, replace symbols
4) replace each symbolsItems by the news ones
it seems a true factory !
An idea ?
art.chrome
Copy link to clipboard
Copied
var ad = app.activeDocument , sy = ad.symbols, si = ad.symbolItems ;
// var s_a = sy.getByName("a")
// var s_ab = sy.getByName("ab")
// var s_abc = sy.getByName("abc")
// symbolItems are placed in doc
function hasSym(sym){
var tempS = sym.duplicate();
var tempSI = si.add(tempS);
tempSI.selected=true ;
tempS.remove();
app.redraw();//?
tempSI = ad.selection[0] ;
if(tempSI.symbolItems.length>0) {
tempSI.remove()
return true ;//step2: maybe with tags here?
// var ret=[];
// for(i in tempSI.symbolItems){
// ret.push( tempSI.symbolItems.symbol.name )
// }
}else{
tempSI.remove()
return false
}
}
var syLen = sy.length;
for(i=0;i<syLen;i++){
if( hasSym( sy ) == false){
// vectorize
alert( sy.name )
}
}
for step 1 this alerts only on a, not on ab, abc
2) dont know, best would be to start on the deepest level (a), and then relink the (new)symbol "a" in the (vectorized/expanded)SymbolItem of "ab", and so on ?
???
chris
Copy link to clipboard
Copied
Hi Chris,
I get an error (undefined)
if(tempSI.symbolItems.length>0) {
tempSI.remove()
return true ;
when tempSI.symbolItems.length>0
I'm so tired with this script , i've some difficulties to represente to me the right process and understand your reasoning.
also i tried to enforce escape error an reloop VectorizSymbol(), but this time objects move (position) inside symbols ARRRGGGG!!
Too many possibilities and each one with a piece of others problems .. So tired i said ..
So.. from my part, i will put this project in standby, take some holidays , and maybe try again after
Many thanks for your efforts Chris
art.chrome
...who's need holidays