font/opentype,text/opentype: move package

Opentype parsing, layout and shaping will be used by subpackages to package
font. Move the opentype package accordingly.

Remove the Must helper function; programs will no longer use the opentype
package in the normal case.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-13 18:15:25 +02:00
parent 40822ef26b
commit edf0d8ef99
@@ -39,15 +39,6 @@ func Parse(src []byte) (*Font, error) {
return &Font{font: fnt}, nil
}
// Must is a helper that wraps a call to a function returning (*Font,
// error) and panics if the error is non-nil.
func Must(font *Font, err error) *Font {
if err != nil {
panic(err)
}
return font
}
func (f *Font) Layout(ppem fixed.Int26_6, str string, opts text.LayoutOptions) *text.Layout {
return layoutText(&f.buf, ppem, str, &opentype{Font: f.font, Hinting: font.HintingFull}, opts)
}