mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
text: rename Face to Family and let Face denote a family configuration
While here, rename Family.Path to Shape which a more precise term. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+28
-3
@@ -45,12 +45,27 @@ type LayoutOptions struct {
|
||||
SingleLine bool
|
||||
}
|
||||
|
||||
type Face interface {
|
||||
// Face specify a particular configuration of a Family.
|
||||
type Face struct {
|
||||
// Weight is the text weight. If zero, Normal is used instead.
|
||||
Weight Weight
|
||||
Style Style
|
||||
}
|
||||
|
||||
// Style is the font style.
|
||||
type Style int
|
||||
|
||||
// Weight is a font weight, in CSS units.
|
||||
type Weight int
|
||||
|
||||
// Family implements a font family. It can layout and shape text from
|
||||
// a Face and size.
|
||||
type Family interface {
|
||||
// Layout returns the text layout for a string given a set of
|
||||
// options.
|
||||
Layout(size float32, s string, opts LayoutOptions) *Layout
|
||||
Layout(face Face, size float32, s string, opts LayoutOptions) *Layout
|
||||
// Path returns the ClipOp outline of a text recorded in a macro.
|
||||
Path(size float32, s String) op.MacroOp
|
||||
Shape(face Face, size float32, s String) op.MacroOp
|
||||
}
|
||||
|
||||
type Alignment uint8
|
||||
@@ -61,6 +76,16 @@ const (
|
||||
Middle
|
||||
)
|
||||
|
||||
const (
|
||||
Regular Style = iota
|
||||
Italic
|
||||
)
|
||||
|
||||
const (
|
||||
Normal Weight = 400
|
||||
Bold Weight = 700
|
||||
)
|
||||
|
||||
func linesDimens(lines []Line) layout.Dimensions {
|
||||
var width fixed.Int26_6
|
||||
var h int
|
||||
|
||||
Reference in New Issue
Block a user