Copy link to clipboard
Copied
I am currently working on a fully automated script, which exports bulks of photoshop-layers and when encountering a Textlayer, the font file should be automatically copied into the export location aswell.
A xml file is also generated in which important the layerinformation be saved, like bounds, transparency as well as fonts, to be able to recreate and know, which layers had which fonts used
My problem now is, it seems it is only possible to access the font information through layer.textItem.font, which doesnt contain the information i am after.
So for example a textelement uses the font "arial.ttf". The information given by photoshop is "ArialMT", in the actual registry there is no font with this name and for this reason my exporter thoesnt know, which font has to be exported. Same problem with many other fonts, which get "additions" in their name by photoshop. I havent found a way to solve this other than to manually clean up the names, but this doesnt work if the user of the script uses own fonts
Is there any way through javascript to access the actual fontname or filename?
Thanks!.
dobe Photoshop has a Fonts collection that contains some information about fonts on your system Photoshop can use. Fonts are installed into your OS. Windows installs fonts into its folder "C:\Windows\Fonts\" I do not know how Fonts are installed on Mac s.
"ArialMT" seems to be the PostSsciptName for using getByName gets this information from Photoshop fonts collection.
var myFont = app.fonts.getByName("ArialMT");
alert("Font family " + myFont.family +"\n"
+ "Font name " + myFont.name +"\n"
+ "Fon
...Copy link to clipboard
Copied
dobe Photoshop has a Fonts collection that contains some information about fonts on your system Photoshop can use. Fonts are installed into your OS. Windows installs fonts into its folder "C:\Windows\Fonts\" I do not know how Fonts are installed on Mac s.
"ArialMT" seems to be the PostSsciptName for using getByName gets this information from Photoshop fonts collection.
var myFont = app.fonts.getByName("ArialMT");
alert("Font family " + myFont.family +"\n"
+ "Font name " + myFont.name +"\n"
+ "Font parent " + myFont.parent +"\n"
+ "Font postScriptName " + myFont.postScriptName +"\n"
+ "Font style " + myFont.style +"\n"
+ "Font typename " + myFont.typename );
Showing more info is widows file explore does not show and file name for that font.
Copy link to clipboard
Copied
Perfect, thank you.
Havent thought of that. The getByName function helped me quite a bit.
Copy link to clipboard
Copied
On Windows you could use vbs to get details...
This example will write out details to the desktop.
Set wshShell = WScript.CreateObject("WScript.Shell")
Set wshSysEnv = wshShell.Environment("PROCESS")
sMyFile = "c:" & wshSysEnv("HOMEPATH") & "\Desktop\Fontlist.txt"
Dim objFileSystem, objOutputFile
Dim strOutputFile
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.CreateTextFile(sMyFile, TRUE)
Dim str
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\Fonts"
objReg.EnumValues HKEY_LOCAL_MACHINE, _
strKeyPath,arrEntryNames,arrEntryZZZ
For Each entry in arrEntryNames
str = wshshell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\Fonts\" & entry)
objOutputFile.WriteLine(entry & "," & str)
Next
objOutputFile.Close
Copy link to clipboard
Copied
If you document uses Google fonts, you could maybe download them to you specified filepath.
They are available on GitHub: GitHub - google/fonts: Font files available from Google Fonts
Every font has metadata file with name and font file-name.
Copy link to clipboard
Copied
Hi!
If You use Mac you can find the name used in Photoshop scripts in the FontBook app panel.
Search fot the name of the font, then click the 'i' button and it will show you the postScript name (see ScreenShot).