Skip to main content
Participant
August 10, 2010
Answered

Basic font help, Times New Roman, Bold

  • August 10, 2010
  • 1 reply
  • 3236 views

Im tying to change the font of my text to "Times New Roman", but get an error in my code every time I do.  I am doing something like this

textbox.TextRange.CharacterAttributes.TextFont = "Times New Roman"

textbox.TextRange.CharacterAttributes.style = bold

textbox.TextRange.CharacterAttributes.fillcolot = black

textbox.TextRange.CharacterAttributes.style = italic

I know this is wrong but havent found help simple enough to explain how to do something so elementary.  I have spent a very long time looking!

This topic has been closed for replies.
Correct answer Muppet_Mark-QAl63s

There is NO 'textbox' in Illustrator its a 'textFrame' also most properties are 'camelCase' in JavaScript so you do need to be case sensitive… Plus you have a spelling error or two. You use a fonts postscript name not the user friendly GUI one…

1 reply

artchrome
Inspiring
August 10, 2010

Hi,

There are many threads about fonts, so this one could help you.

Also becarefull, font name and file name of font should be different.

Regards, art.chrome

Muppet_Mark-QAl63s
Muppet_Mark-QAl63sCorrect answer
Inspiring
August 10, 2010

There is NO 'textbox' in Illustrator its a 'textFrame' also most properties are 'camelCase' in JavaScript so you do need to be case sensitive… Plus you have a spelling error or two. You use a fonts postscript name not the user friendly GUI one…

Participant
August 10, 2010

Here is my code for that section so far... but for some reason it does not work...any suggestions?

Set textbox = docRef.TextFrames.Add()

            textbox.TextRange.CharacterAttributes.Size = 28
            textbox.Contents = currentWord
            dblWidth = textbox.Width
            dblHeight = textbox.Height
           
            textbox.TextRange.CharacterAttributes.TextFont = app.TextFonts.Item(TimesNewRomanPS - BoldMT)