Add method FontMetrics::italic()

This can be useful for ticket #11428.
This commit is contained in:
Jean-Marc Lasgouttes 2020-09-14 16:26:19 +02:00
parent b0db575dc1
commit ae37caacdd
3 changed files with 9 additions and 0 deletions

View File

@ -75,6 +75,8 @@ public:
/// return the distance from the base line to where the strike out line /// return the distance from the base line to where the strike out line
/// should be drawn. /// should be drawn.
virtual int strikeoutPos() const = 0; virtual int strikeoutPos() const = 0;
/// return true if font is not upright (italic or oblique)
virtual bool italic() const = 0;
/// return the width of the char in the font /// return the width of the char in the font
virtual int width(char_type c) const = 0; virtual int width(char_type c) const = 0;

View File

@ -161,6 +161,12 @@ int GuiFontMetrics::strikeoutPos() const
} }
bool GuiFontMetrics::italic() const
{
return font_.italic();
}
namespace { namespace {
int const outOfLimitMetric = -10000; int const outOfLimitMetric = -10000;
} }

View File

@ -42,6 +42,7 @@ public:
virtual int lineWidth() const; virtual int lineWidth() const;
virtual int underlinePos() const; virtual int underlinePos() const;
virtual int strikeoutPos() const; virtual int strikeoutPos() const;
virtual bool italic() const;
virtual int width(char_type c) const; virtual int width(char_type c) const;
virtual int ascent(char_type c) const; virtual int ascent(char_type c) const;
virtual int descent(char_type c) const; virtual int descent(char_type c) const;