Change font in Illustrator cs4 js

I need to assign specific font to my text and it doesn't work. What am I doing wrong:
var my_OUTSIDE_TextFrame = myInstrLayer.textFrames.add();
my_OUTSIDE_TextFrame.geometricBounds = ["1.6 in", "1 in", "1.85 in", "2.75 in"];
my_OUTSIDE_TextFrame.contents = "OUTSIDE";
var myParagraph = my_OUTSIDE_TextFrame.paragraphs.item(0);
try{
myParagraph.appliedFont = app.fonts.item("Myriad Pro");
catch(e){}
try{
myParagraph.fontStyle = "Bold";
catch(e){}
myParagraph.pointSize = 30;
And it's not placing it where I want it either.
Thank you very much for your help.
Yulia

Hi yulia,
i maked some changes on your script:
- what is it item(0) instruction ??
use instead paragraphs[0]
- moreover you can use fontStyle.. it doesn't exist , it's textFont.stye but only for read, you can't assign "bold" or other style...
to put a differents style, you need to attribute when you call the font name "MyriadPro-Bold".
(** to obtain exact name you need, i have attritube first manually, and check his name with myParagraph.characterAttributes.textFont.name, to be sure avoid error name OR use my second script below**)
- you use paragraphs instruction, but i'm not sure that is really usefull, because you have created a text first and you can thus include your properties (font name and style) exept if you envisaged to change font before a paragraphs
- what is it pointSize ? doesn't exist also.. simply use size if you want change the size of textFont
For this remark, i recommande you to see this post
now, below an updated of your script
#target illustrator
var doc=app.activeDocument;
var myInstrLayer=doc.layers.add();
var my_OUTSIDE_TextFrame = myInstrLayer.textFrames.add();
my_OUTSIDE_TextFrame.geometricBounds = ["1.6 in", "1 in", "1.85 in", "2.75 in"];
my_OUTSIDE_TextFrame.contents = "OUTSIDE";
var myParagraph = my_OUTSIDE_TextFrame.paragraphs[0];
try{
myParagraph.characterAttributes.textFont=app.textFonts.getByName("MyriadPro-Bold");
catch(e){alert(e)}
myParagraph.characterAttributes.size = 30;
Also for 1$ more* i can propose you (for CS4) the same with drop down list below:
#target illustrator
var doc=app.activeDocument;
var myInstrLayer=doc.layers.add();
var my_OUTSIDE_TextFrame = myInstrLayer.textFrames.add();
my_OUTSIDE_TextFrame.geometricBounds = ["1.6 in", "1 in", "1.85 in", "2.75 in"];
my_OUTSIDE_TextFrame.contents = "OUTSIDE";
var myParagraph = my_OUTSIDE_TextFrame.paragraphs[0];
try{
var ressource="dialog { text: 'Font List'}";
var item=new Array();
var dlg=new Window(ressource);
var dd=dlg.add('dropdownlist',undefined);
for( j=app.textFonts.length-1;j>-1;j--){dd.add('item',app.textFonts[j].name); }    
dlg.btnRND=dlg.add('button',undefined,'Choose this font.',{name:'ok'});
dlg.btnCANCEL=dlg.add('button',undefined,'Cancel',{name:'cancel'});
dlg.show();
for (k=dd.items.length-1;k>-1;k--){
if (dd.items[k].selected){myParagraph.characterAttributes.textFont=app.textFonts.getByName(dd.items[k])}    
catch(e){alert(e)}
myParagraph.characterAttributes.size = 30;
See you, art.chrome
* this is a joke, i didn't ask for money !

Similar Messages

  • Changing defaults in Illustrator CS4

    Hey folks... this was easier in CS1 and previous, but I was curious as to how to change defaults in Illustrator CS4? For example, I've customized my brush library and want to replace whatever the default brush file is with my customized brush file (for now, called, interestingly enough, brushes.ai) Where is the location of the (default brushes) file? Thanks!

    You can place your custom created files to the location
    \Program Files\Adobe\Adobe Illustrator CS5\Presets\en_US\Brushes

  • How can I use my fonts in Illustrator (CS4) without Suitcase?

    How can I use my fonts in Illustrator (CS4) without Suitcase? InDesign has a fonts folder, but not Illustrator.

    i found this info from this link: http://forums.adobe.com/message/3466307.  The user who asked this question stats this solution worked for them.
    First in Language and text preferences in the system preferences select Hebrew as the input method.
    The in Illustrator click the text tool in your document or drag to create a text frame.
    While the cursor is active select a hebrew font
    then go to the menu bar for the finder and where there is the American Flag pull it down and select hebrew
    now go back to the document and start typing.
    Remember if you do not have the ME version you have to have it flush right and type backwards.

  • Problem scrolling fonts in Illustrator CS4

    Hi- I've had issues from day 1 using AI CS4.  When I am deciding on a font style, I highlight the text, then click on the font type and scroll through the fonts.  Then I will encounter 2 problems:
    1. Some fonts won't let me continue to scroll.  It stops at that specific font.  I have to manually go back to the font drop down list and change the type.  OR
    2.  When I am scrolling, it automatically takes me to the end of the font list w/ some weird fonts like Adobe 楷体 Std R.
    Any idea how I can fix this?

    You have a bad font somewhere inbetween that messes up the font handling. Remove any suspicious fonts you recently added and do not permanently need (e.g. free fonts that may technically suffer some issues like open contours etc.) and delete your AdbeFnt.list files so they get rebuilt next time you start an Adobe app.
    Mylenium

  • Missing Fonts in Illustrator CS4

    I have been having an issue with the "missing font"
    My problem is that Illustrator recognizes the fonts sometimes and not other times.  I have had no problems for the past week or so and I just restarted my computer and now a number of fonts that worked fine suddenly are replaced with the "missing font" default.
    The fonts I'm currently concerned with are all in the default LaTeX family (i.e. cmr10, cmmi10, cmbx10, etc...) I have all of them installed on my computer and they work fine in every other application. 
    Does anyone have any idea what is going on or how I can solve this problem?  Why does illustrator "lose" them and how do I get them back? !!
    Thanks!

    Thanks for the link.  I'm actually using Windows 7 and in the mean time my illustrator "found" the fonts again (still can't figure out why).  I don't know how well the solutions for the Mac OS will work but I'll take a look.  If anyone else comes up with an answer I'd love to hear it!
    Thanks!

  • Fonts in illustrator CS4

    Hi I have a particular font that doesn't work in illustrator but it does in other applications.
    I cleared the font cache and resolved duplicates.
    Thanks in advance

    Contact Adobe. Do give them the name of the font.

  • Illustrator CS5.1 crashes when changing fonts

    Hoping someone can please help!! Every time I try to change fonts in Illustrator CS5.1, without fail it crashes. I'm on a macbook pro with retina display, OSX 10.9.4 and I have tried uninstalling then reinstalling the program and downloading the Adobe patches but my computer won't accept them. I've tried deleting the Illustrator preferences as well but nothing seems to work. PLEASE HELP?!!

    dezine,
    In serious cases requiring reinstallation, you should also use the Cleaner Tool, see 6) below.
    But it may be something with fonts/font caches, see  Items 1) and 11) in the link in 5) below; these may be the most probable causes.
    The following is a general list of things you may try when the issue is not in a specific file (you may have tried/done some of them already); 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
    1) Close down Illy and open again;
    2) Restart the computer (you may do that up to 3 times);
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
    4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible);
    5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
    Even more seriously, you may:
    6) Uninstall, run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • Problem with embedding fonts in Illustrator CS5

    I have just installed Illustrator CS5, and have tested creating a PDF document based on one of my existing files, as well as a new file.
    When I open these PDF documents in Adobe Acrobat Pro 9, I am told that Acrobat cannot access one of the embedded fonts (Korinna BT).
    I have had no issues with embedding this font in Illustrator CS4, and (strangely), when I open these files in other PDF viewers (Preview and PDFPenPro), they report no issues.
    Has anyone else experienced this issue?
    I have removed and reinstalled the font in question, and tested/verified that the font is OK - but still not joy.
    Regards
    Jeremy

    The error message I get is:
    "Cannot extract the embedded font 'MVZTIW+KorinnaITCbyBT-Regular'. Some characters may not display or print correctly."
    When I check the fonts in the PDF in "Document Properties" in Adobe Acrobat the following is shown:
    "KorinnaITCbyBT-Regular
         Type: TrueType
         Encoding: Ansi
         Actual Font: Adobe Serif MM
         Actual Font Type: Type 1"
    It seems that Illustrator is adding some strange "code" ('MVZTIW') to the beginning of the font, which means the actual font can't be found and extracted.

  • Illustrator CS4 can´t sometimes use some fonts

    Hello I have a strange issue with illustrator CS4 under Adobe Creative Suite CS4 Design Premium, which is driving me really crazy. If I am trying to write some text using for example Titilium Font, Olijo or some other ttf and otf fonts, I can see them in font selection, but whe I change to them Illustrator automaticaly switch to Myriad Pro. Few minutes ago I have sucesfully written a text with Olijo font then I restarted computer and Illustrator refused to use the font next time. I do not know what is causing it because other programs Word, Excel, Photoshop, InDesign, Flash can use them font without any problems. This issue is happening randomly with random fonts only in Illustrator. It also happened once with Myriad Pro font Family. Anyone knows how can I solve this?
    I am using Windows 7 Ultimate x64 and my custom fonts (bought and downloaded) are in the folder C:\Fonts, system fonts are in the folder C:\Windows\Fonts. For font managing I am using Bitstream Font Navigator.

    You could check these knowledgebase articles on troubleshooting font problems:
    http://kb2.adobe.com/cps/328/328607.html

  • Illustrator CS5 changing fonts

    I was just suppost to start using Illustrator CS5 on my Mac when i discovered i can't do the same as on my Illustrator CS4 version for the PC.
    In this version i was able to switch my fonts quickly in the type window by using the up and down arrows when the text was selected it was changing immediately.
    Now i can still go to the type window but when i wanna change the font i everytime have to click with my mouse on the next font to change it does somebody know how to do this quickly on the MAC like i did before on my PC ?
    Thanks Greetz Alies

    Mybe I am going offtopic but in Windows, I can switch fonts using the arrow keys, but for some odd reason certain fonts do not select when I am scrolling fonts, redirecting me to a completely new font. It is like if some fonts are corrupted or dunno, but I cannot scroll to them with arrows (i.e. if I have some text selected and i want to see how does it look with different fonts applied) so the only way I can select those fonts is by using the mouse an click on them.
    Pretty weird! Does anyone experienced the same issue?

  • Illustrator cs4 outlines fonts from older files

    We have a font we use for checks (MICR).
    Illustrator cs3 would randomly drop an extra space in the bank account in this font  8% of the time.
    Illustrator cs4 when opening files saved from previous versions outlines this font.  Which is a bit of a hassle if we need to change the account number.
    Any way around this conundrum?
    Illustrator 14.0.0
    Windows xp pro

    Disable missing glyph protection in the prefs and the respective options in the text palette. You have used some sort of custom text formatting and AI is merely favoring appearance over editability. The type engine has been changed in recent versions, that's why older files may yield different results when being opened...
    Mylenium

  • Illustrator CS4 and my drop down menu displaying different typefaces is no longer displaying font preview.

    I am using Illustrator CS4 and my drop down menu displaying different typefaces is no longer showing all of them, just blank spaces where they would be...that is unless I put my cursor over it and I can then see the typeface. This is more of a nuisance than anything and didn't happen until I updates OS X to Yosemite. I currently am operating OS X  Yosemetie 10.10.2
    I have attached a screen shot. You can see that the font highlighted as the cursor is over it I can see the preview...but one I move the cursor it appears like all the others in the list and is blank.
    HELP!

    Solved using this previous users had the same issue; Font previews not appearing correctly in the character window after upgrading to Yosemite

  • Not all installed fonts are available in Illustrator CS4

    Hi,
    I've noticed that not all of my fonts are available in Illustrator CS4. My list appears as usual in the drop down menu, but many of my fonts have somehow become incomplete. For instance, only 3 weights of Helvetica are available, instead of the 20 or so I have installed on my Macbook Pro. I use Linotype Fontexplorer, and all of my fonts appear without problems in the browser window, but not in Illustrator.
    I've deleted the Adobefontlist file with no result, and I've also tried uninstalling the fonts and reinstalling them with no result. I've had a few searches to see if anyone else has had the same problem, and some people have similar issues but not exactly the same. I've also tried some of the adobe troubleshooting steps with no result.
    Any help with this would be gratefully received. Somebody must have experienced the same problem?
    Many thanks
    Jono

    Thanks Jesseham, a good suggestion. All fonts within the families are ticked like you say, and I've just performed a clear out of the caches but still no success I'm afraid.
    I've attached a picture of my font list in Illustrator in the hope that someone might see something that I'm not. As you can see from the list, Helvetica Neue LT Std is in the list as Helvetica Neue LT Std 85 Heavy and only has the option of 'Regular' under the font style drop down menu. It should be just Helvetica Neue LT Std in the font list drop down menu and have all of the available weights in the font style drop down menu.
    Any thoughts?
    Thanks
    Jono

  • Adobe Illustrator CS4 Error: Error 1603. Error 1305.Error reading from file C:\Program Files\Adobe\Adobe Illustrator CS4\Support Files\Required\Fonts\AdobeSongStd-Light.otf.  Verify that the file exists and that you can access it.  AdobeColorCommonSetRGB

    Iam trying to load illustator in my PC i get following error while loading Application CD 2
    Adobe Illustrator CS4
    Error:
    Error 1603. Error 1305.Error reading from file C:\Program Files\Adobe\Adobe Illustrator CS4\Support Files\Required\Fonts\AdobeSongStd-Light.otf. Verify that the file exists and that you can access it.
    AdobeColorCommonSetRGB
    Error:
    Error 2.
    My serial no. [Removed by moderator]

    Download a copy an installer for CS4 from the links on this page:
    Other downloads

  • How do you change default greyscale colouring of graphs in illustrator CS4

    I've been trying to format graphs in illustrator CS4 and can't figure out how to change the defualt colour from Greyscale to be a swatch of my own choice without having to change it manually once the data is entered.
    Is there a way of changing the settings? This is driving me nuts!!!

    You really can't but you can recolor the chart using a color group you define.
    Describing in written words how the recolor art feature  works is not practical for me so it is by a movie
    http://mysite.verizon.net/wzphoto/recolor.mov
    BTW if you want the colors to be the value of one color just make a color group of one color and apply it or choose a one color job from the drop down.
    Like this

Maybe you are looking for