Copy link to clipboard
Copied
Hi Community, Im iterating characters of a TextFrame to check if font Style is 'bold' , But the problem is :
- Fonts dont follow a nomenclature , So Arial bold is named : 'Arial-BoldMT' , And by eg : Calibri bold is named as 'Calibri-BD' or something else
------------------------------------------------------------
The structure of fontStyle property is the following :
- Is there any way to w Check if a font is a bold or derivate?
1 Correct answer
Hi,
The following snippet will give all list of fonts available in Illustrator. And style is the property that will tell you whether it is bold or regular or other
var fonts = app.textFonts;
for(var i=0;i<fonts.length;i++)
$.writeln("Name - " + fonts[i].name + "Style - " + fonts[i].style);
Explore related tutorials & articles
Copy link to clipboard
Copied
Hi,
The following snippet will give all list of fonts available in Illustrator. And style is the property that will tell you whether it is bold or regular or other
var fonts = app.textFonts;
for(var i=0;i<fonts.length;i++)
$.writeln("Name - " + fonts[i].name + "Style - " + fonts[i].style);
Copy link to clipboard
Copied
As Charu Rajput said, test for it as such
textFonts[i].style == "Bold"
For example, this should produce a list of your bold fonts:
var list1 = "";
for (var i = 0; i < textFonts.length; i++){
if (textFonts[i].style == "Bold") {
list1 = list1 + textFonts[i].name + ", "
}
}
alert ( list1 );
Copy link to clipboard
Copied
Awesome! , Thanks for reply .

