Skip to content

Instantly share code, notes, and snippets.

@UskeS
Created August 17, 2018 13:11
Show Gist options
  • Save UskeS/feeb24c405f47a2a397b35909d54c6fe to your computer and use it in GitHub Desktop.
Save UskeS/feeb24c405f47a2a397b35909d54c6fe to your computer and use it in GitHub Desktop.
[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