Skip to content

Instantly share code, notes, and snippets.

@partynight12th
Created October 29, 2012 08:50
Show Gist options
  • Save partynight12th/3972454 to your computer and use it in GitHub Desktop.
Save partynight12th/3972454 to your computer and use it in GitHub Desktop.
インストールされているフォントで、任意の文字列の見た目を羅列、確認するためのExtend Script。確認したい文字列(テキスト)を選択し、このスクリプトを実行すると、フォントの数だけテキストフレームが追加される。フォントが多ければ多いほど時間がかかり、下手するとフリーズするかも。 フォントサイズは var height の値を変えてください。
var textFrame = activeDocument.selection[0];
if(textFrame.characters.length > 0){
var textContent = textFrame.contents;
var fonts = app.textFonts;
var len = fonts.length;
var width = 270;
var height = 12;
var setnum = len / (width / height);
var numset = Math.sqrt(setnum) << 0;
var numtextframe = ((numset * width) / height) << 0;
for(var i = 0; i < len; i++){
var x = ((i / numtextframe) << 0) * width;
var y = (i % numtextframe) * -height;
textObj = activeDocument.textFrames.add();
textObj.contents = textContent;
textObj.paragraphs[0].size = height;
textObj.textRange.characterAttributes.textFont = fonts[i];
textObj.translate(x, y);
}
}else{
alert("Please select the text frame.");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment