Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[InDesign][extendScript] 合成フォントの設定を書き出し
!function() {
var doc = app.activeDocument;
var compFonts = doc.compositeFonts;
var result = [];
for (var k=1; k<compFonts.length; k++) {
result.push("# " + compFonts[k].name);
var cfEnt = compFonts[k].compositeFontEntries;
for (var i=0; i<cfEnt.length; i++) {
result.push("## " + cfEnt[i].name);
result.push("* フォント:"+cfEnt[i].appliedFont+"/"+cfEnt[i].fontStyle);
result.push("* サイズ:"+cfEnt[i].relativeSize);
result.push("* 水平比率:"+cfEnt[i].horizontalScale);
result.push("* 垂直比率:"+cfEnt[i].verticalScale);
result.push("* BLシフト:"+cfEnt[i].baselineShift);
result.push("* スケールオプション:"+((cfEnt[i].scaleOption)?"オン":"オフ"));
}
result.push("\r");
}
makeTxtFile(result.join("\n"), "~/desktop/"+doc.name.replace(/\.indd$/, ".md"));
function makeTxtFile(contents, path) {
var F = File(path), res;
try {
F.open("w");
F.encoding = "UTF-8";
res = F.write(contents);
} catch(e) {
alert(e);
} finally {
F.close();
}
}
}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment