[LyX/master] Add method FontMetrics::italic()
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Mon Sep 14 14:00:22 UTC 2020
commit ae37caacdd1b4aee796dbed2b6f749a8fd82a298
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Mon Sep 14 16:26:19 2020 +0200
Add method FontMetrics::italic()
This can be useful for ticket #11428.
---
src/frontends/FontMetrics.h | 2 ++
src/frontends/qt/GuiFontMetrics.cpp | 6 ++++++
src/frontends/qt/GuiFontMetrics.h | 1 +
3 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/frontends/FontMetrics.h b/src/frontends/FontMetrics.h
index d1fae1c..0807a22 100644
--- a/src/frontends/FontMetrics.h
+++ b/src/frontends/FontMetrics.h
@@ -75,6 +75,8 @@ public:
/// return the distance from the base line to where the strike out line
/// should be drawn.
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
virtual int width(char_type c) const = 0;
diff --git a/src/frontends/qt/GuiFontMetrics.cpp b/src/frontends/qt/GuiFontMetrics.cpp
index 4a09d97..ab8815d 100644
--- a/src/frontends/qt/GuiFontMetrics.cpp
+++ b/src/frontends/qt/GuiFontMetrics.cpp
@@ -161,6 +161,12 @@ int GuiFontMetrics::strikeoutPos() const
}
+bool GuiFontMetrics::italic() const
+{
+ return font_.italic();
+}
+
+
namespace {
int const outOfLimitMetric = -10000;
}
diff --git a/src/frontends/qt/GuiFontMetrics.h b/src/frontends/qt/GuiFontMetrics.h
index 4f0b307..d5847a1 100644
--- a/src/frontends/qt/GuiFontMetrics.h
+++ b/src/frontends/qt/GuiFontMetrics.h
@@ -42,6 +42,7 @@ public:
virtual int lineWidth() const;
virtual int underlinePos() const;
virtual int strikeoutPos() const;
+ virtual bool italic() const;
virtual int width(char_type c) const;
virtual int ascent(char_type c) const;
virtual int descent(char_type c) const;
More information about the lyx-cvs
mailing list