diff options
Diffstat (limited to 'src/fqterm/fqterm_screen.cpp')
-rw-r--r-- | src/fqterm/fqterm_screen.cpp | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/src/fqterm/fqterm_screen.cpp b/src/fqterm/fqterm_screen.cpp index 897a928..5215a7b 100644 --- a/src/fqterm/fqterm_screen.cpp +++ b/src/fqterm/fqterm_screen.cpp @@ -1,22 +1,4 @@ -/**************************************************************************** - * fqterm, a terminal emulator for both BBS and *nix. * - * Copyright (C) 2008 fqterm development group. * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * - ***************************************************************************/ +// SPDX-License-Identifier: GPL-2.0-or-later @@ -315,14 +297,14 @@ void FQTermScreen::setFontMetrics() { QFontMetrics englishFM(*englishFont_); // FIXME: find a typical character for the current language. - int cn = nonEnglishFM.width(QChar(0x4e2D)); - int en = englishFM.width('W'); + int cn = nonEnglishFM.horizontalAdvance(QChar(0x4e2D)); + int en = englishFM.horizontalAdvance('W'); int pix_size = nonEnglishFont_->pixelSize(); while (cn % 2 && pix_size > 10) { nonEnglishFont_->setPixelSize(--pix_size); nonEnglishFM = QFontMetrics(*nonEnglishFont_); - cn = nonEnglishFM.width(QChar(0x4e2D)); + cn = nonEnglishFM.horizontalAdvance(QChar(0x4e2D)); } pix_size = englishFont_->pixelSize(); @@ -330,7 +312,7 @@ void FQTermScreen::setFontMetrics() { --pix_size; englishFont_->setPixelSize(pix_size); englishFM = QFontMetrics(*englishFont_); - en = englishFM.width('W'); + en = englishFM.horizontalAdvance('W'); /* #ifndef __APPLE__ //FIXME: correctly draw chars with left/right bearing. @@ -351,7 +333,7 @@ void FQTermScreen::setFontMetrics() { cnLetterSpacing_ = qMax(charWidth_ * 2 - cn, 0.0); enLetterSpacing_ = qMax(charWidth_ - en, 0.0); - spLetterSpacing_ = qMax(charWidth_ - englishFM.width(' '), 0.0); + spLetterSpacing_ = qMax(charWidth_ - englishFM.horizontalAdvance(' '), 0.0); fontAscent_ = qMax(englishFM.ascent(), nonEnglishFM.ascent()); fontDescent_ = qMax(englishFM.descent(), nonEnglishFM.descent()); @@ -1583,11 +1565,11 @@ void FQTermScreen::updateFixedPitchInfo() { cnFont.setPixelSize(cnPixelSize); enFont.setPixelSize(enPixelSize); QString cnTestString = QString::fromUtf8("\xe5\x9c\xb0\xe6\x96\xb9\xe6\x94\xbf\xe5\xba\x9c"); - cnFixedPitch_ = (QFontMetrics(cnFont).width(cnTestString) == - cnTestString.length() * QFontMetrics(cnFont).width(cnTestString.at(0))); + cnFixedPitch_ = (QFontMetrics(cnFont).horizontalAdvance(cnTestString) == + cnTestString.length() * QFontMetrics(cnFont).horizontalAdvance(cnTestString.at(0))); QString enTestString = QString::fromUtf8("www.newsmth.net"); enFixedPitch_ = QFontInfo(enFont).fixedPitch() && - (QFontMetrics(enFont).width(enTestString) == enTestString.length() * QFontMetrics(enFont).width(enTestString.at(0))); + (QFontMetrics(enFont).horizontalAdvance(enTestString) == enTestString.length() * QFontMetrics(enFont).horizontalAdvance(enTestString.at(0))); FQ_TRACE("font", 10) << "\nenglish: " << enFixedPitch_ << "\n chinese: " << cnFixedPitch_; |