mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
text: offset Weight constants so the zero value is normal text weight
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -83,9 +83,6 @@ func NewCache(collection []FontFace) *Cache {
|
||||
faces: make(map[Font]*faceCache),
|
||||
}
|
||||
for i, ff := range collection {
|
||||
if ff.Font.Weight == 0 {
|
||||
ff.Font.Weight = Normal
|
||||
}
|
||||
if i == 0 {
|
||||
c.def = ff.Font.Typeface
|
||||
}
|
||||
|
||||
+5
-4
@@ -33,7 +33,8 @@ type Glyph struct {
|
||||
// Style is the font style.
|
||||
type Style int
|
||||
|
||||
// Weight is a font weight, in CSS units.
|
||||
// Weight is a font weight, in CSS units subtracted 400 so the zero value
|
||||
// is normal text weight.
|
||||
type Weight int
|
||||
|
||||
// Font specify a particular typeface variant, style and weight.
|
||||
@@ -73,9 +74,9 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
Normal Weight = 400
|
||||
Medium Weight = 500
|
||||
Bold Weight = 600
|
||||
Normal Weight = 400 - 400
|
||||
Medium Weight = 500 - 400
|
||||
Bold Weight = 600 - 400
|
||||
)
|
||||
|
||||
func (a Alignment) String() string {
|
||||
|
||||
Reference in New Issue
Block a user