Skip to main content
Participating Frequently
August 1, 2016
Resuelto

Why won't my script resize the font to size 13?

  • August 1, 2016
  • 1 respuesta
  • 1546 visualizaciones

I have JavaScript code that is supposed to change the font size for all text boxes. I want to resize the font to size 13. The text boxes range from size 4.76 to size 10.49. Right now, the script only changes them to size 12 or 14 (or anything that isn't 13).

  1. var myDocument = app.activeDocument; 
  2.  
  3.  
  4. var tfs = myDocument.textFrames; 
  5. var n = tfs.length; 
  6.  
  7.  
  8. for ( i = 0 ; i < n ; i++ ) { 
  9.           tfs.textRange.characterAttributes.textFont = app.textFonts.getByName("BebasNeue");  
  10.           tfs.textRange.characterAttributes.size = 13; //nothing happens during this stage unless I change 13 to 14 

Thanks in advance for any help.

Este tema ha sido cerrado para respuestas.
Mejor respuesta de Silly-V

Weird indeed! By the way, how do you import the XML files into your pie charts? Is there one chart per document, or multiple ones?

Well, can you try to set their font to be another font, and set  ​that​ to 13 and then change back to Bebas?

1 respuesta

Silly-V
Brainiac
August 1, 2016

I wonder what's going on, because this does work for me- except I do not have this font.

Participating Frequently
August 2, 2016

Wow, weird. You're right. It works with every font other than Bebas Neue...

Maybe this will help. Background: all the text boxes are attached to pie charts, which have been made into variables. I update the variables routinely by importing an XML file (which updates the data in the pie charts). Whenever I import the XML, though, the font size changes to 10.9. Even though the document's default font is set to Bebas Neue 13 pt.

So I then manually ungroup everything in the document, which turns the variables into text boxes that I can call with this script.

Silly-V
Silly-VRespuesta
Brainiac
August 2, 2016

Weird indeed! By the way, how do you import the XML files into your pie charts? Is there one chart per document, or multiple ones?

Well, can you try to set their font to be another font, and set  ​that​ to 13 and then change back to Bebas?