Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFontBytes ¶
func GetFontBytes(ctx context.Context, family string, variant string, cache fonts.Cache) ([]byte, error)
Get the []byte of a font variant ctx context.Context: To possibly cancel the http request. family: the font family e.g. "Open Sans". variant: the font variant e.g. "700". cache: A cache implementation to prevent duplicate request if reusing fonts. Use nil to disable. Returns ErrUnknownFont if the font family is not found, or ErrMissingVariant if the font family does not contain that variant
func GetFontDetails ¶
Get the details of a font: family, category, available variants, e.t.c No http request is made. The font details are embeded in the package Returns ErrUnknownFont if the font family is not found
func Proxy ¶
The proxy return a http.Handler that will proxy all requests to the Google Fonts server it take a path, which is used when generating the urls of the font bytes For example, if you want to proxy requests on `example.com/fonts`:
http.Handle("/fonts", http.StripPrefix("/fonts", google.Proxy("/fonts")))
Types ¶
This section is empty.