More drawtext conversions. This isn't going to be fun; let's try a different approach (one that's also more Go-like).
This commit is contained in:
parent
c1f1aad090
commit
75e67484a3
93
drawtext.go
93
drawtext.go
|
@ -97,9 +97,10 @@ func (a *Attribute) Size() float64 {
|
||||||
// Note that due to restrictions in early versions of Windows, some
|
// Note that due to restrictions in early versions of Windows, some
|
||||||
// fonts have "special" weights be exposed in many programs as
|
// fonts have "special" weights be exposed in many programs as
|
||||||
// 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. Package ui does not do this, even on Windows
|
||||||
// DirectWrite API libui uses on Windows does not do this); to
|
// (because the DirectWrite API libui uses on Windows does not do
|
||||||
// specify Arial Black, use family Arial and weight TextWeightBlack.
|
// this); to specify Arial Black, use family Arial and weight
|
||||||
|
// TextWeightBlack.
|
||||||
type TextWeight int
|
type TextWeight int
|
||||||
const (
|
const (
|
||||||
TextWeightMinimum = 0,
|
TextWeightMinimum = 0,
|
||||||
|
@ -133,59 +134,73 @@ func (a *Attribute) Weight() TextWeight {
|
||||||
return TextWeight(C.uiAttributeWeight(a.a))
|
return TextWeight(C.uiAttributeWeight(a.a))
|
||||||
}
|
}
|
||||||
|
|
||||||
////// TODOTODO
|
// TextItalic 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
|
||||||
// shapes, whereas oblique represents italics that are merely slanted
|
// shapes, whereas oblique represents italics that are merely slanted
|
||||||
// versions of the normal glyphs. Most fonts usually have one or the
|
// versions of the normal glyphs. Most fonts usually have one or the
|
||||||
// other.
|
// other.
|
||||||
_UI_ENUM(uiTextItalic) {
|
type TextItalic int
|
||||||
uiTextItalicNormal,
|
const (
|
||||||
uiTextItalicOblique,
|
TextItalicNormal TextItalic = iota
|
||||||
uiTextItalicItalic,
|
TextItalicOblique
|
||||||
};
|
TextItalicItalic
|
||||||
|
)
|
||||||
|
|
||||||
// uiNewItalicAttribute() creates a new uiAttribute that changes the
|
// NewItalicAttribute creates a new Attribute that changes the
|
||||||
// italic mode of the text it is applied to. It is an error to specify an
|
// italic mode of the text it is applied to. It is an error to specify an
|
||||||
// italic mode not specified in uiTextItalic.
|
// italic mode not specified in TextItalic.
|
||||||
_UI_EXTERN uiAttribute *uiNewItalicAttribute(uiTextItalic italic);
|
func NewItalicAttribute(italic TextItalic) *Attribute {
|
||||||
|
return &Attribute{
|
||||||
|
a: C.uiNewItalicAttribute(C.uiTextItalic(italic)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// uiAttributeItalic() returns the font italic mode stored in a. It is an
|
// Italic returns the font italic mode stored in a. It is an
|
||||||
// error to call this on a uiAttribute that does not hold a font italic
|
// error to call this on an Attribute that does not hold a font italic
|
||||||
// mode.
|
// mode.
|
||||||
_UI_EXTERN uiTextItalic uiAttributeItalic(const uiAttribute *a);
|
func (a *Attribute) Italic() TextItalic {
|
||||||
|
return TextItalic(C.uiAttributeItalic(a.a))
|
||||||
|
}
|
||||||
|
|
||||||
// uiTextStretch represents possible stretches (also called "widths")
|
// TextStretch represents possible stretches (also called "widths")
|
||||||
// of a font.
|
// of a font.
|
||||||
//
|
//
|
||||||
// Note that due to restrictions in early versions of Windows, some
|
// Note that due to restrictions in early versions of Windows, some
|
||||||
// fonts have "special" stretches be exposed in many programs as
|
// fonts have "special" stretches be exposed in many programs as
|
||||||
// separate font families. This is perhaps most notable with
|
// separate font families. This is perhaps most notable with
|
||||||
// Arial Condensed. libui does not do this, even on Windows (because
|
// Arial Condensed. Package ui does not do this, even on Windows
|
||||||
// the DirectWrite API libui uses on Windows does not do this); to
|
// (because the DirectWrite API package ui uses on Windows does
|
||||||
// specify Arial Condensed, use family Arial and stretch
|
// not do this); to specify Arial Condensed, use family Arial and
|
||||||
// uiTextStretchCondensed.
|
// stretch TextStretchCondensed.
|
||||||
_UI_ENUM(uiTextStretch) {
|
type TextStretch int
|
||||||
uiTextStretchUltraCondensed,
|
const (
|
||||||
uiTextStretchExtraCondensed,
|
TextStretchUltraCondensed TextStretch = iota
|
||||||
uiTextStretchCondensed,
|
TextStretchExtraCondensed
|
||||||
uiTextStretchSemiCondensed,
|
TextStretchCondensed
|
||||||
uiTextStretchNormal,
|
TextStretchSemiCondensed
|
||||||
uiTextStretchSemiExpanded,
|
TextStretchNormal
|
||||||
uiTextStretchExpanded,
|
TextStretchSemiExpanded
|
||||||
uiTextStretchExtraExpanded,
|
TextStretchExpanded
|
||||||
uiTextStretchUltraExpanded,
|
TextStretchExtraExpanded
|
||||||
};
|
TextStretchUltraExpanded
|
||||||
|
)
|
||||||
|
|
||||||
// uiNewStretchAttribute() creates a new uiAttribute that changes the
|
// NewStretchAttribute creates a new Attribute that changes the
|
||||||
// stretch of the text it is applied to. It is an error to specify a strech
|
// stretch of the text it is applied to. It is an error to specify a strech
|
||||||
// not specified in uiTextStretch.
|
// not specified in TextStretch.
|
||||||
_UI_EXTERN uiAttribute *uiNewStretchAttribute(uiTextStretch stretch);
|
func NewStretchAttribute(stretch TextStretch) *Attribute {
|
||||||
|
return &Attribute{
|
||||||
|
a: C.uiNewStretchAttribute(C.uiTextStretch(stretch)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// uiAttributeStretch() returns the font stretch stored in a. It is an
|
// Stretch returns the font stretch stored in a. It is an
|
||||||
// error to call this on a uiAttribute that does not hold a font stretch.
|
// error to call this on an Attribute that does not hold a font stretch.
|
||||||
_UI_EXTERN uiTextStretch uiAttributeStretch(const uiAttribute *a);
|
func (a *Attribute) Stretch() TextStretch {
|
||||||
|
return TextStretch(C.uiAttributeStretch(a.a))
|
||||||
|
}
|
||||||
|
|
||||||
|
/////// TODOTODO
|
||||||
|
|
||||||
// uiNewColorAttribute() creates a new uiAttribute that changes the
|
// uiNewColorAttribute() creates a new uiAttribute that changes the
|
||||||
// color of the text it is applied to. It is an error to specify an invalid
|
// color of the text it is applied to. It is an error to specify an invalid
|
||||||
|
|
Loading…
Reference in New Issue