31 lines
783 B
Go
Raw Normal View History

/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.md', which is part of this source code package.
*/
package fonts
import (
"fmt"
2018-11-01 21:33:51 +11:00
"github.com/unidoc/unidoc/pdf/internal/textencoding"
)
// Font represents a font which is a series of glyphs. Character codes from PDF strings can be
// mapped to and from glyphs. Each glyph has metrics.
type Font interface {
Encoder() textencoding.TextEncoder
GetRuneMetrics(r rune) (CharMetrics, bool)
//ToPdfObject() core.PdfObject
}
// CharMetrics represents width and height metrics of a glyph.
type CharMetrics struct {
Wx float64
2018-12-26 19:03:15 +02:00
Wy float64 // TODO(dennwc): none of code paths sets this to anything except 0
}
func (m CharMetrics) String() string {
return fmt.Sprintf("<%.1f,%.1f>", m.Wx, m.Wy)
}