mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-03 06:24:27 +01:00
text/v2: refactoring
This commit is contained in:
parent
bc9e9d8562
commit
bf7acd54bb
@ -178,14 +178,16 @@ func (g *GoTextFaceSource) shape(text string, face *GoTextFace) ([]shaping.Outpu
|
|||||||
return out.outputs, out.glyphs
|
return out.outputs, out.glyphs
|
||||||
}
|
}
|
||||||
|
|
||||||
g.f.SetVariations(face.variations)
|
f := face.Source.f
|
||||||
|
f.SetVariations(face.variations)
|
||||||
|
|
||||||
runes := []rune(text)
|
runes := []rune(text)
|
||||||
input := shaping.Input{
|
input := shaping.Input{
|
||||||
Text: runes,
|
Text: runes,
|
||||||
RunStart: 0,
|
RunStart: 0,
|
||||||
RunEnd: len(runes),
|
RunEnd: len(runes),
|
||||||
Direction: face.diDirection(),
|
Direction: face.diDirection(),
|
||||||
Face: face.Source.f,
|
Face: f,
|
||||||
FontFeatures: face.features,
|
FontFeatures: face.features,
|
||||||
Size: float64ToFixed26_6(face.Size),
|
Size: float64ToFixed26_6(face.Size),
|
||||||
Script: face.gScript(),
|
Script: face.gScript(),
|
||||||
@ -193,7 +195,7 @@ func (g *GoTextFaceSource) shape(text string, face *GoTextFace) ([]shaping.Outpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
var seg shaping.Segmenter
|
var seg shaping.Segmenter
|
||||||
inputs := seg.Split(input, &singleFontmap{face: face.Source.f})
|
inputs := seg.Split(input, &singleFontmap{face: f})
|
||||||
|
|
||||||
if face.Direction == DirectionRightToLeft {
|
if face.Direction == DirectionRightToLeft {
|
||||||
// Reverse the input for RTL texts.
|
// Reverse the input for RTL texts.
|
||||||
@ -222,7 +224,7 @@ func (g *GoTextFaceSource) shape(text string, face *GoTextFace) ([]shaping.Outpu
|
|||||||
switch data := g.f.GlyphData(gl.GlyphID).(type) {
|
switch data := g.f.GlyphData(gl.GlyphID).(type) {
|
||||||
case api.GlyphOutline:
|
case api.GlyphOutline:
|
||||||
if out.Direction.IsSideways() {
|
if out.Direction.IsSideways() {
|
||||||
data.Sideways(fixed26_6ToFloat32(-gl.YOffset) / fixed26_6ToFloat32(out.Size) * float32(face.Source.f.Upem()))
|
data.Sideways(fixed26_6ToFloat32(-gl.YOffset) / fixed26_6ToFloat32(out.Size) * float32(f.Upem()))
|
||||||
}
|
}
|
||||||
segs = data.Segments
|
segs = data.Segments
|
||||||
case api.GlyphSVG:
|
case api.GlyphSVG:
|
||||||
|
Loading…
Reference in New Issue
Block a user