Fixed build issues. Whee. Can't wait for this to crash at runtime...
This commit is contained in:
parent
6739b438a8
commit
839ff8347a
48
drawtext.go
48
drawtext.go
|
@ -85,7 +85,7 @@ func (f TextFamily) toLibui() *C.uiAttribute {
|
||||||
type TextSize float64
|
type TextSize float64
|
||||||
|
|
||||||
func (s TextSize) toLibui() *C.uiAttribute {
|
func (s TextSize) toLibui() *C.uiAttribute {
|
||||||
return C.uiNewSizeAttribute(C.double(size))
|
return C.uiNewSizeAttribute(C.double(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextWeight is an Attribute that changes the weight of the text
|
// TextWeight is an Attribute that changes the weight of the text
|
||||||
|
@ -190,7 +190,7 @@ type TextBackground struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b TextBackground) toLibui() *C.uiAttribute {
|
func (b TextBackground) toLibui() *C.uiAttribute {
|
||||||
return C.uiNewBackgroundAttribute(C.double(b.R), C.double(b.G), C.double(b.b), C.double(b.A))
|
return C.uiNewBackgroundAttribute(C.double(b.R), C.double(b.G), C.double(b.B), C.double(b.A))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Underline is an Attribute that specifies a type of underline to use
|
// Underline is an Attribute that specifies a type of underline to use
|
||||||
|
@ -297,10 +297,10 @@ type OpenTypeTag uint32
|
||||||
// ToOpenTypeTag converts the four characters a, b, c, and d into
|
// ToOpenTypeTag converts the four characters a, b, c, and d into
|
||||||
// an OpenTypeTag.
|
// an OpenTypeTag.
|
||||||
func ToOpenTypeTag(a, b, c, d byte) OpenTypeTag {
|
func ToOpenTypeTag(a, b, c, d byte) OpenTypeTag {
|
||||||
return (uint32(a) << 24) |
|
return (OpenTypeTag(a) << 24) |
|
||||||
(uint32(b) << 16) |
|
(OpenTypeTag(b) << 16) |
|
||||||
(uint32(c) << 8) |
|
(OpenTypeTag(c) << 8) |
|
||||||
uint32(d)
|
OpenTypeTag(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
func attributeFromLibui(a *C.uiAttribute) Attribute {
|
func attributeFromLibui(a *C.uiAttribute) Attribute {
|
||||||
|
@ -319,22 +319,22 @@ func attributeFromLibui(a *C.uiAttribute) Attribute {
|
||||||
case C.uiAttributeTypeColor:
|
case C.uiAttributeTypeColor:
|
||||||
cc := C.pkguiNewCColor()
|
cc := C.pkguiNewCColor()
|
||||||
defer C.pkguiFreeCColor(cc)
|
defer C.pkguiFreeCColor(cc)
|
||||||
C.uiAttributeColor(a, c.r, c.g, c.b, c.a)
|
C.uiAttributeColor(a, cc.r, cc.g, cc.b, cc.a)
|
||||||
return TextColor{
|
return TextColor{
|
||||||
R: float64(*(c.r)),
|
R: float64(*(cc.r)),
|
||||||
G: float64(*(c.g)),
|
G: float64(*(cc.g)),
|
||||||
B: float64(*(c.b)),
|
B: float64(*(cc.b)),
|
||||||
A: float64(*(c.a)),
|
A: float64(*(cc.a)),
|
||||||
}
|
}
|
||||||
case C.uiAttributeTypeBackground:
|
case C.uiAttributeTypeBackground:
|
||||||
cc := C.pkguiNewCColor()
|
cc := C.pkguiNewCColor()
|
||||||
defer C.pkguiFreeCColor(cc)
|
defer C.pkguiFreeCColor(cc)
|
||||||
C.uiAttributeColor(a, c.r, c.g, c.b, c.a)
|
C.uiAttributeColor(a, cc.r, cc.g, cc.b, cc.a)
|
||||||
return TextBackground{
|
return TextBackground{
|
||||||
R: float64(*(c.r)),
|
R: float64(*(cc.r)),
|
||||||
G: float64(*(c.g)),
|
G: float64(*(cc.g)),
|
||||||
B: float64(*(c.b)),
|
B: float64(*(cc.b)),
|
||||||
A: float64(*(c.a)),
|
A: float64(*(cc.a)),
|
||||||
}
|
}
|
||||||
case C.uiAttributeTypeUnderline:
|
case C.uiAttributeTypeUnderline:
|
||||||
return Underline(C.uiAttributeUnderline(a))
|
return Underline(C.uiAttributeUnderline(a))
|
||||||
|
@ -343,13 +343,13 @@ func attributeFromLibui(a *C.uiAttribute) Attribute {
|
||||||
defer C.pkguiFreeUnderlineColor(cu)
|
defer C.pkguiFreeUnderlineColor(cu)
|
||||||
cc := C.pkguiNewCColor()
|
cc := C.pkguiNewCColor()
|
||||||
defer C.pkguiFreeCColor(cc)
|
defer C.pkguiFreeCColor(cc)
|
||||||
C.uiAttributeUnderlineColor(a, cu, c.r, c.g, c.b, c.a)
|
C.uiAttributeUnderlineColor(a, cu, cc.r, cc.g, cc.b, cc.a)
|
||||||
if *cu == C.uiAttributeUnderlineColorCustom {
|
if *cu == C.uiUnderlineColorCustom {
|
||||||
return UnderlineColorCustom{
|
return UnderlineColorCustom{
|
||||||
R: float64(*(c.r)),
|
R: float64(*(cc.r)),
|
||||||
G: float64(*(c.g)),
|
G: float64(*(cc.g)),
|
||||||
B: float64(*(c.b)),
|
B: float64(*(cc.b)),
|
||||||
A: float64(*(c.a)),
|
A: float64(*(cc.a)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return UnderlineColor(*cu)
|
return UnderlineColor(*cu)
|
||||||
|
@ -477,7 +477,7 @@ func (d *FontDescriptor) fromLibui(fd *C.uiFontDescriptor) {
|
||||||
|
|
||||||
func (d *FontDescriptor) toLibui() *C.uiFontDescriptor {
|
func (d *FontDescriptor) toLibui() *C.uiFontDescriptor {
|
||||||
fd := C.pkguiNewFontDescriptor()
|
fd := C.pkguiNewFontDescriptor()
|
||||||
fd.Family = C.CString(d.Family)
|
fd.Family = C.CString(string(d.Family))
|
||||||
fd.Size = C.double(d.Size)
|
fd.Size = C.double(d.Size)
|
||||||
fd.Weight = C.uiTextWeight(d.Weight)
|
fd.Weight = C.uiTextWeight(d.Weight)
|
||||||
fd.Italic = C.uiTextItalic(d.Italic)
|
fd.Italic = C.uiTextItalic(d.Italic)
|
||||||
|
@ -536,7 +536,7 @@ func DrawNewTextLayout(p *DrawTextLayoutParams) *DrawTextLayout {
|
||||||
defer freeLibuiFontDescriptor(dp.DefaultFont)
|
defer freeLibuiFontDescriptor(dp.DefaultFont)
|
||||||
dp.Width = C.double(p.Width)
|
dp.Width = C.double(p.Width)
|
||||||
dp.Align = C.uiDrawTextAlign(p.Align)
|
dp.Align = C.uiDrawTextAlign(p.Align)
|
||||||
return DrawTextLayout{
|
return &DrawTextLayout{
|
||||||
tl: C.uiDrawNewTextLayout(dp),
|
tl: C.uiDrawNewTextLayout(dp),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue