forked from joejulian/gio
text,widget: use != for flag tests
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+6
-6
@@ -108,32 +108,32 @@ const (
|
||||
|
||||
func (f Flags) String() string {
|
||||
var b strings.Builder
|
||||
if f&FlagParagraphStart > 0 {
|
||||
if f&FlagParagraphStart != 0 {
|
||||
b.WriteString("S")
|
||||
} else {
|
||||
b.WriteString("_")
|
||||
}
|
||||
if f&FlagParagraphBreak > 0 {
|
||||
if f&FlagParagraphBreak != 0 {
|
||||
b.WriteString("P")
|
||||
} else {
|
||||
b.WriteString("_")
|
||||
}
|
||||
if f&FlagTowardOrigin > 0 {
|
||||
if f&FlagTowardOrigin != 0 {
|
||||
b.WriteString("T")
|
||||
} else {
|
||||
b.WriteString("_")
|
||||
}
|
||||
if f&FlagLineBreak > 0 {
|
||||
if f&FlagLineBreak != 0 {
|
||||
b.WriteString("L")
|
||||
} else {
|
||||
b.WriteString("_")
|
||||
}
|
||||
if f&FlagRunBreak > 0 {
|
||||
if f&FlagRunBreak != 0 {
|
||||
b.WriteString("R")
|
||||
} else {
|
||||
b.WriteString("_")
|
||||
}
|
||||
if f&FlagClusterBreak > 0 {
|
||||
if f&FlagClusterBreak != 0 {
|
||||
b.WriteString("C")
|
||||
} else {
|
||||
b.WriteString("_")
|
||||
|
||||
+4
-4
@@ -125,13 +125,13 @@ func (g *glyphIndex) Glyph(gl text.Glyph) {
|
||||
g.positions = append(g.positions, pos)
|
||||
g.skipPrior = true
|
||||
}
|
||||
needsNewLine := gl.Flags&text.FlagLineBreak > 0
|
||||
needsNewRun := gl.Flags&text.FlagRunBreak > 0
|
||||
breaksParagraph := gl.Flags&text.FlagParagraphBreak > 0
|
||||
needsNewLine := gl.Flags&text.FlagLineBreak != 0
|
||||
needsNewRun := gl.Flags&text.FlagRunBreak != 0
|
||||
breaksParagraph := gl.Flags&text.FlagParagraphBreak != 0
|
||||
|
||||
// We should insert new positions if the glyph we're processing terminates
|
||||
// a glyph cluster.
|
||||
insertPositionAfter := gl.Flags&text.FlagClusterBreak > 0 && !breaksParagraph && gl.Runes > 0
|
||||
insertPositionAfter := gl.Flags&text.FlagClusterBreak != 0 && !breaksParagraph && gl.Runes > 0
|
||||
if breaksParagraph {
|
||||
// Paragraph breaking clusters shouldn't have positions generated for both
|
||||
// sides of them. They're always zero-width, so doing so would
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ func (it *textIterator) paintGlyph(gtx layout.Context, shaper *text.Shaper, glyp
|
||||
}
|
||||
line = append(line, glyph)
|
||||
}
|
||||
if glyph.Flags&text.FlagLineBreak > 0 || cap(line)-len(line) == 0 || !visibleOrBefore {
|
||||
if glyph.Flags&text.FlagLineBreak != 0 || cap(line)-len(line) == 0 || !visibleOrBefore {
|
||||
t := op.Offset(it.lineOff).Push(gtx.Ops)
|
||||
op := clip.Outline{Path: shaper.Shape(line)}.Op().Push(gtx.Ops)
|
||||
paint.PaintOp{}.Add(gtx.Ops)
|
||||
|
||||
Reference in New Issue
Block a user