Get rid of ugly font metrics workarounds.

Now we have proper ligatures and kerning on screen...
This commit is contained in:
Jean-Marc Lasgouttes 2013-07-21 12:24:08 +02:00
parent 35d47698c6
commit 01c9bcb432
8 changed files with 7 additions and 19 deletions

View File

@ -448,7 +448,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
return ReadError; return ReadError;
// default for current rowpainter capabilities // 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 // format prior to 2.0 and introduction of format tag
unsigned int format = 0; unsigned int format = 0;

View File

@ -2417,7 +2417,6 @@ void GuiApplication::restoreGuiSession()
QString const GuiApplication::romanFontName() QString const GuiApplication::romanFontName()
{ {
QFont font; QFont font;
font.setKerning(false);
font.setStyleHint(QFont::Serif); font.setStyleHint(QFont::Serif);
font.setFamily("serif"); font.setFamily("serif");
@ -2428,7 +2427,6 @@ QString const GuiApplication::romanFontName()
QString const GuiApplication::sansFontName() QString const GuiApplication::sansFontName()
{ {
QFont font; QFont font;
font.setKerning(false);
font.setStyleHint(QFont::SansSerif); font.setStyleHint(QFont::SansSerif);
font.setFamily("sans"); font.setFamily("sans");
@ -2439,7 +2437,6 @@ QString const GuiApplication::sansFontName()
QString const GuiApplication::typewriterFontName() QString const GuiApplication::typewriterFontName()
{ {
QFont font; QFont font;
font.setKerning(false);
font.setStyleHint(QFont::TypeWriter); font.setStyleHint(QFont::TypeWriter);
font.setFamily("monospace"); font.setFamily("monospace");

View File

@ -165,7 +165,8 @@ QFont symbolFont(QString const & family, bool * ok)
upper[0] = family[0].toUpper(); upper[0] = family[0].toUpper();
QFont font; QFont font;
font.setKerning(false); if (lyxrc.force_paint_single_char)
font.setKerning(false);
font.setFamily(family); font.setFamily(family);
if (isChosenFont(font, family)) { if (isChosenFont(font, family)) {
@ -256,7 +257,8 @@ static QString makeFontName(QString const & family, QString const & foundry)
GuiFontInfo::GuiFontInfo(FontInfo const & f) GuiFontInfo::GuiFontInfo(FontInfo const & f)
: metrics(QFont()) : metrics(QFont())
{ {
font.setKerning(false); if (lyxrc.force_paint_single_char)
font.setKerning(false);
QString const pat = symbolFamily(f.family()); QString const pat = symbolFamily(f.family());
if (!pat.isEmpty()) { if (!pat.isEmpty()) {
bool ok; bool ok;

View File

@ -132,7 +132,6 @@ GuiLog::GuiLog(GuiView & lv)
logTB->setReadOnly(true); logTB->setReadOnly(true);
QFont font(guiApp->typewriterFontName()); QFont font(guiApp->typewriterFontName());
font.setKerning(false);
font.setFixedPitch(true); font.setFixedPitch(true);
font.setStyleHint(QFont::TypeWriter); font.setStyleHint(QFont::TypeWriter);
logTB->setFont(font); logTB->setFont(font);

View File

@ -314,7 +314,6 @@ static void setComboxFont(QComboBox * cb, string const & family,
// for bug 1063. // for bug 1063.
QFont font; QFont font;
font.setKerning(false);
QString const font_family = toqstr(family); QString const font_family = toqstr(family);
if (font_family == guiApp->romanFontName()) { if (font_family == guiApp->romanFontName()) {

View File

@ -61,7 +61,6 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area,
setWidget(widget_); setWidget(widget_);
QFont font(guiApp->typewriterFontName()); QFont font(guiApp->typewriterFontName());
font.setKerning(false);
font.setFixedPitch(true); font.setFixedPitch(true);
font.setStyleHint(QFont::TypeWriter); font.setStyleHint(QFont::TypeWriter);
widget_->outTE->setFont(font); widget_->outTE->setFont(font);

View File

@ -72,7 +72,6 @@ ViewSourceWidget::ViewSourceWidget()
///dialog_->viewSourceTV->setAcceptRichText(false); ///dialog_->viewSourceTV->setAcceptRichText(false);
// this is personal. I think source code should be in fixed-size font // this is personal. I think source code should be in fixed-size font
QFont font(guiApp->typewriterFontName()); QFont font(guiApp->typewriterFontName());
font.setKerning(false);
font.setFixedPitch(true); font.setFixedPitch(true);
font.setStyleHint(QFont::TypeWriter); font.setStyleHint(QFont::TypeWriter);
viewSourceTV->setFont(font); viewSourceTV->setFont(font);

View File

@ -264,15 +264,7 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
// collect as much similar chars as we can // collect as much similar chars as we can
for (++vpos ; vpos < end ; ++vpos) { for (++vpos ; vpos < end ; ++vpos) {
// Work-around bug #6920 if (lyxrc.force_paint_single_char)
// 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)
break; break;
pos = bidi_.vis2log(vpos); pos = bidi_.vis2log(vpos);