]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt3/GuiFontMetrics.C
This commit saves the need to check for lyx::use_gui in a number of places.
[features.git] / src / frontends / qt3 / GuiFontMetrics.C
index 166ff65e5bd6f0aecd2a99a7112f9b738820b5f1..9d05c3415ab5e5e17d216580ef2c13f41a1777ab 100644 (file)
@@ -26,9 +26,6 @@ using std::string;
 
 
 namespace lyx {
-
-extern bool use_gui;
-
 namespace frontend {
 
 
@@ -46,16 +43,12 @@ GuiFontMetrics::GuiFontMetrics(QFont const & font, QFont const & smallcaps_font)
 
 int GuiFontMetrics::maxAscent() const
 {
-       if (!lyx::use_gui)
-               return 1;
        return metrics_.ascent();
 }
 
 
 int GuiFontMetrics::maxDescent() const
 {
-       if (!lyx::use_gui)
-               return 1;
        // We add 1 as the value returned by QT is different than X
        // See http://doc.trolltech.com/2.3/qfontmetrics.html#200b74
        return metrics_.descent() + 1;
@@ -64,8 +57,6 @@ int GuiFontMetrics::maxDescent() const
 
 int GuiFontMetrics::ascent(char_type c) const
 {
-       if (!lyx::use_gui)
-               return 1;
        QRect const & r = metrics_.boundingRect(ucs4_to_qchar(c));
        // Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
        // value by the height: (x, -y-height, width, height).
@@ -80,8 +71,6 @@ int GuiFontMetrics::ascent(char_type c) const
 
 int GuiFontMetrics::descent(char_type c) const
 {
-       if (!lyx::use_gui)
-               return 1;
        QRect const & r = metrics_.boundingRect(ucs4_to_qchar(c));
        // Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
        // value by the height: (x, -y-height, width, height).
@@ -96,17 +85,12 @@ int GuiFontMetrics::descent(char_type c) const
 
 int GuiFontMetrics::lbearing(char_type c) const
 {
-       if (!lyx::use_gui)
-               return 1;
        return metrics_.leftBearing(ucs4_to_qchar(c));
 }
 
 
 int GuiFontMetrics::rbearing(char_type c) const
 {
-       if (!lyx::use_gui)
-               return 1;
-
        // Qt rbearing is from the right edge of the char's width().
        QChar sc = ucs4_to_qchar(c);
        return metrics_.width(sc) - metrics_.rightBearing(sc);
@@ -115,9 +99,6 @@ int GuiFontMetrics::rbearing(char_type c) const
 
 int GuiFontMetrics::smallcapsWidth(QString const & s) const
 {
-       if (!lyx::use_gui)
-               return 1;
-
        int w = 0;
        int const ls = s.length();
 
@@ -135,9 +116,6 @@ int GuiFontMetrics::smallcapsWidth(QString const & s) const
 
 int GuiFontMetrics::width(char_type const * s, size_t ls) const
 {
-       if (!lyx::use_gui)
-               return ls;
-
        QString const ucs2 = toqstr(s, ls);
 
        if (smallcaps_shape_)