Maria GDK 5.0.0.759
Documentation of native code in develop branch
Loading...
Searching...
No Matches
Maria::LabelLayout Namespace Reference

Functions

Anchors calcAnchors (const std::vector< STK::Vector2f > &line, AnchorPoints &anchorPoints, float spacing, float labelLength, bool continuedLine, const float maxAngleDeg, const float glyphSize, const float boxScale, const float overscaling)
 
PlacedGlyphs calcPlacedGlyphs (Anchor &anchor, AnchorPoints &anchorPoints, const std::vector< STK::Vector2f > &line, const GlyphRun &glyphs, const bool alongLine, bool keepUpright)
 
PlacedGlyphs calcLinearGlyphPlacement (int anchorPointId, const GlyphRun &glyphs, const double offsetX, const double offsetY, double angle)
 
void calcGlyphLayout (const std::string &text, std::shared_ptr< STK::TextureFontSDF > font, GlyphRun &glyphs, double extraSpacing=0.0)
 
void calcPlacementOffset (double width, double height, const Maria::LabelPlacement placement, double placementMargin, double &offsetX, double &offsetY)
 
void calcPlacementOffset (const GlyphRun &glyphs, const Maria::LabelPlacement placement, double placementMargin, double &offsetX, double &offsetY)
 

Detailed Description

LabelLayout - label layout methods Detailed description.

Function Documentation

◆ calcAnchors()

Anchors Maria::LabelLayout::calcAnchors ( const std::vector< STK::Vector2f > &  line,
AnchorPoints anchorPoints,
float  spacing,
float  labelLength,
bool  continuedLine,
const float  maxAngleDeg,
const float  glyphSize,
const float  boxScale,
const float  overscaling 
)

Calculate anchor points for labels along a line.

◆ calcGlyphLayout()

void Maria::LabelLayout::calcGlyphLayout ( const std::string &  text,
std::shared_ptr< STK::TextureFontSDF font,
GlyphRun glyphs,
double  extraSpacing = 0.0 
)

Calculate glyph layout for a given text and font. This calculates the layout of the text lines consisting of glyphs with correct spacing and kerning and all that. All glyphs are added to the given glyph run, and it assumed that all glyphs in the same GlyphRun have the same font.

◆ calcLinearGlyphPlacement()

PlacedGlyphs Maria::LabelLayout::calcLinearGlyphPlacement ( int  anchorPointId,
const GlyphRun glyphs,
const double  offsetX,
const double  offsetY,
double  angle 
)

Calc glyph placement relative to an anchor point. This will calculate the individual glyph positions along a straight line relative to the given anchor point.

◆ calcPlacedGlyphs()

PlacedGlyphs Maria::LabelLayout::calcPlacedGlyphs ( Anchor anchor,
AnchorPoints anchorPoints,
const std::vector< STK::Vector2f > &  line,
const GlyphRun glyphs,
const bool  alongLine,
bool  keepUpright 
)

Calculate all glyph positions for a label along a line. This method will calculate all glyph positions for a label along a line. It may include multiple alternative placements for each glyph, depending on the shape of the line and rendering scale. Each placed glyph will have a scale range for which it is relevant.

◆ calcPlacementOffset()

void Maria::LabelLayout::calcPlacementOffset ( double  width,
double  height,
const Maria::LabelPlacement  placement,
double  placementMargin,
double &  offsetX,
double &  offsetY 
)

Calc offset from anchor point relative to the given LabelPlacement parameter.