Everything is not so simple and reliable there. In general, it is impossible to correctly change the properties of the text (depends on the text)
Try this
var s = activeDocument.activeLayer.textItem.contents;
var x1 = s.indexOf("consectetur");
if (x1 >= 0) set_text_style(x1, "consectetur".length, mdf);
function mdf(d)
{
try {
var sz_v = d.getUnitDoubleValue(stringIDToTypeID("impliedFontSize"));
var sz_t = d.getUnitDoubleType(stringIDToTypeID("impliedFontSize"));
d.putUnitDouble(stringIDToTypeID("impliedFontSize"), sz_t, sz_v+2);
var sz_v = d.getUnitDoubleValue(stringIDToTypeID("impliedLeading"));
var sz_t = d.getUnitDoubleType(stringIDToTypeID("impliedLeading"));
d.putUnitDouble(stringIDToTypeID("impliedLeading"), sz_t, sz_v+2);
}
catch (e) { throw (e); }
}
function set_text_style(from, len, style_modifier)
{
try {
// get textKey descriptor for activeLayer
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("textLayer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var textKey = executeActionGet(r).getObjectValue(stringIDToTypeID("textKey"));
var list = textKey.getList(stringIDToTypeID("textStyleRange"));
var new_list = new ActionList();
// get styles of each char, modify if needed
var styles = new Array();
var x = 0; // chars counter
for (var i = 0; i < list.count; i++)
{
var d = list.getObjectValue(i);
var x0 = d.getInteger(stringIDToTypeID("from"));
var x1 = d.getInteger(stringIDToTypeID("to"));
var st = d.getObjectValue(stringIDToTypeID("textStyle"));
for (var n = 0; n < x1-x0; n++)
{
if (x >= from && x < from+len) // modify current style
{
var d = new ActionDescriptor();
d.fromStream(st.toStream()); // duplicate style
style_modifier(d); // modify current style
styles.push(d);
}
else
{
styles.push(st);
}
++x;
}
}
styles.push(new ActionDescriptor());
// scan styles, modify if needed, compact to range (from-to)
var from = 0;
for (var i = 0; i < styles.length-1; i++)
{
if (!styles[i].isEqual(styles[i+1]))
{
var d = new ActionDescriptor();
d.putInteger(stringIDToTypeID("from"), from);
d.putInteger(stringIDToTypeID("to"), i+1);
d.putObject(stringIDToTypeID("textStyle"), stringIDToTypeID("textStyle"), styles[i]);
new_list.putObject(stringIDToTypeID("textStyleRange"), d);
from = i+1;
}
}
// put new styles to textKey descriptor
textKey.putList(stringIDToTypeID("textStyleRange"), new_list);
// set modified textKey back to textLayer
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("textLayer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("textLayer"), textKey);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
}
catch (e) { alert(e); }
}