mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
text/v2: rename LineSpaceInPixels -> LineSpace for consistency
Updates #2454
This commit is contained in:
parent
f0396ba915
commit
f57703175e
@ -48,7 +48,7 @@ func drawTextWithShadow(rt *ebiten.Image, str string, x, y, scale int, clr color
|
|||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(float64(x)+1, float64(y)+1)
|
op.GeoM.Translate(float64(x)+1, float64(y)+1)
|
||||||
op.ColorScale.ScaleWithColor(shadowColor)
|
op.ColorScale.ScaleWithColor(shadowColor)
|
||||||
op.LineSpacingInPixels = arcadeFontBaseSize * float64(scale)
|
op.LineSpacing = arcadeFontBaseSize * float64(scale)
|
||||||
op.PrimaryAlign = primaryAlign
|
op.PrimaryAlign = primaryAlign
|
||||||
op.SecondaryAlign = secondaryAlign
|
op.SecondaryAlign = secondaryAlign
|
||||||
text.Draw(rt, str, &text.GoTextFace{
|
text.Draw(rt, str, &text.GoTextFace{
|
||||||
|
@ -277,7 +277,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(screenWidth/2, 3*titleFontSize)
|
op.GeoM.Translate(screenWidth/2, 3*titleFontSize)
|
||||||
op.ColorScale.ScaleWithColor(color.White)
|
op.ColorScale.ScaleWithColor(color.White)
|
||||||
op.LineSpacingInPixels = titleFontSize
|
op.LineSpacing = titleFontSize
|
||||||
op.PrimaryAlign = text.AlignCenter
|
op.PrimaryAlign = text.AlignCenter
|
||||||
text.Draw(screen, titleTexts, &text.GoTextFace{
|
text.Draw(screen, titleTexts, &text.GoTextFace{
|
||||||
Source: arcadeFaceSource,
|
Source: arcadeFaceSource,
|
||||||
@ -287,7 +287,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
op = &text.DrawOptions{}
|
op = &text.DrawOptions{}
|
||||||
op.GeoM.Translate(screenWidth/2, 3*titleFontSize)
|
op.GeoM.Translate(screenWidth/2, 3*titleFontSize)
|
||||||
op.ColorScale.ScaleWithColor(color.White)
|
op.ColorScale.ScaleWithColor(color.White)
|
||||||
op.LineSpacingInPixels = fontSize
|
op.LineSpacing = fontSize
|
||||||
op.PrimaryAlign = text.AlignCenter
|
op.PrimaryAlign = text.AlignCenter
|
||||||
text.Draw(screen, texts, &text.GoTextFace{
|
text.Draw(screen, texts, &text.GoTextFace{
|
||||||
Source: arcadeFaceSource,
|
Source: arcadeFaceSource,
|
||||||
@ -300,7 +300,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(screenWidth/2, screenHeight-smallFontSize/2)
|
op.GeoM.Translate(screenWidth/2, screenHeight-smallFontSize/2)
|
||||||
op.ColorScale.ScaleWithColor(color.White)
|
op.ColorScale.ScaleWithColor(color.White)
|
||||||
op.LineSpacingInPixels = smallFontSize
|
op.LineSpacing = smallFontSize
|
||||||
op.PrimaryAlign = text.AlignCenter
|
op.PrimaryAlign = text.AlignCenter
|
||||||
op.SecondaryAlign = text.AlignEnd
|
op.SecondaryAlign = text.AlignEnd
|
||||||
text.Draw(screen, msg, &text.GoTextFace{
|
text.Draw(screen, msg, &text.GoTextFace{
|
||||||
@ -312,7 +312,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
op = &text.DrawOptions{}
|
op = &text.DrawOptions{}
|
||||||
op.GeoM.Translate(screenWidth, 0)
|
op.GeoM.Translate(screenWidth, 0)
|
||||||
op.ColorScale.ScaleWithColor(color.White)
|
op.ColorScale.ScaleWithColor(color.White)
|
||||||
op.LineSpacingInPixels = fontSize
|
op.LineSpacing = fontSize
|
||||||
op.PrimaryAlign = text.AlignEnd
|
op.PrimaryAlign = text.AlignEnd
|
||||||
text.Draw(screen, fmt.Sprintf("%04d", g.score()), &text.GoTextFace{
|
text.Draw(screen, fmt.Sprintf("%04d", g.score()), &text.GoTextFace{
|
||||||
Source: arcadeFaceSource,
|
Source: arcadeFaceSource,
|
||||||
|
@ -155,7 +155,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
op = &text.DrawOptions{}
|
op = &text.DrawOptions{}
|
||||||
op.GeoM.Translate(x, 110)
|
op.GeoM.Translate(x, 110)
|
||||||
op.ColorScale.ScaleWithColor(g.kanjiTextColor)
|
op.ColorScale.ScaleWithColor(g.kanjiTextColor)
|
||||||
op.LineSpacingInPixels = bigFontSize * 1.2
|
op.LineSpacing = bigFontSize * 1.2
|
||||||
text.Draw(screen, g.kanjiText, &text.GoTextFace{
|
text.Draw(screen, g.kanjiText, &text.GoTextFace{
|
||||||
Source: mplusFaceSource,
|
Source: mplusFaceSource,
|
||||||
Size: bigFontSize,
|
Size: bigFontSize,
|
||||||
|
@ -102,7 +102,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
[Z] 'zero' (Slashed Zero) (%d)`, g.liga, g.tnum, g.smcp, g.zero)
|
[Z] 'zero' (Slashed Zero) (%d)`, g.liga, g.tnum, g.smcp, g.zero)
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(20, 20)
|
op.GeoM.Translate(20, 20)
|
||||||
op.LineSpacingInPixels = 30
|
op.LineSpacing = 30
|
||||||
text.Draw(screen, inst, &text.GoTextFace{
|
text.Draw(screen, inst, &text.GoTextFace{
|
||||||
Source: firaSansFaceSource,
|
Source: firaSansFaceSource,
|
||||||
Size: 20,
|
Size: 20,
|
||||||
@ -115,7 +115,7 @@ ffi
|
|||||||
2.71`
|
2.71`
|
||||||
op = &text.DrawOptions{}
|
op = &text.DrawOptions{}
|
||||||
op.GeoM.Translate(20, screenHeight/2)
|
op.GeoM.Translate(20, screenHeight/2)
|
||||||
op.LineSpacingInPixels = 50
|
op.LineSpacing = 50
|
||||||
f := &text.GoTextFace{
|
f := &text.GoTextFace{
|
||||||
Source: firaSansFaceSource,
|
Source: firaSansFaceSource,
|
||||||
Size: 40,
|
Size: 40,
|
||||||
|
@ -116,7 +116,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
[Z, X]: slnt (Slant): %0.0f [%d-%d]`, g.wght, minWght, maxWght, g.wdth, minWdth, maxWdth, g.slnt, minSlnt, maxSlnt)
|
[Z, X]: slnt (Slant): %0.0f [%d-%d]`, g.wght, minWght, maxWght, g.wdth, minWdth, maxWdth, g.slnt, minSlnt, maxSlnt)
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(20, 20)
|
op.GeoM.Translate(20, 20)
|
||||||
op.LineSpacingInPixels = 30
|
op.LineSpacing = 30
|
||||||
text.Draw(screen, inst, &text.GoTextFace{
|
text.Draw(screen, inst, &text.GoTextFace{
|
||||||
Source: robotoFlexFaceSource,
|
Source: robotoFlexFaceSource,
|
||||||
Size: 20,
|
Size: 20,
|
||||||
@ -127,7 +127,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
over the lazy dog.`
|
over the lazy dog.`
|
||||||
op = &text.DrawOptions{}
|
op = &text.DrawOptions{}
|
||||||
op.GeoM.Translate(20, screenHeight/2)
|
op.GeoM.Translate(20, screenHeight/2)
|
||||||
op.LineSpacingInPixels = 50
|
op.LineSpacing = 50
|
||||||
f := &text.GoTextFace{
|
f := &text.GoTextFace{
|
||||||
Source: robotoFlexFaceSource,
|
Source: robotoFlexFaceSource,
|
||||||
Size: 40,
|
Size: 40,
|
||||||
|
@ -59,7 +59,7 @@ func (g *Game) Update() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
op := &text.LayoutOptions{}
|
op := &text.LayoutOptions{}
|
||||||
op.LineSpacingInPixels = 110
|
op.LineSpacing = 110
|
||||||
text.AppendVectorPath(&g.path, "ABCEDFG\nabcdefg\nあいうえお\nかきくけこ", &text.GoTextFace{
|
text.AppendVectorPath(&g.path, "ABCEDFG\nabcdefg\nあいうえお\nかきくけこ", &text.GoTextFace{
|
||||||
Source: s,
|
Source: s,
|
||||||
Size: 90,
|
Size: 90,
|
||||||
|
@ -99,7 +99,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
textOp := &text.DrawOptions{}
|
textOp := &text.DrawOptions{}
|
||||||
textOp.GeoM.Translate(50*scale, 50*scale)
|
textOp.GeoM.Translate(50*scale, 50*scale)
|
||||||
textOp.ColorScale.ScaleWithColor(color.White)
|
textOp.ColorScale.ScaleWithColor(color.White)
|
||||||
textOp.LineSpacingInPixels = 12 * ebiten.DeviceScaleFactor() * 1.5
|
textOp.LineSpacing = 12 * ebiten.DeviceScaleFactor() * 1.5
|
||||||
text.Draw(screen, msg, &text.GoTextFace{
|
text.Draw(screen, msg, &text.GoTextFace{
|
||||||
Source: mplusFaceSource,
|
Source: mplusFaceSource,
|
||||||
Size: 12 * ebiten.DeviceScaleFactor(),
|
Size: 12 * ebiten.DeviceScaleFactor(),
|
||||||
|
@ -93,7 +93,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
|
|
||||||
// Use bitmapfont.Face instead of ebitenutil.DebugPrint, since some key names might not be printed with DebugPrint.
|
// Use bitmapfont.Face instead of ebitenutil.DebugPrint, since some key names might not be printed with DebugPrint.
|
||||||
textOp := &text.DrawOptions{}
|
textOp := &text.DrawOptions{}
|
||||||
textOp.LineSpacingInPixels = fontFace.Metrics().HLineGap + fontFace.Metrics().HAscent + fontFace.Metrics().HDescent
|
textOp.LineSpacing = fontFace.Metrics().HLineGap + fontFace.Metrics().HAscent + fontFace.Metrics().HDescent
|
||||||
text.Draw(screen, strings.Join(keyStrs, ", ")+"\n"+strings.Join(keyNames, ", "), fontFace, textOp)
|
text.Draw(screen, strings.Join(keyStrs, ", ")+"\n"+strings.Join(keyNames, ", "), fontFace, textOp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ func (g *Game) Update() error {
|
|||||||
func (g *Game) Draw(screen *ebiten.Image) {
|
func (g *Game) Draw(screen *ebiten.Image) {
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(20, 20)
|
op.GeoM.Translate(20, 20)
|
||||||
op.LineSpacingInPixels = 48
|
op.LineSpacing = 48
|
||||||
text.Draw(screen, "HelloこんにちはWorld世界\n日本語とEnglish…", g.face, op)
|
text.Draw(screen, "HelloこんにちはWorld世界\n日本語とEnglish…", g.face, op)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ func (g *Game) Update() error {
|
|||||||
// Initialize the glyphs for special (colorful) rendering.
|
// Initialize the glyphs for special (colorful) rendering.
|
||||||
if len(g.glyphs) == 0 {
|
if len(g.glyphs) == 0 {
|
||||||
op := &text.LayoutOptions{}
|
op := &text.LayoutOptions{}
|
||||||
op.LineSpacingInPixels = mplusNormalFace.Size * 1.5
|
op.LineSpacing = mplusNormalFace.Size * 1.5
|
||||||
g.glyphs = text.AppendGlyphs(g.glyphs, sampleText, mplusNormalFace, op)
|
g.glyphs = text.AppendGlyphs(g.glyphs, sampleText, mplusNormalFace, op)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -83,7 +83,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
vector.DrawFilledRect(screen, x, y, float32(w), float32(h), gray, false)
|
vector.DrawFilledRect(screen, x, y, float32(w), float32(h), gray, false)
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(x, y)
|
op.GeoM.Translate(x, y)
|
||||||
op.LineSpacingInPixels = mplusNormalFace.Size * 1.5
|
op.LineSpacing = mplusNormalFace.Size * 1.5
|
||||||
text.Draw(screen, sampleText, mplusNormalFace, op)
|
text.Draw(screen, sampleText, mplusNormalFace, op)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
vector.DrawFilledRect(screen, x, y, float32(w), float32(h), gray, false)
|
vector.DrawFilledRect(screen, x, y, float32(w), float32(h), gray, false)
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(x, y)
|
op.GeoM.Translate(x, y)
|
||||||
op.LineSpacingInPixels = mplusBigFace.Size * 1.5
|
op.LineSpacing = mplusBigFace.Size * 1.5
|
||||||
text.Draw(screen, sampleText, mplusBigFace, op)
|
text.Draw(screen, sampleText, mplusBigFace, op)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
op.GeoM.Rotate(math.Pi / 4)
|
op.GeoM.Rotate(math.Pi / 4)
|
||||||
op.GeoM.Translate(x, y)
|
op.GeoM.Translate(x, y)
|
||||||
op.Filter = ebiten.FilterLinear
|
op.Filter = ebiten.FilterLinear
|
||||||
op.LineSpacingInPixels = mplusNormalFace.Size * 1.5
|
op.LineSpacing = mplusNormalFace.Size * 1.5
|
||||||
text.Draw(screen, sampleText, mplusNormalFace, op)
|
text.Draw(screen, sampleText, mplusNormalFace, op)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
// Add the width as the text rendering region's upper-right position comes to (0, 0)
|
// Add the width as the text rendering region's upper-right position comes to (0, 0)
|
||||||
// when the horizontal alignment is right. The alignment is specified later (PrimaryAlign).
|
// when the horizontal alignment is right. The alignment is specified later (PrimaryAlign).
|
||||||
op.GeoM.Translate(x+w, y)
|
op.GeoM.Translate(x+w, y)
|
||||||
op.LineSpacingInPixels = lineSpacingInPixels
|
op.LineSpacing = lineSpacingInPixels
|
||||||
// The primary alignment for the left-to-right direction is a horizontal alignment, and the end means the right.
|
// The primary alignment for the left-to-right direction is a horizontal alignment, and the end means the right.
|
||||||
op.PrimaryAlign = text.AlignEnd
|
op.PrimaryAlign = text.AlignEnd
|
||||||
text.Draw(screen, sampleText, mplusBigFace, op)
|
text.Draw(screen, sampleText, mplusBigFace, op)
|
||||||
|
@ -195,7 +195,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false)
|
vector.DrawFilledRect(screen, float32(x), float32(y), float32(w), float32(h), gray, false)
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(float64(x), float64(y))
|
op.GeoM.Translate(float64(x), float64(y))
|
||||||
op.LineSpacingInPixels = lineSpacing
|
op.LineSpacing = lineSpacing
|
||||||
text.Draw(screen, mongolianText, f, op)
|
text.Draw(screen, mongolianText, f, op)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -213,7 +213,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||||||
vector.DrawFilledRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false)
|
vector.DrawFilledRect(screen, float32(x)-float32(w), float32(y), float32(w), float32(h), gray, false)
|
||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(float64(x), float64(y))
|
op.GeoM.Translate(float64(x), float64(y))
|
||||||
op.LineSpacingInPixels = lineSpacing
|
op.LineSpacing = lineSpacing
|
||||||
text.Draw(screen, japaneseText, f, op)
|
text.Draw(screen, japaneseText, f, op)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ func (t *TextField) Draw(screen *ebiten.Image) {
|
|||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(float64(tx), float64(ty))
|
op.GeoM.Translate(float64(tx), float64(ty))
|
||||||
op.ColorScale.ScaleWithColor(color.Black)
|
op.ColorScale.ScaleWithColor(color.Black)
|
||||||
op.LineSpacingInPixels = fontFace.Metrics().HLineGap + fontFace.Metrics().HAscent + fontFace.Metrics().HDescent
|
op.LineSpacing = fontFace.Metrics().HLineGap + fontFace.Metrics().HAscent + fontFace.Metrics().HDescent
|
||||||
text.Draw(screen, shownText, fontFace, op)
|
text.Draw(screen, shownText, fontFace, op)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ func (b *Button) Draw(dst *ebiten.Image) {
|
|||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(float64(b.Rect.Min.X+b.Rect.Max.X)/2, float64(b.Rect.Min.Y+b.Rect.Max.Y)/2)
|
op.GeoM.Translate(float64(b.Rect.Min.X+b.Rect.Max.X)/2, float64(b.Rect.Min.Y+b.Rect.Max.Y)/2)
|
||||||
op.ColorScale.ScaleWithColor(color.Black)
|
op.ColorScale.ScaleWithColor(color.Black)
|
||||||
op.LineSpacingInPixels = lineSpacingInPixels
|
op.LineSpacing = lineSpacingInPixels
|
||||||
op.PrimaryAlign = text.AlignCenter
|
op.PrimaryAlign = text.AlignCenter
|
||||||
op.SecondaryAlign = text.AlignCenter
|
op.SecondaryAlign = text.AlignCenter
|
||||||
text.Draw(dst, b.Text, &text.GoTextFace{
|
text.Draw(dst, b.Text, &text.GoTextFace{
|
||||||
@ -340,7 +340,7 @@ func (t *TextBox) Draw(dst *ebiten.Image) {
|
|||||||
textOp.GeoM.Translate(x, y)
|
textOp.GeoM.Translate(x, y)
|
||||||
textOp.GeoM.Translate(float64(t.Rect.Min.X), float64(t.Rect.Min.Y))
|
textOp.GeoM.Translate(float64(t.Rect.Min.X), float64(t.Rect.Min.Y))
|
||||||
textOp.ColorScale.ScaleWithColor(color.Black)
|
textOp.ColorScale.ScaleWithColor(color.Black)
|
||||||
textOp.LineSpacingInPixels = lineSpacingInPixels
|
textOp.LineSpacing = lineSpacingInPixels
|
||||||
text.Draw(dst.SubImage(t.Rect).(*ebiten.Image), t.Text, &text.GoTextFace{
|
text.Draw(dst.SubImage(t.Rect).(*ebiten.Image), t.Text, &text.GoTextFace{
|
||||||
Source: uiFaceSource,
|
Source: uiFaceSource,
|
||||||
Size: uiFontSize,
|
Size: uiFontSize,
|
||||||
@ -409,7 +409,7 @@ func (c *CheckBox) Draw(dst *ebiten.Image) {
|
|||||||
op := &text.DrawOptions{}
|
op := &text.DrawOptions{}
|
||||||
op.GeoM.Translate(float64(x), float64(y))
|
op.GeoM.Translate(float64(x), float64(y))
|
||||||
op.ColorScale.ScaleWithColor(color.Black)
|
op.ColorScale.ScaleWithColor(color.Black)
|
||||||
op.LineSpacingInPixels = lineSpacingInPixels
|
op.LineSpacing = lineSpacingInPixels
|
||||||
op.PrimaryAlign = text.AlignStart
|
op.PrimaryAlign = text.AlignStart
|
||||||
op.SecondaryAlign = text.AlignCenter
|
op.SecondaryAlign = text.AlignCenter
|
||||||
text.Draw(dst, c.Text, &text.GoTextFace{
|
text.Draw(dst, c.Text, &text.GoTextFace{
|
||||||
|
@ -46,8 +46,9 @@ type DrawOptions struct {
|
|||||||
// PrimaryAlign and SecondaryAlign determine where to put the text in the given region at Draw.
|
// PrimaryAlign and SecondaryAlign determine where to put the text in the given region at Draw.
|
||||||
// Draw might render the text outside of the specified image bounds, so you might have to specify GeoM to make the text visible.
|
// Draw might render the text outside of the specified image bounds, so you might have to specify GeoM to make the text visible.
|
||||||
type LayoutOptions struct {
|
type LayoutOptions struct {
|
||||||
// LineSpacingInPixels is a distance between two adjacent lines's baselines.
|
// LineSpacing is a distance between two adjacent lines's baselines.
|
||||||
LineSpacingInPixels float64
|
// The unit is in pixels.
|
||||||
|
LineSpacing float64
|
||||||
|
|
||||||
// PrimaryAlign is an alignment of the primary direction, in which a text in one line is rendered.
|
// PrimaryAlign is an alignment of the primary direction, in which a text in one line is rendered.
|
||||||
// The primary direction is the horizontal direction for a horizontal-direction face,
|
// The primary direction is the horizontal direction for a horizontal-direction face,
|
||||||
@ -184,10 +185,10 @@ func forEachLine(text string, face Face, options *LayoutOptions, f func(text str
|
|||||||
var boundaryWidth, boundaryHeight float64
|
var boundaryWidth, boundaryHeight float64
|
||||||
if d.isHorizontal() {
|
if d.isHorizontal() {
|
||||||
boundaryWidth = longestAdvance
|
boundaryWidth = longestAdvance
|
||||||
boundaryHeight = float64(lineCount-1)*options.LineSpacingInPixels + m.HAscent + m.HDescent
|
boundaryHeight = float64(lineCount-1)*options.LineSpacing + m.HAscent + m.HDescent
|
||||||
} else {
|
} else {
|
||||||
// TODO: Perhaps HAscent and HDescent should be used for sideways glyphs.
|
// TODO: Perhaps HAscent and HDescent should be used for sideways glyphs.
|
||||||
boundaryWidth = float64(lineCount-1)*options.LineSpacingInPixels + m.VAscent + m.VDescent
|
boundaryWidth = float64(lineCount-1)*options.LineSpacing + m.VAscent + m.VDescent
|
||||||
boundaryHeight = longestAdvance
|
boundaryHeight = longestAdvance
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,13 +268,13 @@ func forEachLine(text string, face Face, options *LayoutOptions, f func(text str
|
|||||||
// Advance the origin position in the secondary direction.
|
// Advance the origin position in the secondary direction.
|
||||||
switch face.direction() {
|
switch face.direction() {
|
||||||
case DirectionLeftToRight:
|
case DirectionLeftToRight:
|
||||||
originY += options.LineSpacingInPixels
|
originY += options.LineSpacing
|
||||||
case DirectionRightToLeft:
|
case DirectionRightToLeft:
|
||||||
originY += options.LineSpacingInPixels
|
originY += options.LineSpacing
|
||||||
case DirectionTopToBottomAndLeftToRight:
|
case DirectionTopToBottomAndLeftToRight:
|
||||||
originX += options.LineSpacingInPixels
|
originX += options.LineSpacing
|
||||||
case DirectionTopToBottomAndRightToLeft:
|
case DirectionTopToBottomAndRightToLeft:
|
||||||
originX -= options.LineSpacingInPixels
|
originX -= options.LineSpacing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user