From: Enrico Forestieri Date: Thu, 3 Sep 2020 18:53:41 +0000 (+0200) Subject: Adjust debug output for fonts X-Git-Tag: 2.3.6~38 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=82b3a26a320f1056b09d4061bfbe704e838b7487;p=features.git Adjust debug output for fonts This restores the debug output as it was intended before the introduction of the LYXERR macro that was unconditionally outputing an end of line. This is how this output was appearing until lyx 1.5: Looking for font family cmr10 ... got: cmr10 got it normal! instead of as it was since lyx 1.6 and until now: Looking for font family cmr10 ... got: cmr10 got it normal! --- diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index 24e5e9b7b6..bd22b278f3 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -167,14 +167,14 @@ static bool isChosenFont(QFont & font, QString const & family, // positions. QFontInfo fi(font); - LYXERR(Debug::FONT, "got: " << fi.family()); + LYXERR_NOPOS(Debug::FONT, "got: " << fi.family()); if (fi.family().contains(family) #if QT_VERSION >= 0x040800 && (style.isEmpty() || fi.styleName().contains(style)) #endif ) { - LYXERR(Debug::FONT, " got it "); + LYXERR_NOENDL(Debug::FONT, " got it "); return true; } @@ -184,7 +184,7 @@ static bool isChosenFont(QFont & font, QString const & family, QFont symbolFont(QString const & family, bool * ok) { - LYXERR(Debug::FONT, "Looking for font family " << family << " ... "); + LYXERR_NOENDL(Debug::FONT, "Looking for font family " << family << " ... "); QString upper = family; upper[0] = family[0].toUpper(); @@ -201,26 +201,26 @@ QFont symbolFont(QString const & family, bool * ok) font.setStyleName("LyX"); if (isChosenFont(font, family, "LyX")) { - LYXERR(Debug::FONT, "lyx!"); + LYXERR_NOPOS(Debug::FONT, "lyx!"); *ok = true; return font; } - LYXERR(Debug::FONT, "Trying normal " << family << " ... "); + LYXERR_NOENDL(Debug::FONT, "Trying normal " << family << " ... "); font.setStyleName(QString()); #endif if (isChosenFont(font, family, QString())) { - LYXERR(Debug::FONT, "normal!"); + LYXERR_NOPOS(Debug::FONT, "normal!"); *ok = true; return font; } - LYXERR(Debug::FONT, "Trying " << upper << " ... "); + LYXERR_NOENDL(Debug::FONT, "Trying " << upper << " ... "); font.setFamily(upper); if (isChosenFont(font, upper, QString())) { - LYXERR(Debug::FONT, "upper!"); + LYXERR_NOPOS(Debug::FONT, "upper!"); *ok = true; return font; } @@ -228,16 +228,16 @@ QFont symbolFont(QString const & family, bool * ok) // A simple setFamily() fails on Qt 2 QString const raw = rawName(family); - LYXERR(Debug::FONT, "Trying " << raw << " ... "); + LYXERR_NOENDL(Debug::FONT, "Trying " << raw << " ... "); font.setRawName(raw); if (isChosenFont(font, family, QString())) { - LYXERR(Debug::FONT, "raw version!"); + LYXERR_NOPOS(Debug::FONT, "raw version!"); *ok = true; return font; } - LYXERR(Debug::FONT, " FAILED :-("); + LYXERR_NOPOS(Debug::FONT, " FAILED :-("); *ok = false; return font; } diff --git a/src/support/debug.h b/src/support/debug.h index f6b06d5c3e..30e5d56b7f 100644 --- a/src/support/debug.h +++ b/src/support/debug.h @@ -230,6 +230,18 @@ extern LyXErr lyxerr; else { lyx::lyxerr << CURRENT_POSITION << msg; lyx::lyxerr.endl(); } \ } while (0) +#define LYXERR_NOENDL(type, msg) \ + do { \ + if (!lyx::lyxerr.debugging(type)) {} \ + else { lyx::lyxerr << CURRENT_POSITION << msg; } \ + } while (0) + +#define LYXERR_NOPOS(type, msg) \ + do { \ + if (!lyx::lyxerr.debugging(type)) {} \ + else { lyx::lyxerr << msg; lyx::lyxerr.endl(); } \ + } while (0) + #define LYXERR0(msg) \ do { \ lyx::lyxerr << CURRENT_POSITION << msg; lyx::lyxerr.endl(); \ diff --git a/status.23x b/status.23x index cf4d1b2d7b..e6194efd3a 100644 --- a/status.23x +++ b/status.23x @@ -37,6 +37,8 @@ What's new * MISCELLANEOUS +- Adjust debug output for fonts by not breaking lines that should go together. + * TEX2LYX IMPROVEMENTS