package di
import "github.com/go-text/typesetting/di"
Index ¶
- type Axis
- type Direction
- func (d Direction) Axis() Axis
- func (d Direction) Harfbuzz() harfbuzz.Direction
- func (d Direction) HasVerticalOrientation() bool
- func (d Direction) IsSideways() bool
- func (d Direction) IsVertical() bool
- func (d Direction) Progression() Progression
- func (d *Direction) SetProgression(p Progression)
- func (d *Direction) SetSideways(sideways bool)
- func (d Direction) SwitchAxis() Direction
- type Progression
Types ¶
type Axis ¶
type Axis bool
Axis indicates the axis of layout for a piece of text.
type Direction ¶
type Direction uint8
Direction indicates the layout direction of a piece of text.
const ( // DirectionLTR is for Left-to-Right text. DirectionLTR Direction = iota // DirectionRTL is for Right-to-Left text. DirectionRTL // DirectionTTB is for Top-to-Bottom text. DirectionTTB // DirectionBTT is for Bottom-to-Top text. DirectionBTT )
func (Direction) Axis ¶
Axis returns the layout axis for d.
func (Direction) Harfbuzz ¶
Harfbuzz returns the equivalent direction used by harfbuzz.
func (Direction) HasVerticalOrientation ¶
HasVerticalOrientation returns true if the direction has set up an orientation for vertical text (typically using [SetSideways] or [SetUpright])
func (Direction) IsSideways ¶
IsSideways returns true if the direction is vertical with a 'sideways' orientation.
When shaping vertical text, 'sideways' means that the glyphs are rotated by 90°, clock-wise. This flag should be used by renderers to properly rotate the glyphs when drawing.
func (Direction) IsVertical ¶
IsVertical returns whether d is laid out on a vertical axis. If the return value is false, d is on the horizontal axis.
func (Direction) Progression ¶
func (d Direction) Progression() Progression
Progression returns the text layout progression for d.
func (*Direction) SetProgression ¶
func (d *Direction) SetProgression(p Progression)
SetProgression sets the progression, preserving the others bits.
func (*Direction) SetSideways ¶
SetSideways makes d vertical with 'sideways' or 'upright' orientation, preserving only the progression.
func (Direction) SwitchAxis ¶
SwitchAxis switches from horizontal to vertical (and vice versa), preserving the progression.
type Progression ¶
type Progression bool
Progression indicates how text is read within its Axis relative to the top left corner.
const ( // FromTopLeft indicates text in which a reader starts reading // at the top left corner of the text and moves away from it. // DirectionLTR and DirectionTTB are examples of FromTopLeft // Progression. FromTopLeft Progression = false // TowardTopLeft indicates text in which a reader starts reading // at the opposite end of the text's Axis from the top left corner // and moves towards it. DirectionRTL and DirectionBTT are examples // of TowardTopLeft progression. TowardTopLeft Progression = true )
Source Files ¶
- Version
- v0.3.0 (latest)
- Published
- Feb 21, 2025
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 16 hours ago –
Tools for package owners.