Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
Extendsript - Adobe Illustrator - Cambiar la familia de fuentes/estilo de caracteres para cada palabra dentro de TextFrame

Soy nuevo en IA y secuencias de comandos. Tengo una plantilla con la que estoy empezando. Dentro de esta plantilla, hay un TextFrame (llamado CITIES_1). Aquí dentro hay un texto de plantilla como:

CIUDAD 1 123 Dirección Rd. MiCiudad, MiEstado MiZip

CIUDAD 2 567 Dirección Rd. MiCiudad2, MiEstado2 MiZip2

El encabezado CITY 1 es Helvetica Neue LT Std / 75 Bold El resto de la información es Helvetica Neue LT Std / 55 Roman

Estoy tratando de cambiar dinámicamente este contenido a la información de la ciudad que tengo en un archivo.

Intenté cambiar TextFrame.contents pero usa la primera familia/estilo de fuente para todo. ¿Alguna idea sobre cómo cambiar los datos manteniendo el mismo "formato"?

¡TIA!

 var helBold = app.textFonts.getByName("HelveticaNeueLTStd-Bd"); var helRoman = app.textFonts.getByName("HelveticaNeueLTStd-Roman"); var bold = myDoc.characterStyles.add({ name: "HelveticaNeueLTStd-Roman" }); var roman = myDoc.characterStyles.add({ name: "HelveticaNeueLTStd-Roman" }); var currTF = templateLayer.textFrames.getByName("CITIES_1"); currTF.contents = "MYCITY\r123 MyAddress Dr.\rMyCity, ST 12345\r555.555.5555\r"; bold.applyTo(currTF.words[1]);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

De su código, supongo que tiene un nombre de ciudad en cada segunda fila (comienza desde la primera fila):

MI CIUDAD

123 Mi dirección Dr.

MiCiudad, ST 12345

555.555.5555

Y desea aplicar algo de estilo en cada primera palabra de cada segunda fila. Algo como esto:

MI CIUDAD

123 Mi dirección Dr.

MiCiudad , ST 12345

555.555.5555

Se puede hacer con este código:

 var doc = app.activeDocument; // pick the text frame and fill it with the text var curTF = doc.pageItems.getByName('CITIES_1'); curTF.contents = 'MYCITY\r123 MyAddress Dr.\rMyCity, ST 12345\r555.555.5555'; // make two styles var roman = make_style('roman', 'ArialMT', 10); var bold = make_style('bold', 'Arial-BoldMT', 14); // apply style 'roman' on the text roman.applyTo(curTF.textRange, true); // loop through the text and apply the style 'bold' // on the first word of every second paragraph var paragraphs = curTF.textRange.paragraphs; for (var i = 0; i < paragraphs.length; i += 2) { bold.applyTo(paragraphs[i].words[0], true); } function make_style(style_name, font_name, size) { var doc = app.activeDocument; try { var style = doc.characterStyles.add(style_name) } catch(e) { var style = doc.characterStyles.getByName(style_name) } style.characterAttributes.size = size; style.characterAttributes.textFont = textFonts.getByName(font_name); return style; }

Producción:

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!