Skip to content

infogulch/fontutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fontutil

fontutil is a small collection of utility functions to make working with fonts easier.

Functions

Find

Find returns the path to a font file given a font name. It's (intended to be) an OS-agnostic way to locate font files installed on the system. If you need to include fonts with your application instead of finding them on the system, this isn't for you.

Find currently only supports Windows but contributions for other systems are quite welcome! I'm also open to changing the interface. For example, separately specifying style, variant, or weight or a css-like list of prioritized font or family names. I'm unsure if/how these changes could be implemented on the different systems.

Supported platforms and resources for future implementation

FindAndParse

FindAndParse calls Find to find a font file, reads it, parses it, and returns the *truetype.Font.

DrawWidth

DrawWidth returns the width of a string if it were drawn to a Context, as the X coordinate of a raster.Point.

CenterX

CenterX returns the the start point required to center a string within a Rectangle, as the X coordinate of a raster.Point.

About

fontutil is a small collection of utility functions to make working with fonts easier in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages