commit 01c9bcb4328b286a922215c3c1a1583949c33d10 Author: Jean-Marc Lasgouttes <lasgout...@lyx.org> Date: Sun Jul 21 12:24:08 2013 +0200
Get rid of ugly font metrics workarounds. Now we have proper ligatures and kerning on screen... diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 2cc0369..0138f61 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -448,7 +448,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) return ReadError; // default for current rowpainter capabilities - force_paint_single_char = true; + //force_paint_single_char = true; + force_paint_single_char = false; // format prior to 2.0 and introduction of format tag unsigned int format = 0; diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index f6c8433..660b122 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -2417,7 +2417,6 @@ void GuiApplication::restoreGuiSession() QString const GuiApplication::romanFontName() { QFont font; - font.setKerning(false); font.setStyleHint(QFont::Serif); font.setFamily("serif"); @@ -2428,7 +2427,6 @@ QString const GuiApplication::romanFontName() QString const GuiApplication::sansFontName() { QFont font; - font.setKerning(false); font.setStyleHint(QFont::SansSerif); font.setFamily("sans"); @@ -2439,7 +2437,6 @@ QString const GuiApplication::sansFontName() QString const GuiApplication::typewriterFontName() { QFont font; - font.setKerning(false); font.setStyleHint(QFont::TypeWriter); font.setFamily("monospace"); diff --git a/src/frontends/qt4/GuiFontLoader.cpp b/src/frontends/qt4/GuiFontLoader.cpp index fa5370c..4b79071 100644 --- a/src/frontends/qt4/GuiFontLoader.cpp +++ b/src/frontends/qt4/GuiFontLoader.cpp @@ -165,7 +165,8 @@ QFont symbolFont(QString const & family, bool * ok) upper[0] = family[0].toUpper(); QFont font; - font.setKerning(false); + if (lyxrc.force_paint_single_char) + font.setKerning(false); font.setFamily(family); if (isChosenFont(font, family)) { @@ -256,7 +257,8 @@ static QString makeFontName(QString const & family, QString const & foundry) GuiFontInfo::GuiFontInfo(FontInfo const & f) : metrics(QFont()) { - font.setKerning(false); + if (lyxrc.force_paint_single_char) + font.setKerning(false); QString const pat = symbolFamily(f.family()); if (!pat.isEmpty()) { bool ok; diff --git a/src/frontends/qt4/GuiLog.cpp b/src/frontends/qt4/GuiLog.cpp index d81849a..2f1ef16 100644 --- a/src/frontends/qt4/GuiLog.cpp +++ b/src/frontends/qt4/GuiLog.cpp @@ -132,7 +132,6 @@ GuiLog::GuiLog(GuiView & lv) logTB->setReadOnly(true); QFont font(guiApp->typewriterFontName()); - font.setKerning(false); font.setFixedPitch(true); font.setStyleHint(QFont::TypeWriter); logTB->setFont(font); diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 6dfd337..396cab3 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -314,7 +314,6 @@ static void setComboxFont(QComboBox * cb, string const & family, // for bug 1063. QFont font; - font.setKerning(false); QString const font_family = toqstr(family); if (font_family == guiApp->romanFontName()) { diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp index a22ea60..2e0dfad 100644 --- a/src/frontends/qt4/GuiProgressView.cpp +++ b/src/frontends/qt4/GuiProgressView.cpp @@ -61,7 +61,6 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, setWidget(widget_); QFont font(guiApp->typewriterFontName()); - font.setKerning(false); font.setFixedPitch(true); font.setStyleHint(QFont::TypeWriter); widget_->outTE->setFont(font); diff --git a/src/frontends/qt4/GuiViewSource.cpp b/src/frontends/qt4/GuiViewSource.cpp index b2df874..68041d8 100644 --- a/src/frontends/qt4/GuiViewSource.cpp +++ b/src/frontends/qt4/GuiViewSource.cpp @@ -72,7 +72,6 @@ ViewSourceWidget::ViewSourceWidget() ///dialog_->viewSourceTV->setAcceptRichText(false); // this is personal. I think source code should be in fixed-size font QFont font(guiApp->typewriterFontName()); - font.setKerning(false); font.setFixedPitch(true); font.setStyleHint(QFont::TypeWriter); viewSourceTV->setFont(font); diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index cfa7f51..3f664f0 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -264,15 +264,7 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font, // collect as much similar chars as we can for (++vpos ; vpos < end ; ++vpos) { - // Work-around bug #6920 - // The bug can be reproduced with DejaVu font under Linux. - // The issue is that we compute the metrics character by character - // in ParagraphMetrics::singleWidth(); but we paint word by word - // for performance reason. - // Maybe a more general fix would be draw character by character - // for some predefined fonts on some platform. In arabic and - // Hebrew we already do paint this way. - if (prev_char == 'f' || lyxrc.force_paint_single_char) + if (lyxrc.force_paint_single_char) break; pos = bidi_.vis2log(vpos);