Quitter
  • Communauté internationale
    • Langue:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

How to outline text in illustrator scripting

Invité
Apr 16, 2015 Apr 16, 2015

I want to create storke in text in illustrator scripting and found one method too createoutline(),But How i used this method for text outline.

SUJETS
Scripting
4.4K
Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Adobe
Engagé ,
Apr 17, 2015 Apr 17, 2015

#target illustrator


var idoc = app.activeDocument;

var tf = idoc.textFrames;


for ( t = tf.length-1; t >= 0; t-- ) {

  var text = tf;

  text.createOutline();

}


alert ( "All text converted to outlines." );

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Invité
Apr 21, 2015 Apr 21, 2015

Yeah, i used like this. its creating outline but replace text frame to outline .I need textframes and outline both having different colors.

Thanks in advance

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Engagé ,
Apr 22, 2015 Apr 22, 2015

Then I suppose you could use:

a for loop to select all of the text items.

app.executeMenuCommand ('copy')

menu command deselect all

the previous for loop to create outlines

menu command past in front

Changing the color of text is a pain in script but you can find an example in this post SpotColor to GrayColor converter (javaScript) starting at line 82 in the script.

Good luck

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines
Contributeur ,
May 11, 2015 May 11, 2015
LA PLUS RÉCENTE

var docRef = app.activeDocument;

var colorForText = new CMYKColor();

    colorForText.black = 0;

    colorForText.cyan = 0;

    colorForText.magenta = 0;

    colorForText.yellow = 0;

   

var colorForTextOutline = new CMYKColor();

colorForTextOutline.black = 100;

colorForTextOutline.cyan = 0;

colorForTextOutline.magenta = 0;

colorForTextOutline.yellow = 0;

var outlineSize = 5;

for (i = docRef.textFrames.length-1; i >=0; i--) {

   

    for (j = 0; j < docRef.textFrames.words.length; j++){

        docRef.textFrames.words.filled = true;

        docRef.textFrames.words.fillColor = colorForText;

    }

   

var outline = docRef.textFrames.duplicate(docRef, ElementPlacement.PLACEATEND);

    for (h = 0; h < outline.words.length; h++) {

        outline.words.filled = true;

        outline.words.fillColor = colorForTextOutline;

        outline.words.stroked = true;

        outline.words.strokeColor = colorForTextOutline;

        outline.words.strokeWeight = outlineSize;

       

        }

//docRef.textFrames.createOutline();

//outline.createOutline();

    }

createOutline(); converts live text to outlines, if you are trying to just create a stroke you have to go about it a different way. This script will take the text and copy it, put it in back, and put a stroke behind on the behind text so it has an effect similar to an offset path. The way I have it leaves the text live, if you were wanting to convert the text to outlines as well I left that part written in the bottom of the script. There is also a StrokeJoin parameter as well.

Hope this helps!

Traduire
Signaler
Directives de la communauté
Restez bienveillant et courtois, ne vous attribuez pas la paternité des créations d’autrui et assurez-vous de l’absence de doublons avant de poster du contenu. En savoir plus
community guidelines