mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-14 23:17:27 +01:00
text/v2: refactoring
This commit is contained in:
parent
d0db7e1b60
commit
17c2b1b325
@ -17,6 +17,7 @@ package text
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
|
"slices"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/go-text/typesetting/font"
|
"github.com/go-text/typesetting/font"
|
||||||
@ -198,11 +199,9 @@ func (g *GoTextFaceSource) shape(text string, face *GoTextFace) ([]shaping.Outpu
|
|||||||
var seg shaping.Segmenter
|
var seg shaping.Segmenter
|
||||||
inputs := seg.Split(input, &singleFontmap{face: f})
|
inputs := seg.Split(input, &singleFontmap{face: f})
|
||||||
|
|
||||||
|
// Reverse the input for RTL texts.
|
||||||
if face.Direction == DirectionRightToLeft {
|
if face.Direction == DirectionRightToLeft {
|
||||||
// Reverse the input for RTL texts.
|
slices.Reverse(inputs)
|
||||||
for i, j := 0, len(inputs)-1; i < j; i, j = i+1, j-1 {
|
|
||||||
inputs[i], inputs[j] = inputs[j], inputs[i]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs := make([]shaping.Output, len(inputs))
|
outputs := make([]shaping.Output, len(inputs))
|
||||||
|
Loading…
Reference in New Issue
Block a user