-
SetFont and get different line width in same text box
This script from this post works really well to get the width of different lines in the same text box.
if (time < 0){
s = value.split("\r");
txt = ""
for (i = 0; i < s.length; i++){
if (time > -10*(i+1)){
txt = s[i];
break;
}
}
txt;
}else
valueI am trying to set the font through the menu dropdown and get the width at the same time. This is what I tried but only one function works. Is there a way to combine both functions or is it impossible to have two different functions applied for sourceText?
(New to expressions. Don’t know what is possible or not possible yet).
//This changes font
var dropDownFontMenuIndex = thisComp.layer("settings").effect("Font Menu Control")("Menu").value;
switch ( dropDownFontMenuIndex ){
case 1:
style.setFont("Rockwell-Bold");
break;
case 2:
style.setFont("Antonio-Bold");
break;
default:
style.setFont("Rockwell-Bold");
};
//This returns value
if (time < 0){
s = value.split("\r");
txt = ""
for (i = 0; i < s.length; i++){
if (time > -10*(i+1)){
txt = s[i];
break;
}
}
txt;
}else{
value
}