Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Text::Layout::FontMetrics Class Reference

Keep track of font metrics. More...

#include <Layout-TNG.h>

Public Member Functions

 FontMetrics ()
 
void reset ()
 
void set (FontInstance const *font)
 
double emSize () const
 
double lineSize () const
 
void setZero ()
 
FontMetricsoperator*= (double x)
 
void max (FontMetrics const &other)
 Save the larger values of ascent and descent between this and other.
 
void computeEffective (const double &line_height)
 Calculate the effective ascent and descent including half "leading".
 
double getTypoAscent () const
 
double getTypoDescent () const
 
double getXHeight () const
 
double getMaxAscent () const
 
double getMaxDescent () const
 

Public Attributes

double ascent
 
double descent
 
double xheight
 
double ascent_max
 
double descent_max
 

Detailed Description

Keep track of font metrics.

Two use cases:

  1. Keep track of ascent, descent, and x-height of an individual font.
  2. Keep track of effective ascent and descent that includes half-leading.

Note: Leading refers to the "external" leading which is added (subtracted) due to a computed value of 'line-height' that differs from 'font-size'. "Internal" leading which is specified inside a font is not used in CSS. The 'font-size' is based on the font's em size which is 'ascent' + 'descent'.

This structure was renamed (and modified) from "LineHeight".

It's useful for this to be public so that ScanlineMaker can use it.

Definition at line 624 of file Layout-TNG.h.

Constructor & Destructor Documentation

◆ FontMetrics()

Inkscape::Text::Layout::FontMetrics::FontMetrics ( )
inline

Definition at line 627 of file Layout-TNG.h.

References reset().

Referenced by Inkscape::Text::Layout::_calculateCursorShapeForEmpty().

Member Function Documentation

◆ computeEffective()

void Inkscape::Text::Layout::FontMetrics::computeEffective ( const double &  line_height)

Calculate the effective ascent and descent including half "leading".

Definition at line 110 of file Layout-TNG-Output.cpp.

Referenced by SPText::_buildLayoutInit(), and SPFlowtext::_buildLayoutInput().

◆ emSize()

◆ getMaxAscent()

double Inkscape::Text::Layout::FontMetrics::getMaxAscent ( ) const
inline

Definition at line 661 of file Layout-TNG.h.

References ascent_max.

◆ getMaxDescent()

double Inkscape::Text::Layout::FontMetrics::getMaxDescent ( ) const
inline

Definition at line 662 of file Layout-TNG.h.

References descent_max.

◆ getTypoAscent()

double Inkscape::Text::Layout::FontMetrics::getTypoAscent ( ) const
inline

Definition at line 658 of file Layout-TNG.h.

References ascent.

◆ getTypoDescent()

double Inkscape::Text::Layout::FontMetrics::getTypoDescent ( ) const
inline

Definition at line 659 of file Layout-TNG.h.

References descent.

◆ getXHeight()

double Inkscape::Text::Layout::FontMetrics::getXHeight ( ) const
inline

Definition at line 660 of file Layout-TNG.h.

References xheight.

◆ lineSize()

double Inkscape::Text::Layout::FontMetrics::lineSize ( ) const
inline

Definition at line 642 of file Layout-TNG.h.

References ascent, and descent.

◆ max()

void Inkscape::Text::Layout::FontMetrics::max ( FontMetrics const &  other)

Save the larger values of ascent and descent between this and other.

Needed for laying out a line with mixed font-sizes, fonts, or line spacings.

Definition at line 101 of file Layout-TNG-Output.cpp.

References ascent, ascent_max, descent, descent_max, and xheight.

Referenced by Inkscape::Text::Layout::getNearestCursorPositionTo().

◆ operator*=()

FontMetrics & Inkscape::Text::Layout::FontMetrics::operator*= ( double  x)
inline

Definition at line 646 of file Layout-TNG.h.

References ascent, ascent_max, descent, descent_max, and xheight.

◆ reset()

void Inkscape::Text::Layout::FontMetrics::reset ( )
inline

◆ set()

◆ setZero()

void Inkscape::Text::Layout::FontMetrics::setZero ( )
inline

Member Data Documentation

◆ ascent

◆ ascent_max

double Inkscape::Text::Layout::FontMetrics::ascent_max

Definition at line 668 of file Layout-TNG.h.

Referenced by getMaxAscent(), max(), operator*=(), reset(), set(), and setZero().

◆ descent

◆ descent_max

double Inkscape::Text::Layout::FontMetrics::descent_max

Definition at line 669 of file Layout-TNG.h.

Referenced by getMaxDescent(), max(), operator*=(), reset(), set(), and setZero().

◆ xheight


The documentation for this class was generated from the following files: