mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
fixed tilde replacements in input fields and Text
This commit is contained in:
parent
bcb80a80fb
commit
e60052d440
3 changed files with 163 additions and 151 deletions
|
@ -917,11 +917,12 @@ QVariant InputArea::InputAreaInner::loadResource(int type, const QUrl &name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputArea::processDocumentContentsChange(int position, int charsAdded) {
|
void InputArea::processDocumentContentsChange(int position, int charsAdded) {
|
||||||
int32 emojiPosition = -1, emojiLen = 0;
|
int32 replacePosition = -1, replaceLen = 0;
|
||||||
const EmojiData *emoji = 0;
|
const EmojiData *emoji = 0;
|
||||||
|
|
||||||
static QString regular = qsl("Open Sans"), semibold = qsl("Open Sans Semibold");
|
static QString regular = qsl("Open Sans"), semibold = qsl("Open Sans Semibold");
|
||||||
bool checkTilde = !cRetina() && (font().pixelSize() == 13) && (font().family() == regular), prevTilde = false;
|
bool checkTilde = !cRetina() && (_inner.font().pixelSize() == 13) && (_inner.font().family() == regular);
|
||||||
|
bool wasTildeFragment = false;
|
||||||
|
|
||||||
QTextDocument *doc(_inner.document());
|
QTextDocument *doc(_inner.document());
|
||||||
QTextCursor c(_inner.textCursor());
|
QTextCursor c(_inner.textCursor());
|
||||||
|
@ -941,65 +942,66 @@ void InputArea::processDocumentContentsChange(int position, int charsAdded) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkTilde) {
|
||||||
|
wasTildeFragment = (fragment.charFormat().fontFamily() == semibold);
|
||||||
|
}
|
||||||
|
|
||||||
QString t(fragment.text());
|
QString t(fragment.text());
|
||||||
const QChar *ch = t.constData(), *e = ch + t.size();
|
const QChar *ch = t.constData(), *e = ch + t.size();
|
||||||
for (; ch != e; ++ch, ++fp) {
|
for (; ch != e; ++ch, ++fp) {
|
||||||
if (checkTilde && fp >= position) { // tilde fix in OpenSans
|
int32 emojiLen = 0;
|
||||||
bool tilde = (ch->unicode() == '~');
|
|
||||||
QString fontfamily;
|
|
||||||
if (tilde) {
|
|
||||||
if (fragment.charFormat().fontFamily() != semibold) {
|
|
||||||
fontfamily = semibold;
|
|
||||||
}
|
|
||||||
} else if (prevTilde) {
|
|
||||||
if (fragment.charFormat().fontFamily() == semibold) {
|
|
||||||
fontfamily = regular;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!fontfamily.isEmpty()) {
|
|
||||||
if (!_inner.document()->pageSize().isNull()) {
|
|
||||||
_inner.document()->setPageSize(QSizeF(0, 0));
|
|
||||||
}
|
|
||||||
emojiPosition = fp;
|
|
||||||
emojiLen = 1;
|
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
|
||||||
QTextCharFormat format;
|
|
||||||
format.setFontFamily(fontfamily);
|
|
||||||
c.mergeCharFormat(format);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
prevTilde = tilde;
|
|
||||||
}
|
|
||||||
|
|
||||||
emoji = emojiFromText(ch, e, emojiLen);
|
emoji = emojiFromText(ch, e, emojiLen);
|
||||||
if (emoji) {
|
if (emoji) {
|
||||||
emojiPosition = fp;
|
if (replacePosition >= 0) {
|
||||||
|
emoji = 0; // replace tilde char format first
|
||||||
|
} else {
|
||||||
|
replacePosition = fp;
|
||||||
|
replaceLen = emojiLen;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkTilde && fp >= position) { // tilde fix in OpenSans
|
||||||
|
bool tilde = (ch->unicode() == '~');
|
||||||
|
if ((tilde && !wasTildeFragment) || (!tilde && wasTildeFragment)) {
|
||||||
|
if (replacePosition < 0) {
|
||||||
|
replacePosition = fp;
|
||||||
|
replaceLen = 1;
|
||||||
|
} else {
|
||||||
|
++replaceLen;
|
||||||
|
}
|
||||||
|
} else if (replacePosition >= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ch + 1 < e && ch->isHighSurrogate() && (ch + 1)->isLowSurrogate()) {
|
if (ch + 1 < e && ch->isHighSurrogate() && (ch + 1)->isLowSurrogate()) {
|
||||||
++ch;
|
++ch;
|
||||||
++fp;
|
++fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) break;
|
if (replacePosition >= 0) break;
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) break;
|
if (replacePosition >= 0) break;
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) {
|
if (replacePosition >= 0) {
|
||||||
if (emoji) {
|
|
||||||
if (!_inner.document()->pageSize().isNull()) {
|
if (!_inner.document()->pageSize().isNull()) {
|
||||||
_inner.document()->setPageSize(QSizeF(0, 0));
|
_inner.document()->setPageSize(QSizeF(0, 0));
|
||||||
}
|
}
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
QTextCursor c(doc->docHandle(), replacePosition);
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
c.setPosition(replacePosition + replaceLen, QTextCursor::KeepAnchor);
|
||||||
|
if (emoji) {
|
||||||
insertEmoji(emoji, c);
|
insertEmoji(emoji, c);
|
||||||
|
} else {
|
||||||
|
QTextCharFormat format;
|
||||||
|
format.setFontFamily(wasTildeFragment ? regular : semibold);
|
||||||
|
c.mergeCharFormat(format);
|
||||||
}
|
}
|
||||||
charsAdded -= emojiPosition + emojiLen - position;
|
charsAdded -= replacePosition + replaceLen - position;
|
||||||
position = emojiPosition + 1;
|
position = replacePosition + (emoji ? 1 : replaceLen);
|
||||||
|
|
||||||
emoji = 0;
|
emoji = 0;
|
||||||
emojiPosition = -1;
|
replacePosition = -1;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1611,11 +1613,13 @@ QVariant InputField::InputFieldInner::loadResource(int type, const QUrl &name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputField::processDocumentContentsChange(int position, int charsAdded) {
|
void InputField::processDocumentContentsChange(int position, int charsAdded) {
|
||||||
int32 emojiPosition = -1, emojiLen = 0;
|
int32 replacePosition = -1, replaceLen = 0;
|
||||||
const EmojiData *emoji = 0;
|
const EmojiData *emoji = 0;
|
||||||
|
bool newlineFound = false;
|
||||||
|
|
||||||
static QString regular = qsl("Open Sans"), semibold = qsl("Open Sans Semibold"), space(' ');
|
static QString regular = qsl("Open Sans"), semibold = qsl("Open Sans Semibold"), space(' ');
|
||||||
bool checkTilde = !cRetina() && (font().pixelSize() == 13) && (font().family() == regular), prevTilde = false;
|
bool checkTilde = !cRetina() && (_inner.font().pixelSize() == 13) && (_inner.font().family() == regular);
|
||||||
|
bool wasTildeFragment = false;
|
||||||
|
|
||||||
QTextDocument *doc(_inner.document());
|
QTextDocument *doc(_inner.document());
|
||||||
QTextCursor c(_inner.textCursor());
|
QTextCursor c(_inner.textCursor());
|
||||||
|
@ -1635,87 +1639,91 @@ void InputField::processDocumentContentsChange(int position, int charsAdded) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkTilde) {
|
||||||
|
wasTildeFragment = (fragment.charFormat().fontFamily() == semibold);
|
||||||
|
}
|
||||||
|
|
||||||
QString t(fragment.text());
|
QString t(fragment.text());
|
||||||
const QChar *ch = t.constData(), *e = ch + t.size();
|
const QChar *ch = t.constData(), *e = ch + t.size();
|
||||||
for (; ch != e; ++ch, ++fp) {
|
for (; ch != e; ++ch, ++fp) {
|
||||||
if (checkTilde && fp >= position) { // tilde fix in OpenSans
|
|
||||||
bool tilde = (ch->unicode() == '~');
|
|
||||||
QString fontfamily;
|
|
||||||
if (tilde) {
|
|
||||||
if (fragment.charFormat().fontFamily() != semibold) {
|
|
||||||
fontfamily = semibold;
|
|
||||||
}
|
|
||||||
} else if (prevTilde) {
|
|
||||||
if (fragment.charFormat().fontFamily() == semibold) {
|
|
||||||
fontfamily = regular;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!fontfamily.isEmpty()) {
|
|
||||||
if (!_inner.document()->pageSize().isNull()) {
|
|
||||||
_inner.document()->setPageSize(QSizeF(0, 0));
|
|
||||||
}
|
|
||||||
emojiPosition = fp;
|
|
||||||
emojiLen = 1;
|
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
|
||||||
QTextCharFormat format;
|
|
||||||
format.setFontFamily(fontfamily);
|
|
||||||
c.mergeCharFormat(format);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
prevTilde = tilde;
|
|
||||||
}
|
|
||||||
|
|
||||||
// QTextBeginningOfFrame // QTextEndOfFrame
|
// QTextBeginningOfFrame // QTextEndOfFrame
|
||||||
if (ch->unicode() == 0xfdd0 || ch->unicode() == 0xfdd1 || ch->unicode() == QChar::ParagraphSeparator || ch->unicode() == QChar::LineSeparator || ch->unicode() == '\n' || ch->unicode() == '\r') {
|
newlineFound = (ch->unicode() == 0xfdd0 || ch->unicode() == 0xfdd1 || ch->unicode() == QChar::ParagraphSeparator || ch->unicode() == QChar::LineSeparator || ch->unicode() == '\n' || ch->unicode() == '\r');
|
||||||
if (!_inner.document()->pageSize().isNull()) {
|
if (newlineFound) {
|
||||||
_inner.document()->setPageSize(QSizeF(0, 0));
|
if (replacePosition >= 0) {
|
||||||
|
newlineFound = false; // replace tilde char format first
|
||||||
|
} else {
|
||||||
|
replacePosition = fp;
|
||||||
|
replaceLen = 1;
|
||||||
}
|
}
|
||||||
emojiPosition = fp;
|
|
||||||
emojiLen = 1;
|
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
|
||||||
c.insertText(space);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 emojiLen = 0;
|
||||||
emoji = emojiFromText(ch, e, emojiLen);
|
emoji = emojiFromText(ch, e, emojiLen);
|
||||||
if (emoji) {
|
if (emoji) {
|
||||||
emojiPosition = fp;
|
if (replacePosition >= 0) {
|
||||||
|
emoji = 0; // replace tilde char format first
|
||||||
|
} else {
|
||||||
|
replacePosition = fp;
|
||||||
|
replaceLen = emojiLen;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkTilde && fp >= position) { // tilde fix in OpenSans
|
||||||
|
bool tilde = (ch->unicode() == '~');
|
||||||
|
if ((tilde && !wasTildeFragment) || (!tilde && wasTildeFragment)) {
|
||||||
|
if (replacePosition < 0) {
|
||||||
|
replacePosition = fp;
|
||||||
|
replaceLen = 1;
|
||||||
|
} else {
|
||||||
|
++replaceLen;
|
||||||
|
}
|
||||||
|
} else if (replacePosition >= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ch + 1 < e && ch->isHighSurrogate() && (ch + 1)->isLowSurrogate()) {
|
if (ch + 1 < e && ch->isHighSurrogate() && (ch + 1)->isLowSurrogate()) {
|
||||||
++ch;
|
++ch;
|
||||||
++fp;
|
++fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) break;
|
if (replacePosition >= 0) break;
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) break;
|
if (replacePosition >= 0) break;
|
||||||
|
|
||||||
if (b.next() != doc->end()) {
|
if (b.next() != doc->end()) {
|
||||||
emojiPosition = b.next().position() - 1;
|
newlineFound = true;
|
||||||
emojiLen = 1;
|
replacePosition = b.next().position() - 1;
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
replaceLen = 1;
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
|
||||||
c.insertText(space);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) {
|
if (replacePosition >= 0) {
|
||||||
if (emoji) {
|
|
||||||
if (!_inner.document()->pageSize().isNull()) {
|
if (!_inner.document()->pageSize().isNull()) {
|
||||||
_inner.document()->setPageSize(QSizeF(0, 0));
|
_inner.document()->setPageSize(QSizeF(0, 0));
|
||||||
}
|
}
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
QTextCursor c(doc->docHandle(), replacePosition);
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
c.setPosition(replacePosition + replaceLen, QTextCursor::KeepAnchor);
|
||||||
|
if (newlineFound) {
|
||||||
|
QTextCharFormat format;
|
||||||
|
format.setFontFamily(regular);
|
||||||
|
c.mergeCharFormat(format);
|
||||||
|
c.insertText(space);
|
||||||
|
} else if (emoji) {
|
||||||
insertEmoji(emoji, c);
|
insertEmoji(emoji, c);
|
||||||
|
} else {
|
||||||
|
QTextCharFormat format;
|
||||||
|
format.setFontFamily(wasTildeFragment ? regular : semibold);
|
||||||
|
c.mergeCharFormat(format);
|
||||||
}
|
}
|
||||||
charsAdded -= emojiPosition + emojiLen - position;
|
charsAdded -= replacePosition + replaceLen - position;
|
||||||
position = emojiPosition + 1;
|
position = replacePosition + ((emoji || newlineFound) ? 1 : replaceLen);
|
||||||
|
|
||||||
|
newlineFound = false;
|
||||||
emoji = 0;
|
emoji = 0;
|
||||||
emojiPosition = -1;
|
replacePosition = -1;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -619,11 +619,11 @@ void FlatTextarea::checkContentHeight() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlatTextarea::processDocumentContentsChange(int position, int charsAdded) {
|
void FlatTextarea::processDocumentContentsChange(int position, int charsAdded) {
|
||||||
int32 emojiPosition = -1, emojiLen = 0;
|
int32 replacePosition = -1, replaceLen = 0;
|
||||||
const EmojiData *emoji = 0;
|
const EmojiData *emoji = 0;
|
||||||
|
|
||||||
static QString regular = qsl("Open Sans"), semibold = qsl("Open Sans Semibold");
|
static QString regular = qsl("Open Sans"), semibold = qsl("Open Sans Semibold");
|
||||||
bool checkTilde = !cRetina() && (font().pixelSize() == 13) && (font().family() == regular), prevTilde = false;
|
bool checkTilde = !cRetina() && (font().pixelSize() == 13) && (font().family() == regular), wasTildeFragment = false;
|
||||||
|
|
||||||
QTextDocument *doc(document());
|
QTextDocument *doc(document());
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -640,65 +640,67 @@ void FlatTextarea::processDocumentContentsChange(int position, int charsAdded) {
|
||||||
if (fp >= end || fe <= start) {
|
if (fp >= end || fe <= start) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkTilde) {
|
||||||
|
wasTildeFragment = (fragment.charFormat().fontFamily() == semibold);
|
||||||
|
}
|
||||||
|
|
||||||
QString t(fragment.text());
|
QString t(fragment.text());
|
||||||
const QChar *ch = t.constData(), *e = ch + t.size();
|
const QChar *ch = t.constData(), *e = ch + t.size();
|
||||||
for (; ch != e; ++ch, ++fp) {
|
for (; ch != e; ++ch, ++fp) {
|
||||||
if (checkTilde && fp >= position) { // tilde fix in OpenSans
|
int32 emojiLen = 0;
|
||||||
bool tilde = (ch->unicode() == '~');
|
|
||||||
QString fontfamily;
|
|
||||||
if (tilde) {
|
|
||||||
if (fragment.charFormat().fontFamily() != semibold) {
|
|
||||||
fontfamily = semibold;
|
|
||||||
}
|
|
||||||
} else if (prevTilde) {
|
|
||||||
if (fragment.charFormat().fontFamily() == semibold) {
|
|
||||||
fontfamily = regular;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!fontfamily.isEmpty()) {
|
|
||||||
if (!document()->pageSize().isNull()) {
|
|
||||||
document()->setPageSize(QSizeF(0, 0));
|
|
||||||
}
|
|
||||||
emojiPosition = fp;
|
|
||||||
emojiLen = 1;
|
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
|
||||||
QTextCharFormat format;
|
|
||||||
format.setFontFamily(fontfamily);
|
|
||||||
c.mergeCharFormat(format);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
prevTilde = tilde;
|
|
||||||
}
|
|
||||||
|
|
||||||
emoji = emojiFromText(ch, e, emojiLen);
|
emoji = emojiFromText(ch, e, emojiLen);
|
||||||
if (emoji) {
|
if (emoji) {
|
||||||
emojiPosition = fp;
|
if (replacePosition >= 0) {
|
||||||
|
emoji = 0; // replace tilde char format first
|
||||||
|
} else {
|
||||||
|
replacePosition = fp;
|
||||||
|
replaceLen = emojiLen;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkTilde && fp >= position) { // tilde fix in OpenSans
|
||||||
|
bool tilde = (ch->unicode() == '~');
|
||||||
|
if ((tilde && !wasTildeFragment) || (!tilde && wasTildeFragment)) {
|
||||||
|
if (replacePosition < 0) {
|
||||||
|
replacePosition = fp;
|
||||||
|
replaceLen = 1;
|
||||||
|
} else {
|
||||||
|
++replaceLen;
|
||||||
|
}
|
||||||
|
} else if (replacePosition >= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ch + 1 < e && ch->isHighSurrogate() && (ch + 1)->isLowSurrogate()) {
|
if (ch + 1 < e && ch->isHighSurrogate() && (ch + 1)->isLowSurrogate()) {
|
||||||
++ch;
|
++ch;
|
||||||
++fp;
|
++fp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) break;
|
if (replacePosition >= 0) break;
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) break;
|
if (replacePosition >= 0) break;
|
||||||
}
|
}
|
||||||
if (emojiPosition >= 0) {
|
if (replacePosition >= 0) {
|
||||||
if (emoji) {
|
|
||||||
if (!document()->pageSize().isNull()) {
|
if (!document()->pageSize().isNull()) {
|
||||||
document()->setPageSize(QSizeF(0, 0));
|
document()->setPageSize(QSizeF(0, 0));
|
||||||
}
|
}
|
||||||
QTextCursor c(doc->docHandle(), emojiPosition);
|
QTextCursor c(doc->docHandle(), replacePosition);
|
||||||
c.setPosition(emojiPosition + emojiLen, QTextCursor::KeepAnchor);
|
c.setPosition(replacePosition + replaceLen, QTextCursor::KeepAnchor);
|
||||||
|
if (emoji) {
|
||||||
insertEmoji(emoji, c);
|
insertEmoji(emoji, c);
|
||||||
|
} else {
|
||||||
|
QTextCharFormat format;
|
||||||
|
format.setFontFamily(wasTildeFragment ? regular : semibold);
|
||||||
|
c.mergeCharFormat(format);
|
||||||
}
|
}
|
||||||
charsAdded -= emojiPosition + emojiLen - position;
|
charsAdded -= replacePosition + replaceLen - position;
|
||||||
position = emojiPosition + 1;
|
position = replacePosition + (emoji ? 1 : replaceLen);
|
||||||
|
|
||||||
emoji = 0;
|
emoji = 0;
|
||||||
emojiPosition = -1;
|
replacePosition = -1;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ public:
|
||||||
int skipBack = 0;
|
int skipBack = 0;
|
||||||
ch = ((ptr < end) ? *ptr : 0);
|
ch = ((ptr < end) ? *ptr : 0);
|
||||||
chInt = ch.unicode();
|
chInt = ch.unicode();
|
||||||
bool skip = false, isNewLine = multiline && chIsNewline(ch), isSpace = chIsSpace(ch), isDiac = chIsDiac(ch), isTilde = (ch == '~');
|
bool skip = false, isNewLine = multiline && chIsNewline(ch), isSpace = chIsSpace(ch), isDiac = chIsDiac(ch), isTilde = checkTilde && (ch == '~');
|
||||||
if (chIsBad(ch) || ch.isLowSurrogate()) {
|
if (chIsBad(ch) || ch.isLowSurrogate()) {
|
||||||
skip = true;
|
skip = true;
|
||||||
} else if (isDiac) {
|
} else if (isDiac) {
|
||||||
|
@ -577,12 +577,12 @@ public:
|
||||||
} else {
|
} else {
|
||||||
if (isTilde) { // tilde fix in OpenSans
|
if (isTilde) { // tilde fix in OpenSans
|
||||||
if (!(flags & TextBlockFTilde)) {
|
if (!(flags & TextBlockFTilde)) {
|
||||||
createBlock();
|
createBlock(skipBack);
|
||||||
flags |= TextBlockFTilde;
|
flags |= TextBlockFTilde;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (flags & TextBlockFTilde) {
|
if (flags & TextBlockFTilde) {
|
||||||
createBlock();
|
createBlock(skipBack);
|
||||||
flags &= ~TextBlockFTilde;
|
flags &= ~TextBlockFTilde;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -688,6 +688,7 @@ public:
|
||||||
|
|
||||||
ch = chInt = 0;
|
ch = chInt = 0;
|
||||||
lastSkipped = false;
|
lastSkipped = false;
|
||||||
|
checkTilde = !cRetina() && _t->_font->size() == 13 && _t->_font->flags() == 0; // tilde Open Sans fix
|
||||||
entitiesEnd = entities.cend();
|
entitiesEnd = entities.cend();
|
||||||
waitingEntity = entities.cbegin();
|
waitingEntity = entities.cbegin();
|
||||||
while (waitingEntity != entitiesEnd && waitingEntity->length <= 0) ++waitingEntity;
|
while (waitingEntity != entitiesEnd && waitingEntity->length <= 0) ++waitingEntity;
|
||||||
|
@ -784,6 +785,7 @@ private:
|
||||||
QChar ch; // current char (low surrogate, if current char is surrogate pair)
|
QChar ch; // current char (low surrogate, if current char is surrogate pair)
|
||||||
uint32 chInt; // full ch, could be surrogate pair
|
uint32 chInt; // full ch, could be surrogate pair
|
||||||
bool lastSkipped; // did we skip current char
|
bool lastSkipped; // did we skip current char
|
||||||
|
bool checkTilde; // do we need a special text block for tilde symbol
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -1785,7 +1787,7 @@ public:
|
||||||
}
|
}
|
||||||
if (flags & TextBlockFItalic) result = result->italic();
|
if (flags & TextBlockFItalic) result = result->italic();
|
||||||
if (flags & TextBlockFUnderline) result = result->underline();
|
if (flags & TextBlockFUnderline) result = result->underline();
|
||||||
if ((flags & TextBlockFTilde) && !cRetina() && f->size() == 13 && f->flags() == 0) { // tilde fix in OpenSans
|
if (flags & TextBlockFTilde) { // tilde fix in OpenSans
|
||||||
result = st::semiboldFont;
|
result = st::semiboldFont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3244,7 +3246,7 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
|
||||||
}
|
}
|
||||||
if (flags & TextBlockFItalic) blockFont = blockFont->italic();
|
if (flags & TextBlockFItalic) blockFont = blockFont->italic();
|
||||||
if (flags & TextBlockFUnderline) blockFont = blockFont->underline();
|
if (flags & TextBlockFUnderline) blockFont = blockFont->underline();
|
||||||
if ((flags & TextBlockFTilde) && !cRetina() && font->size() == 13 && font->flags() == 0) { // tilde fix in OpenSans
|
if (flags & TextBlockFTilde) { // tilde fix in OpenSans
|
||||||
blockFont = st::semiboldFont;
|
blockFont = st::semiboldFont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue