Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/infogulch/fontutil
fontutil is a small collection of utility functions to make working with fonts easier in Go
https://github.com/infogulch/fontutil
Last synced: 13 days ago
JSON representation
fontutil is a small collection of utility functions to make working with fonts easier in Go
- Host: GitHub
- URL: https://github.com/infogulch/fontutil
- Owner: infogulch
- License: mit
- Created: 2015-07-07T22:09:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-20T20:47:39.000Z (about 9 years ago)
- Last Synced: 2024-10-10T22:37:42.359Z (about 1 month ago)
- Language: Go
- Size: 117 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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
- [x] Windows ([REG: Fonts Entries](windows))
- [ ] OS X ([Font locations and their purposes](mac))
- [ ] Linux ([Debian](debian), [Ubuntu](ubuntu), others?)### 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`.
[windows]: https://support.microsoft.com/en-us/kb/102960
[mac]: https://support.apple.com/en-us/HT201722
[debian]: https://wiki.debian.org/Fonts
[ubuntu]: https://wiki.ubuntu.com/Fonts