Hi @Rogerio5C09, how about this script? It aims to quite literally reduce the point size of all text and doesn't care about Paragraph or Character Styles. I would imagine that, after running script, you might go through and use the "Redefine Style" command for your main styles.
- Mark
/**
* Reduce point size of all text in document by 1.
* @author m1b
* @discussion https://community.adobe.com/t5/indesign-discussions/decrease-font-size-of-all-stories-by-1-or-2-points/m-p/14506004
*/
function main() {
// adjust this function to suit your needs
function myTextAdjuster(text) {
if (text.pointSize <= 6)
return;
// reduce point size by 1 point
text.pointSize -= 1;
/* remove auto leading */
if (Leading.AUTO === text.leading)
text.leading = (text.pointSize * text.autoLeading / 100);
/* reduce leading by 2 points - only do this if you already removed auto leading! */
text.leading -= 2;
/* turn autoleading on and set auto value to 120% */
// text.leading = Leading.AUTO;
// text.autoLeading = 120;
};
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var everyStory = app.activeDocument.stories.everyItem();
var textStyleRanges = everyStory.paragraphs.everyItem().textStyleRanges.everyItem().getElements();
if (
everyStory.tables.length
&& everyStory.tables.everyItem().cells.everyItem().paragraphs.length
)
textStyleRanges = textStyleRanges.concat(everyStory.tables.everyItem().cells.everyItem().paragraphs.everyItem().textStyleRanges.everyItem().getElements())
if (everyStory.footnotes.everyItem().paragraphs.length)
textStyleRanges = textStyleRanges.concat(everyStory.footnotes.everyItem().paragraphs.everyItem().textStyleRanges.everyItem().getElements());
for (var i = textStyleRanges.length - 1; i >= 0; i--)
myTextAdjuster(textStyleRanges[i]);
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Reduce Document Text Sizes');
Edit 2024-03-23: for clarity of idea.
Edit 2024-04-05: to possibly help with OP's error by adding a couple of checks, and also structuring so easier to edit using `myTextAdjuster` function.
Edit 2024-04-15: fixed bug in one of the predicates. Then fixed bug in the other predicate.