Commit Graph

32578 Commits

Author SHA1 Message Date
Juergen Spitzmueller
cc56c64ede Fix beamer block conversion when arguments are in multiple ERTS.
Fixes second part of #9208.
2014-07-27 11:30:25 +02:00
Juergen Spitzmueller
728cf1edf3 Add beamer-resenumerate (from our wiki) to the list of safe modules for argment conversion, since it is safe.
Fixes part of #9208.
2014-07-27 10:23:17 +02:00
Jean-Marc Lasgouttes
7f7dc5d314 Whitespace 2014-07-26 16:29:23 +02:00
Jean-Marc Lasgouttes
5e126d2920 Whitespace only 2014-07-25 22:36:20 +02:00
Kornel Benko
5acc6b3791 Make it compilable under cmake again after the merge from str-metrics 2014-07-25 22:03:59 +02:00
Jean-Marc Lasgouttes
b54deb3683 Rename rowpainter.* to RowPainter.*
This is the convention for files that define classes.
2014-07-25 21:55:08 +02:00
Jean-Marc
41740ea915 Merge remote-tracking branch 'features/str-metrics'
This branch implements string-wise metrics computation. The goal is to
have both good metrics computation (and font with proper kerning and
ligatures) and better performance than what we have with
force_paint_single_char. Moreover there has been some code
factorization in TextMetrics, where the same row-breaking algorithm
was basically implemented 3 times.

Globally, the new code is a bit shorter than the existing one, and it
is much cleaner.  There is still a lot of potential for code removal,
especially in the RowPainter, which should be rewritten to use the new
Row information.

The bugs fixed and caused by this branch are tracked at ticket #9003:
http://www.lyx.org/trac/ticket/9003

What is done:

* Make TextMetrics methods operate on Row objects: breakRow and
  setRowHeight instead of rowBreakPoint and rowHeight.

* Change breakRow operation to operate at strings level to compute
  metrics The list of elements is stored in the row object in visual
  ordering, not logical. This will eventually allow to get rid of the
  Bidi class.

* rename getColumnNearX to getPosNearX (and change code accordingly).
  It does not make sense to return a position relative to the start of
  row, since nobody needs this.

* Re-implement cursorX and getPosNearX using row elements.

* Get rid of lyxrc.force_paint_single_char. This was a workaround that
  is not necessary anymore.

* Implement proper string metrics computation (with cache). Remove
  useless workarounds which disable kerning and ligatures.

* Draw also RtL text string-wise. This speeds-up drawing.

* Do not cut strings at selection boundary in RowPainter. This avoids
  ligature/kerning breaking in latin text, and bad rendering problems
  in Arabic.

* Remove homebrew Arabic and Hebrew support from Encoding.cpp. We now
  rely on Qt to do handle complex scripts.

* Get rid of LyXRC::rtl_support, which does not have a real use case.

* Fix display of [] and {} delimiters in Arabic scripts.
2014-07-25 20:10:55 +02:00
Jean-Marc
1fefbf5bdc Fix bad use of undo kind in Tabular inset. 2014-07-25 20:03:42 +02:00
Jean-Marc
9bfbaed2b5 remove branch documentation 2014-07-25 20:01:04 +02:00
Jean-Marc
6ee39ff90a Fix logic error for spacing of RTL rows
The code referred to vpos (the visible position) instead of pos, the logical one.
This can lead to using the wrong font when computing spaces width.
2014-07-25 19:59:37 +02:00
Jean-Marc
3599285019 Fix display of parenthesis in arabic
Actually the workaround that is used to show parenthesis in the right direction
is not needed any more, since this is part of the unicode bidi writing algorithm.

This fixes at the same time the use of [] or  as delimiters in arabic, which was wrong on screen.

Note that there is a problem with hebrew, but this will require a fileformat change.
2014-07-25 19:59:37 +02:00
Jean-Marc
f4fc035cf6 Better algorithm for forcing bidi drawing
The use of RLO/LRO overrides to force text orientation was really hackish and the way it was done caused dropped letters in Mac OS X (for some unknown reasons).

This new approach is much cleaner, except that it relies on features not advertised in documentation
but present at least from Qt 4.5 to Qt 5.3:
* TextFlag enum values TextForceLeftToRight and TextForceRightToLeft, which are strong versions
  of QPainter::setLayoutDirection; they are passed as a parameter of QPainter::drawText.

* QTextLayout::setFlags method, which is required to pass the above flags to QTextLayout.

The unicode override method is still used to draw strings Mac OS X because, for some reason, the direction was not really enforced in this case.
2014-07-25 19:56:51 +02:00
Kornel Benko
63976066ad avoid qt4 variable names in cmake build 2014-07-21 08:49:05 +02:00
Jean-Marc Lasgouttes
bbe6e9f593 Revert optimization where several words are drawn at the same time
This can only be done where splitting of string is identical in row breaking and display. It will be possible to reintroduce this when row painting uses the tokenized row information.
2014-07-20 18:54:31 +02:00
Stephan Witt
b06abbbdbc avoid qt4 variable names 2014-07-20 18:16:36 +02:00
Enrico Forestieri
4bdeae2733 Update autotools for building with Qt5.
The option --enable-qt5 allows configuring for Qt5. The default is Qt4.
Nothing special is done with respect to Qt4, apart from pulling in the
correct libraries. Indeed, other than the core and gui libraries, now
also the concurrent and widgets libraries are needed.
2014-07-19 03:34:28 +02:00
Enrico Forestieri
4342411297 Fix build on FreeBSD.
Notified by Raphael Kubo da Costa.
2014-07-16 22:28:46 +02:00
Stephan Witt
0eb2df6ab6 do not strip binary for packaging by default; improved name of disk image 2014-07-16 22:25:25 +02:00
Enrico Forestieri
294d08b1bf Add forward search command for qpdfview.
Also update docs explaining how to activate reverse search in qpdfview.
2014-07-13 20:08:43 +02:00
Enrico Forestieri
d5210c555a Add some postscript and pdf viewers for Unix and Windows.
For Windows: AcroRd32 and gsview (both 32 and 64 bit versions).
For Unix: qpdfview.

Qpdfview is a nice alternative to Okular for KDE users and a superior
alternative to Evince for Gnome users, due to its complete synctex
support. It only depends on Qt libraries for the graphical interface.
2014-07-13 20:05:37 +02:00
Enrico Forestieri
ff506c8e42 Use getent instead of grepping /etc/passwd.
Forthcoming versions of cygwin will use a different mechanism for
obtaining passwd/group information based on /etc/nsswitch.conf.
Thus, it will not be guaranteed that the files /etc/passwd and
/etc/group even exist. The recommended way for obtaining those
info is by using the getent command, which already works in
current versions.
2014-07-13 14:39:05 +02:00
Enrico Forestieri
2af17f8f89 Revert 6a5aa1ca
That commit is obsoleted by 5bd14af8.
2014-07-12 19:52:12 +02:00
Enrico Forestieri
5bd14af887 Fix bug #9193: Spacing modification not exact
The conversion from floating point to string performed by
boost:lexical_cast does not allow specifying a precision and,
for example, values such as 0.9 are resturned as 0.899999976.
The standard C++ way for performing the conversion is using
std::ostringstream which is exempt from this problem, even if
less efficient. For the sake of accuracy, boost::lexical_cast
is ditched in favor of the ostrinsgstream implementation.
In C++11 another option would be using std::to_string, but I
think it is not as efficient as the boost way and not worth
implementing through #ifdef's.
Incidentally, this patch would have also fixed #9190 and all
similar cases involving the use of convert<string>(float|double).
2014-07-12 19:12:08 +02:00
Enrico Forestieri
b3735501c7 Fix compatibility issue with 64-bit cygwin. 2014-07-11 16:49:10 +02:00
Enrico Forestieri
6a5aa1cab1 Fix scale parameter for fonts.
When a font is scaled by a certain percentage in the document settings,
LyX was outputting a ridiculous parameter value. For example, if the
font is scaled 90%, the corresponding parameter was "scaled=0.899999976".
The patch avoids this and, in the previous case, one gets "scaled=0.9".
This is not only cosmetic, because in roundtrip conversions the parameter
would be continuosly changing.

This commit and b60b505f should be backported to the 2.1.x branch, where
reimporting with tex2lyx an exported document produces wrong results
(also in version 2.1.0).
2014-07-11 16:12:08 +02:00
Enrico Forestieri
b60b505fd8 Fix import of latex documents with scaled fonts. 2014-07-11 11:21:45 +02:00
Enrico Forestieri
60a1b3b83c Fix make check. 2014-07-11 11:14:02 +02:00
Georg Baum
98fc5e518f Support new languages in tex2lyx
I forgot that this was part of the file format update as well.
Also fix a mixup of "english" and "uppersorbian".
2014-07-10 22:15:34 +02:00
Georg Baum
1a073ea416 Missing file format bis from 0c3b88e3 2014-07-10 21:59:17 +02:00
Jean-Marc Lasgouttes
45eb314a86 Get rid of rtl_support preference
This variable was introduced to guard against any bad consequence of the then-new right-to-left
languages support. Let's be bold and get rid of it altogether!

Now right to left support is always enabled.
2014-07-09 21:11:08 +02:00
Jean-Marc Lasgouttes
9d5c947110 Remove LyXRC option force_paint_single_char
It was not honored anymore.
2014-07-08 23:12:09 +02:00
Jean-Marc Lasgouttes
4bd5a7e883 Move some text from the readme file to relevant source files 2014-07-08 21:30:06 +02:00
Jean-Marc Lasgouttes
f3924a52b3 Reintroduce the code related to InsetEnvSeparator
This commits (tries to) reintroduce properly the code that was reverted at the beginning of this branch. This had to be done because these patches interefered with the big refactoring of TextMetrics.cpp.

This commit reintroduces the changes to TextMetrics.cpp contained in c668ebf6, c85dbfea9 and 061509bf.
2014-07-08 21:30:06 +02:00
Jean-Marc Lasgouttes
d6337a2488 Remove obsolete code to handle Hebrew and Arabic characters
This is handled by Qt now.

Note that a small optimization (do not draw text that is to the left
of WorkArea) is removed because it cannot be guaranteed to be exact
anymore. It was probably not very useful anyway, and would become
useless once the RowPainter is rewritten to use Row information.

Update 00README_STR_METRICS_BRANCH.
2014-07-08 21:30:06 +02:00
Jean-Marc Lasgouttes
ec42b2e4c9 Do not split words at selection boundary
The display of partially-selected word is now done in a new Painter::text method
which displays the string twice with different clip settings. This allows to
catter for the case where Color_selectiontext is not black.

Morover, the code that uses unicode override characters to force the
direction of a string is moved to lstrings.h.

Fixes: #9116
2014-07-08 21:30:06 +02:00
Jean-Marc Lasgouttes
e1c4cb7146 Fix breaking of loooong word in RTL languages
Moreover, breaks row at insets when there is no suitable separator.

Also make the code of Row::shorten_if_needed somewhat simpler by using
iterators and factoring the code.

Fixes: #9120
2014-07-08 21:30:05 +02:00
Jean-Marc Lasgouttes
2ff639a0e6 Fix positionning of cursor
The old implementation of Row::Element::pos2x and x2pos did not work
correctly with Arabic text, because characters can have shapes that
depend on context.

This new implementation leverages QTextLayout in a simplified way,
since only one word is added to the layout.

This allows to make Row::Element::x2pos more readable.

Fixes: #9115.
2014-07-08 21:30:05 +02:00
Jean-Marc Lasgouttes
4176795e72 Remove support for LyXRC::force_paint_single_char
This workaround is not necessary anymore, and it complicates the code.

The variable itself will be removed after the landing of the branch on
master.
2014-07-08 21:30:05 +02:00
Jean-Marc Lasgouttes
973adaf7d1 Update description of what has been done in the branch. 2014-07-08 21:30:05 +02:00
Jean-Marc Lasgouttes
b0543270a9 Remove debug code from TextMetrics
After this, it is possible to remove one parameter to getPosNearX.
2014-07-08 21:29:52 +02:00
Jean-Marc Lasgouttes
7734270163 Speed-up drawing when text is not justified.
Do not cut strings at separators in RowPainter when text is not
justified. This speeds-up painting by reducing the number of strings
to draw.

Do also a modest cleanup of paintChar (remove dubious optimization).
2014-07-08 21:24:01 +02:00
Jean-Marc Lasgouttes
3013ce3716 Implement a better solution for painting of RTL text
Instead of relying on character range (Hebrew or Arabic) or character
direction, use RLO unicode character (Right-to-Left override) to force
painting in the direction indicated by the current font. This should
be as close as we can to the old LyX behavior (and requires less
code).

If this code works as intended, it will be possible to remove a lot of
code from Encodings.cpp.
2014-07-08 21:24:00 +02:00
Jean-Marc Lasgouttes
ea1a5cb80e Draw right-to-left text string-wise using Qt
We rely on Qt built-in unicode support for handling Arabic and Hebrew
compose characters. This allows to avoid to use our homegrown
machinery.

This  should provide a nice speedup at a low cost and
will eventually allow us to get rid of:
 * most of our Arabic/Hebrew machinery in Encodings.cpp,
 * Paragraph::transformChar,
 * and probably more.
2014-07-08 21:24:00 +02:00
Jean-Marc Lasgouttes
b8170e0e01 Fix various selection-related problems
All these problems are related to what happens at the extreme points of rows

 * since VIRTUAL elements have a width but no contents, they have to
   be treated specially at some places. It would have been better to
   avoid testing for them explicitly, but I did not find a way.

 * Improve and cleanup the code in breakRow and fix in passing a crash
   when clicking on the right of an incomplete MARGIN_MANUAL
   paragraph.

 * improve the computation of row width in TextMetrics::computeRowMetrics.

 * handle properly the case where a position if not found on the row
   in both cursorX and getPosNearX (actually, this happens when
   selecting).

 * Some code cleanup and comments.
2014-07-08 21:23:59 +02:00
Jean-Marc Lasgouttes
7167d90b50 Fix bug #9040: In RtL documents end-of-paragraph marker shifts the row display
The fact that the bug was still present in the features/str-metrics
branch comes from a goof in the initial implementation of 'virtual'
row elements (completion and end-of-par markers). Now that this is
corrected, everything works as it should.

The fact that the bug is present in master is due to some other reason
that is not useful to investigate now.
2014-07-08 21:23:59 +02:00
Jean-Marc Lasgouttes
1a4b3201e7 Update README and do a small code cleanup 2014-07-08 21:23:58 +02:00
Jean-Marc Lasgouttes
f686375eec Change getColumnNearX to getPosNearX
The semantics was bad: the old implementation would return pos - row.pos(), and then all user of the function had to re-add row.pos().
2014-07-08 21:10:47 +02:00
Georg Baum
2c39859575 Remove unneeded swap() (thanks Jean-Marc)
std::swap() does exactly the same thing, and avoiding code duplication is
always good.
2014-07-07 21:16:10 +02:00
Jean-Marc
93a43742a5 Fix a bunch of small performance issues spotted by cppcheck
Most of these are about passing const strings parameters as references.
2014-07-05 19:13:10 +02:00
Jean-Marc
1cdbb94ff5 Fix possible bug spotted by cppcheck
I am not sure what this locking is really about, but the new code seems to be the right thing to do.
2014-07-05 19:12:09 +02:00