From f4af5ce9cfb5c063001db64fd57802110b1940bf Mon Sep 17 00:00:00 2001 From: Dekel Tsur Date: Tue, 15 Oct 2002 16:48:53 +0000 Subject: [PATCH] Compilation fix for QT2 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5417 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/QLPainter.C | 6 ++++-- src/frontends/qt2/qfont_metrics.C | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt2/QLPainter.C b/src/frontends/qt2/QLPainter.C index 471e00ed3c..197f39f315 100644 --- a/src/frontends/qt2/QLPainter.C +++ b/src/frontends/qt2/QLPainter.C @@ -257,14 +257,16 @@ Painter & QLPainter::text(int x, int y, encoding = encodings.symbol_encoding(); QString str; +#if QT_VERSION >= 0x030000 str.setLength(ls); for (size_t i = 0; i < ls; ++i) str[i] = QChar(encoding->ucs(s[i])); - -#if QT_VERSION >= 0x030000 // HACK: QT3 refuses to show single compose characters if (ls = 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2) str = ' '+str; +#else + for (size_t i = 0; i < ls; ++i) + str += QChar(encoding->ucs(s[i])); #endif if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { diff --git a/src/frontends/qt2/qfont_metrics.C b/src/frontends/qt2/qfont_metrics.C index 57b65a2eb1..44992d5049 100644 --- a/src/frontends/qt2/qfont_metrics.C +++ b/src/frontends/qt2/qfont_metrics.C @@ -85,9 +85,14 @@ int width(char const * s, size_t ls, LyXFont const & f) encoding = encodings.symbol_encoding(); QString str; +#if QT_VERSION >= 0x030000 str.setLength(ls); for (size_t i = 0; i < ls; ++i) str[i] = QChar(encoding->ucs(s[i])); +#else + for (size_t i = 0; i < ls; ++i) + str += QChar(encoding->ucs(s[i])); +#endif if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { return metrics(f).width(str);