Compilation fix for QT2

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5417 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2002-10-15 16:48:53 +00:00
parent c2771dd61f
commit f4af5ce9cf
2 changed files with 9 additions and 2 deletions

View File

@ -257,14 +257,16 @@ Painter & QLPainter::text(int x, int y,
encoding = encodings.symbol_encoding(); encoding = encodings.symbol_encoding();
QString str; QString str;
#if QT_VERSION >= 0x030000
str.setLength(ls); str.setLength(ls);
for (size_t i = 0; i < ls; ++i) for (size_t i = 0; i < ls; ++i)
str[i] = QChar(encoding->ucs(s[i])); str[i] = QChar(encoding->ucs(s[i]));
#if QT_VERSION >= 0x030000
// HACK: QT3 refuses to show single compose characters // HACK: QT3 refuses to show single compose characters
if (ls = 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2) if (ls = 1 && str[0].unicode() >= 0x05b0 && str[0].unicode() <= 0x05c2)
str = ' '+str; str = ' '+str;
#else
for (size_t i = 0; i < ls; ++i)
str += QChar(encoding->ucs(s[i]));
#endif #endif
if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) { if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {

View File

@ -85,9 +85,14 @@ int width(char const * s, size_t ls, LyXFont const & f)
encoding = encodings.symbol_encoding(); encoding = encodings.symbol_encoding();
QString str; QString str;
#if QT_VERSION >= 0x030000
str.setLength(ls); str.setLength(ls);
for (size_t i = 0; i < ls; ++i) for (size_t i = 0; i < ls; ++i)
str[i] = QChar(encoding->ucs(s[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) { if (f.realShape() != LyXFont::SMALLCAPS_SHAPE) {
return metrics(f).width(str); return metrics(f).width(str);