From f6e7fbefce2703a0891b35fff34dc152abc3f283 Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Thu, 24 Feb 2011 21:38:12 +0000 Subject: [PATCH] #6920 paint single characters only when Qt4.7 or better, otherwise automatic kerning breaks cursor positioning git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37781 a592a061-630c-0410-9148-cb99ea01b6c8 --- po/it.po | 1 + src/LyXRC.cpp | 21 +++++++++++++++++++++ src/LyXRC.h | 3 +++ src/frontends/qt4/GuiApplication.cpp | 7 +++++++ src/rowpainter.cpp | 4 ++-- 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/po/it.po b/po/it.po index e8544df4ca..1ff97695e9 100644 --- a/po/it.po +++ b/po/it.po @@ -24750,6 +24750,7 @@ msgstr "Utente sconosciuto" #~ msgid "&Previous" #~ msgstr "&Precedente" + #~ msgid "Ch. " #~ msgstr "Cap. " diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 185067100a..d7e2a786ed 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -99,6 +99,7 @@ LexerKeyword lyxrcTags[] = { { "\\example_path", LyXRC::RC_EXAMPLEPATH }, { "\\export_overwrite", LyXRC::RC_EXPORT_OVERWRITE }, { "\\font_encoding", LyXRC::RC_FONT_ENCODING }, + { "\\force_paint_single_char", LyXRC::RC_FORCE_PAINT_SINGLE_CHAR }, { "\\format", LyXRC::RC_FILEFORMAT }, { "\\forward_search_dvi", LyXRC::RC_FORWARD_SEARCH_DVI }, { "\\forward_search_pdf", LyXRC::RC_FORWARD_SEARCH_PDF }, @@ -422,6 +423,9 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) if (!lexrc.isOK()) return ReadError; + // default for current rowpainter capabilities + force_paint_single_char = true; + // format prior to 2.0 and introduction of format tag unsigned int format = 0; @@ -523,6 +527,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format) lexrc >> fontenc; break; + case RC_FORCE_PAINT_SINGLE_CHAR: + lexrc >> force_paint_single_char; + break; + case RC_PRINTER: lexrc >> printer; break; @@ -2180,6 +2188,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c if (tag != RC_LAST) break; + case RC_FORCE_PAINT_SINGLE_CHAR: + if (ignore_system_lyxrc || + force_paint_single_char != system_lyxrc.force_paint_single_char) { + os << "\\force_paint_single_char \"" << force_paint_single_char << "\"\n"; + } + if (tag != RC_LAST) + break; + os << "\n#\n" << "# FILE SECTION ######################################\n" << "#\n\n"; @@ -2880,6 +2896,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_ESC_CHARS: case LyXRC::RC_EXAMPLEPATH: case LyXRC::RC_FONT_ENCODING: + case LyXRC::RC_FORCE_PAINT_SINGLE_CHAR: case LyXRC::RC_FILEFORMAT: case LyXRC::RC_GROUP_LAYOUTS: case LyXRC::RC_HUNSPELLDIR_PATH: @@ -3122,6 +3139,10 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages."); break; + case RC_FORCE_PAINT_SINGLE_CHAR: + str = _("Disable any kerning and ligatures for text drawing on screen."); + break; + case RC_FILEFORMAT: break; diff --git a/src/LyXRC.h b/src/LyXRC.h index d94b861cb3..cd2041abd2 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -79,6 +79,7 @@ public: RC_EXAMPLEPATH, RC_EXPORT_OVERWRITE, RC_FONT_ENCODING, + RC_FORCE_PAINT_SINGLE_CHAR, RC_FILEFORMAT, RC_FORWARD_SEARCH_DVI, RC_FORWARD_SEARCH_PDF, @@ -527,6 +528,8 @@ public: }; /// ScrollWheelZoom scroll_wheel_zoom; + /// + bool force_paint_single_char; }; diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index f2ba321c3d..34c44e2c5e 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1838,6 +1838,13 @@ void GuiApplication::createView(QString const & geometry_arg, bool autoShow, if (d->global_menubar_) d->global_menubar_->releaseKeyboard(); +#if QT_VERSION < 0x040700 + // the option to disable kerning in rowpainter + // is needed only with Qt4.7.0 or better + lyxrc.force_paint_single_char = false; + system_lyxrc.force_paint_single_char = false; +#endif + // create new view int id = view_id; while (d->views_.find(id) != d->views_.end()) diff --git a/src/rowpainter.cpp b/src/rowpainter.cpp index 12fb486a05..7625909e50 100644 --- a/src/rowpainter.cpp +++ b/src/rowpainter.cpp @@ -267,9 +267,9 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font, // 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') + if (prev_char == 'f' || lyxrc.force_paint_single_char) break; - + pos = bidi_.vis2log(vpos); if (pos < font_span.first || pos > font_span.last) break;