Copy link to clipboard
Copied
Hello!
I'd like to mix the script that choose font weights plus the script that choose font family.
Script to choose Font Weight:
var fontWeights = [
'Regular',
'Bold',
];
family = thisProperty.style.font;
family = family.split('-');
select = Math.round(clamp(effect("Select Weight")("Slider"), 0, fontWeights.length - 1));
createStyle().setFont(family[0] + '-' + fontWeights[select]);
Script to choose Font Family:
var fontArray = [
"Arial",
"Trebuchet MS",
"Times New Roman"
];
v = Math.round(effect("Select Font")("Slider"));
style.setFont(fontArray[v]);
Can you help me?
Copy link to clipboard
Copied
Anyone can help me? Please!
Copy link to clipboard
Copied
There doesn't seem to be a good algorithm for turning a font name into the bold version of that font name, so I think something like this is probably as close as you can get:
fonts = ["ArialMT","TrebuchetMS","TimesNewRomanPSMT"];
boldFonts = ["Arial-BoldMT","TrebuchetMS-Bold","TimesNewRomanPS-BoldMT"];
fontSelect = clamp(Math.round(effect("Select Font")("Slider")),0,fonts.length-1);
weightSelect = clamp(Math.round(effect("Select Weight")("Slider")),0,1);
fontName = weightSelect > 0 ? boldFonts[fontSelect] : fonts[fontSelect];
style.setFont(fontName)