image/font: make a zero Weight mean a normal weight.

Change-Id: I2000bdf1c49174b9eaefe1c680138392e3434ace
Reviewed-on: https://go-review.googlesource.com/21440
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Nigel Tao 2016-04-02 11:44:24 +11:00
parent 0ebebfd658
commit 8b5ac8f8e5

View File

@ -205,16 +205,21 @@ const (
// Weight selects a normal, light or bold face. // Weight selects a normal, light or bold face.
// //
// Not all fonts support weights. // Not all fonts support weights.
//
// The named Weight constants (e.g. WeightBold) correspond to CSS' common
// weight names (e.g. "Bold"), but the numerical values differ, so that in Go,
// the zero value means to use a normal weight. For the CSS names and values,
// see https://developer.mozilla.org/en/docs/Web/CSS/font-weight
type Weight int type Weight int
const ( const (
WeightThin Weight = 100 WeightThin Weight = -3 // CSS font-weight value 100.
WeightExtraLight Weight = 200 WeightExtraLight Weight = -2 // CSS font-weight value 200.
WeightLight Weight = 300 WeightLight Weight = -1 // CSS font-weight value 300.
WeightNormal Weight = 400 WeightNormal Weight = +0 // CSS font-weight value 400.
WeightMedium Weight = 500 WeightMedium Weight = +1 // CSS font-weight value 500.
WeightSemiBold Weight = 600 WeightSemiBold Weight = +2 // CSS font-weight value 600.
WeightBold Weight = 700 WeightBold Weight = +3 // CSS font-weight value 700.
WeightExtraBold Weight = 800 WeightExtraBold Weight = +4 // CSS font-weight value 800.
WeightBlack Weight = 900 WeightBlack Weight = +5 // CSS font-weight value 900.
) )