text: match Bold weight to CSS, add Variant and Typeface

This commit is contained in:
Elias Naur
2019-10-13 18:22:31 +02:00
parent 481cca5781
commit d33461dd80
+11 -4
View File
@@ -50,9 +50,8 @@ type Weight int
// Font specify a particular typeface, style and size. // Font specify a particular typeface, style and size.
type Font struct { type Font struct {
// Typeface identifies a particular typeface design. The empty Typeface Typeface
// string denotes the default typeface. Variant Variant
Typeface string
Size unit.Value Size unit.Value
Style Style Style Style
// Weight is the text weight. If zero, Normal is used instead. // Weight is the text weight. If zero, Normal is used instead.
@@ -65,6 +64,13 @@ type Face interface {
Shape(ppem fixed.Int26_6, str String) paint.ClipOp Shape(ppem fixed.Int26_6, str String) paint.ClipOp
} }
// Typeface identifies a particular typeface design. The empty
// string denotes the default typeface.
type Typeface string
// Variant denotes a typeface variant such as "Mono" or "Smallcaps".
type Variant string
type Alignment uint8 type Alignment uint8
const ( const (
@@ -80,7 +86,8 @@ const (
const ( const (
Normal Weight = 400 Normal Weight = 400
Bold Weight = 700 Medium Weight = 500
Bold Weight = 600
) )
func (a Alignment) String() string { func (a Alignment) String() string {