1 python windows powershell fonts
我目前正在尝试在一堆服务器上安装字体。我已经能够使用脚本复制字体并将其“安装”到服务器上,但我需要能够访问这些字体,而无需关闭服务器或注销帐户。
我发现 WindowsAddFontResource()是使用 C++ 完成的,但是 Python 或 Powershell 中有等效的函数吗?
(我一直在使用Python和Powershell来进行检查和安装。)
您尝试过使用win32api图书馆吗?它具有可以与inSendMessage()结合使用的功能windll.gdi32.AddFontResource()ctypes
例如安装 TTF 字体文件:
import win32api
import ctypes
import win32con
ctypes.windll.gdi32.AddFontResourceA("C:\\Path\\To\\Font\\font.ttf")
win32api.SendMessage(win32con.HWND_BROADCAST, win32con.WM_FONTCHANGE)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
591 次 |
| 最近记录: |