macOSにインストールされているすべてのフォントに対して、すべてのtraitsを確認して、タブ区切りテキストとして出力するAppleScriptです。
実際にNumbersの表データに入力して、Numbers上のフィルタを用いてtraitsの分布状況を調べてみました。とくに問題はないようです。
AppleScript名:全フォントから全traitsを調べる v2.scptd |
— – Created by: Takaaki Naganoya – Created on: 2024/11/03 — – Copyright © 2024 Piyomaru Software, All Rights Reserved — use AppleScript version "2.4" — Yosemite (10.10) or later use framework "Foundation" use framework "AppKit" use scripting additions property NSFont : a reference to current application’s NSFont property NSPredicate : a reference to current application’s NSPredicate property NSFontManager : a reference to current application’s NSFontManager set fontStatList to {} set fList to getEveryFontPSName() of me set fontM to NSFontManager’s sharedFontManager() repeat with i in fList set j to contents of i set f1Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSItalicFontMask)) as integer set f2Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSBoldFontMask)) as integer set f3Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSUnboldFontMask)) as integer set f4Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSNonStandardCharacterSetFontMask)) as integer set f5Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSNarrowFontMask)) as integer set f6Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSExpandedFontMask)) as integer set f7Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSCondensedFontMask)) as integer set f8Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSSmallCapsFontMask)) as integer set f9Res to (fontM’s fontNamed:(j) hasTraits:(current application’s NSPosterFontMask)) as integer set fARes to (fontM’s fontNamed:(j) hasTraits:(current application’s NSCompressedFontMask)) as integer set fBRes to (fontM’s fontNamed:(j) hasTraits:(current application’s NSFixedPitchFontMask)) as integer set fCRes to (fontM’s fontNamed:(j) hasTraits:(current application’s NSUnitalicFontMask)) as integer set the end of fontStatList to {j, f1Res, f2Res, f3Res, f4Res, f5Res, f6Res, f7Res, f8Res, f9Res, fARes, fBRes, fCRes} end repeat –結果のリストをタブ区切りテキストに set sRes to make2DList2TabSepMultilineText(fontStatList) of me –> (* 07LightNovelPOP 0 1 0 0 0 0 0 0 0 0 0 0 07YasashisaGothic 0 0 0 0 0 0 0 0 0 0 0 0 07YasashisaGothicBold 0 0 0 0 0 0 0 0 0 0 0 0 7barP 0 0 0 0 0 0 0 0 0 0 0 0 7barSP 0 0 0 0 0 0 0 0 0 0 0 0…….. *) on getEveryFontPSName() set aFontList to NSFontManager’s sharedFontManager()’s availableFonts() set thePred to NSPredicate’s predicateWithFormat:"NOT SELF BEGINSWITH ’.’" set aFontList to (aFontList’s filteredArrayUsingPredicate:thePred) as list set aList to {} repeat with i in aFontList set aName to contents of i set the end of aList to aName end repeat return aList end getEveryFontPSName on make2DList2TabSepMultilineText(aList) set aStr to "" repeat with i in aList set j to contents of i set tmpStr to list2TABseparatedText(j) of me set aStr to aStr & tmpStr & return end repeat return aStr end make2DList2TabSepMultilineText –リストをタブ区切りのテキストに変換 on list2TABseparatedText(aList) set curDelim to AppleScript’s text item delimiters set AppleScript’s text item delimiters to tab set bList to aList as string set AppleScript’s text item delimiters to curDelim return bList end list2TABseparatedText |
More from my site
(Visited 1 times, 1 visits today)