[GH-ISSUE #11] [windows] add AddFontResource #3

Open
opened 2026-02-26 17:39:13 +03:00 by kerem · 0 comments
Owner

Originally created by @CarsonSlovoka on GitHub (Mar 23, 2022).
Original GitHub issue: https://github.com/Crosse/font-install/issues/11

Add AddFontResource on windows so that after installation, you can find the font in other applications.

gdi32dll := syscall.NewLazyDLL("Gdi32.dll")
procAddFontResource := gdi32dll.NewProc("AddFontResourceW")
filePath, _:= syscall.UTF16PtrFromString("C://.../xxx.ttf")
_, _, _ = procAddFontResource.Call(uintptr(unsafe.Pointer(filePath)))

github.com/CarsonSlovoka/font-install@9c62bb4012/install_windows.go (L94-L104)

Originally created by @CarsonSlovoka on GitHub (Mar 23, 2022). Original GitHub issue: https://github.com/Crosse/font-install/issues/11 Add [AddFontResource](https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-addfontresourcew) on windows so that after installation, you can find the font in other applications. ```go gdi32dll := syscall.NewLazyDLL("Gdi32.dll") procAddFontResource := gdi32dll.NewProc("AddFontResourceW") filePath, _:= syscall.UTF16PtrFromString("C://.../xxx.ttf") _, _, _ = procAddFontResource.Call(uintptr(unsafe.Pointer(filePath))) ``` https://github.com/CarsonSlovoka/font-install/blob/9c62bb40123847f4c38854c6c37d65736c4ed92e/install_windows.go#L94-L104
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/font-install#3
No description provided.