Copy link to clipboard
Copied
Hey all,
I'm trying to view a decimal value, and after the point (11.11) i want to decrase the font size...
I've managed to read and change the size but chatching the value after the point and make smaller was a bit tricky.
var rect = doc.pages[0].textFrames.add({
geometricBounds: [12.7, 12.7, 90, 90]
});
rect.contents = "737.87"
rect.texts[0].pointSize = 30
rect.texts[0].appliedFont = "Variable Black"
rect.texts[0].parentStory.justification = Justification.CENTER_ALIGN
bascily, i want to check if the content has a point and if yse after the point "87" make the font smaller lets say 20 and before the point "737" same font size 30 ..
if any one can help me i will be thankful.
thanks all again.
Try the following
var rect = app.activeDocument.pages[0].textFrames.add({
geometricBounds: [12.7, 12.7, 90, 90]
});
rect.contents = "737.87"
rect.texts[0].pointSize = 30
rect.texts[0].appliedFont = "Variable Black"
rect.texts[0].parentStory.justification = Justification.CENTER_ALIGN
app.findGrepPreferences.findWhat = '\\d+\\.\\K\\d+'
var f = rect.findGrep()
if(f.length)
f[0].pointSize = 20
app.findGrepPreferences.findWhat = NothingEnum.NOTHING
-Manan
Copy link to clipboard
Copied
Try the following
var rect = app.activeDocument.pages[0].textFrames.add({
geometricBounds: [12.7, 12.7, 90, 90]
});
rect.contents = "737.87"
rect.texts[0].pointSize = 30
rect.texts[0].appliedFont = "Variable Black"
rect.texts[0].parentStory.justification = Justification.CENTER_ALIGN
app.findGrepPreferences.findWhat = '\\d+\\.\\K\\d+'
var f = rect.findGrep()
if(f.length)
f[0].pointSize = 20
app.findGrepPreferences.findWhat = NothingEnum.NOTHING
-Manan
Copy link to clipboard
Copied
EXACTLY LIKE WHAT I WANT!!! THANKSSSS