Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[InDesign] 合成フォントの各セットに登録されている文字列を抽出する
!function() {
var doc = app.activeDocument;
var compFont = doc.compositeFonts[1]; //0だと[No composite font]になる
var cfEnt = compFont.compositeFontEntries;
var result = [];
for (var i=1; i<cfEnt.length; i++) { //漢字は取得できないのでi=1から
result.push("【" + cfEnt[i].name + "】");
result.push(cfEnt[i].customCharacters);
}
makeTxtFile(result.join("\n"), "~/desktop/"+compFont.name+".txt");
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