font-install icon indicating copy to clipboard operation
font-install copied to clipboard

[windows] add AddFontResource

Open CarsonSlovoka opened this issue 3 years ago • 0 comments

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)))

https://github.com/CarsonSlovoka/font-install/blob/9c62bb40123847f4c38854c6c37d65736c4ed92e/install_windows.go#L94-L104

CarsonSlovoka avatar Mar 23 '22 10:03 CarsonSlovoka