More incremental progress.
This commit is contained in:
parent
194ee077a2
commit
c1f1aad090
75
drawtext.go
75
drawtext.go
|
@ -72,22 +72,26 @@ func (a *Attribute) Family() string {
|
||||||
return C.GoString(C.uiAttributeFamily(a.a))
|
return C.GoString(C.uiAttributeFamily(a.a))
|
||||||
}
|
}
|
||||||
|
|
||||||
//////// TODOTODO
|
// NewSizeAttribute() creates a new Attribute that changes the
|
||||||
|
|
||||||
// uiNewSizeAttribute() creates a new uiAttribute that changes the
|
|
||||||
// size of the text it is applied to, in typographical points.
|
// size of the text it is applied to, in typographical points.
|
||||||
_UI_EXTERN uiAttribute *uiNewSizeAttribute(double size);
|
func NewSizeAttribute(size float64) *Attribute {
|
||||||
|
return &Attribute{
|
||||||
|
a: C.uiNewSizeAttribute(C.double(size)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// uiAttributeSize() returns the font size stored in a. It is an error to
|
// Size returns the font size stored in a. It is an error to
|
||||||
// call this on a uiAttribute that does not hold a font size.
|
// call this on a Attribute that does not hold a font size.
|
||||||
_UI_EXTERN double uiAttributeSize(const uiAttribute *a);
|
func (a *Attribute) Size() float64 {
|
||||||
|
return float64(C.uiAttributeSize(a.a))
|
||||||
|
}
|
||||||
|
|
||||||
// uiTextWeight represents possible text weights. These roughly
|
// TextWeight represents possible text weights. These roughly
|
||||||
// map to the OS/2 text weight field of TrueType and OpenType
|
// map to the OS/2 text weight field of TrueType and OpenType
|
||||||
// fonts, or to CSS weight numbers. The named constants are
|
// fonts, or to CSS weight numbers. The named constants are
|
||||||
// nominal values; the actual values may vary by font and by OS,
|
// nominal values; the actual values may vary by font and by OS,
|
||||||
// though this isn't particularly likely. Any value between
|
// though this isn't particularly likely. Any value between
|
||||||
// uiTextWeightMinimum and uiDrawTextWeightMaximum,
|
// TextWeightMinimum and TextWeightMaximum,
|
||||||
// inclusive, is allowed.
|
// inclusive, is allowed.
|
||||||
//
|
//
|
||||||
// Note that due to restrictions in early versions of Windows, some
|
// Note that due to restrictions in early versions of Windows, some
|
||||||
|
@ -95,32 +99,41 @@ _UI_EXTERN double uiAttributeSize(const uiAttribute *a);
|
||||||
// separate font families. This is perhaps most notable with
|
// separate font families. This is perhaps most notable with
|
||||||
// Arial Black. libui does not do this, even on Windows (because the
|
// Arial Black. libui does not do this, even on Windows (because the
|
||||||
// DirectWrite API libui uses on Windows does not do this); to
|
// DirectWrite API libui uses on Windows does not do this); to
|
||||||
// specify Arial Black, use family Arial and weight uiTextWeightBlack.
|
// specify Arial Black, use family Arial and weight TextWeightBlack.
|
||||||
_UI_ENUM(uiTextWeight) {
|
type TextWeight int
|
||||||
uiTextWeightMinimum = 0,
|
const (
|
||||||
uiTextWeightThin = 100,
|
TextWeightMinimum = 0,
|
||||||
uiTextWeightUltraLight = 200,
|
TextWeightThin = 100,
|
||||||
uiTextWeightLight = 300,
|
TextWeightUltraLight = 200,
|
||||||
uiTextWeightBook = 350,
|
TextWeightLight = 300,
|
||||||
uiTextWeightNormal = 400,
|
TextWeightBook = 350,
|
||||||
uiTextWeightMedium = 500,
|
TextWeightNormal = 400,
|
||||||
uiTextWeightSemiBold = 600,
|
TextWeightMedium = 500,
|
||||||
uiTextWeightBold = 700,
|
TextWeightSemiBold = 600,
|
||||||
uiTextWeightUltraBold = 800,
|
TextWeightBold = 700,
|
||||||
uiTextWeightHeavy = 900,
|
TextWeightUltraBold = 800,
|
||||||
uiTextWeightUltraHeavy = 950,
|
TextWeightHeavy = 900,
|
||||||
uiTextWeightMaximum = 1000,
|
TextWeightUltraHeavy = 950,
|
||||||
};
|
TextWeightMaximum = 1000,
|
||||||
|
)
|
||||||
|
|
||||||
// uiNewWeightAttribute() creates a new uiAttribute that changes the
|
// NewWeightAttribute creates a new Attribute that changes the
|
||||||
// weight of the text it is applied to. It is an error to specify a weight
|
// weight of the text it is applied to. It is an error to specify a weight
|
||||||
// outside the range [uiTextWeightMinimum,
|
// outside the range [TextWeightMinimum,
|
||||||
// uiTextWeightMaximum].
|
// TextWeightMaximum].
|
||||||
_UI_EXTERN uiAttribute *uiNewWeightAttribute(uiTextWeight weight);
|
func NewWeightAttribute(weight TextWeight) *Attribute {
|
||||||
|
return &Attribute{
|
||||||
|
a: C.uiNewWeightAttribute(C.uiTextWeight(weight)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// uiAttributeWeight() returns the font weight stored in a. It is an error
|
// Weight returns the font weight stored in a. It is an error
|
||||||
// to call this on a uiAttribute that does not hold a font weight.
|
// to call this on a uiAttribute that does not hold a font weight.
|
||||||
_UI_EXTERN uiTextWeight uiAttributeWeight(const uiAttribute *a);
|
func (a *Attribute) Weight() TextWeight {
|
||||||
|
return TextWeight(C.uiAttributeWeight(a.a))
|
||||||
|
}
|
||||||
|
|
||||||
|
////// TODOTODO
|
||||||
|
|
||||||
// uiTextItalic represents possible italic modes for a font. Italic
|
// uiTextItalic represents possible italic modes for a font. Italic
|
||||||
// represents "true" italics where the slanted glyphs have custom
|
// represents "true" italics where the slanted glyphs have custom
|
||||||
|
|
Loading…
Reference in New Issue