27 lines
797 B
Python
27 lines
797 B
Python
#!/usr/bin/env python3
|
|
from psd_tools import PSDImage
|
|
|
|
psd = PSDImage.open('/path/to/pf/PSD/UEFI/x64/main/main.psd')
|
|
names = set()
|
|
for layer in psd.descendants():
|
|
if layer.kind != 'type':
|
|
continue
|
|
try:
|
|
rd = layer.resource_dict or {}
|
|
for fs in rd.get('FontSet', []) or []:
|
|
n = fs.get('Name') if hasattr(fs, 'get') else getattr(fs, 'Name', None)
|
|
if n:
|
|
names.add(n)
|
|
except Exception as e:
|
|
pass
|
|
print('fonts in document:', sorted(names) or 'not found')
|
|
|
|
# fallback: raw resource block scan
|
|
try:
|
|
from psd_tools.constants import Resource
|
|
for k, v in psd.image_resources.items():
|
|
if 'Font' in str(k):
|
|
print('resource', k, str(v)[:400])
|
|
except Exception as e:
|
|
print('image_resources:', e)
|