Skip to content

[windows] add AddFontResource #11

@CarsonSlovoka

Description

@CarsonSlovoka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions