This solves a few bugs related to the font not being set correctly.
For example, when putting a selection somewhere with
putSelectionAt(), the font was not reset so that before this commit
if the cursor was in an ERT, strange things could happen.
putSelectionAt() is notably used when highlighting the location
corresponding with a LaTeX error (GuiErrorList), when using find,
and when using the spellcheck. I could reproduce the bug using all
three of these.
Bug #9500 is an example of the type of bugs that this commit fixes.
`os.popen` is deprecated since Python-2.6. Also, this fixes the handling
of files with quotes in their names. The patch requires Python >= 2.7.
Furthermore, the patch executes the lyx2lyx script with the same
interpreter used for it, to maintain compatibility.
I also removed some lines related to Python-2.4, as it is no longer
supported anyway.
Instead of remembering the last breakable element in the row, search
backward in the row and consider all string elements one by one until
a correct place to break is found.
This fixes the case where the row ends with a string, but there is no
space soon enough in the string to break it here. In this case, we
need to consider the previous row.
We have been here before. The png files are generated, but then by the time we preview the document, they are gone. This is because (a) when the PreviewLoader for a Buffer is deleted, it removes all its previews and (b) we export in a clone, so that Buffer gets deleted before the preview is actually shown. So we need to check whether we are a preview for a clone before we delete anything.
The first change is to concentrate on the last ro elements that contain separators and try to break it a a width that is shorter than both
- its current width (we want to break it, after all)
- the amount of space available.
This simple heuristic seems to give good results.
With this patch, the cursor position before undo can be saved when
creating an undo group. Any such value will supercede parameters
passed to recordUndo. Only the first such cursor set by nested
beginUndoGoup takes effect.
Fixes bug #9663.
If keymaps are activated and there is a secondary keymap but no
primary one, then the pointer to the active keymap was 0x0. This can't
be good.
Fixes bug #9685.
When entering an inset from the keyboard, setCurrentFont()
was not called and thus the cursor retained the font that was set
before. This could create strange behavior that could often go
unnoticed by the user.
It is easy to imagine many other situations similar to #9597 where
the user could trigger this bug.
Fixes bug #9597.
* GuiFontMetrics::pos2x, x2pos: add support for inter-word spacing.
* GuiPainter::text: idem
* Row::Element::countSeparators:
Row::countSeparators: new methods that count spaces in strings.
Row::setSeparatorExtraWidth: new method (code lifted from TextMetrics.cpp).
* TextMetrics::computeRowMetrics: rely on the above methods.
* RowPainter::paintMispelledMarked: pass only a Row::Element object reference
RowPainter::paintStringAndSel: idem; do not rely on values returned by
Painter::text (trailing spaces do not honor wordspacing value).
The goal of this commit is to make painting faster by reducing the
number of strings to paint. To this end, it is necessary to include
spaces in row elements.
Also importantly, this commit should fix existing problems with line
breaking in chinese text.
* TextMetrics::breakRow: do not do anything special for word separators.
* Row::add: when adding a character to a row element, keep the string
width updated. If need be, it is possible to tweak this by updating
every 10 characters, for example.
* GuiFontMetrics::breakAt (new): use QTextLayout to break text either
at word boundary or at an arbitrary width.
* Row::Element::breakAt: use the above method.
* Row::shortenIfNeeded: simplify now that because there is no need for
handling separator elements. This will be taken care of by the
improved breakAt.
Two things remain to be done:
* remove all traces of separator row element
* re-implement text justification.
Actually photos (i.e. .jpg files) where supported previously, but for pdflatex
output an unneeded conversion to png was done. The RasterImage templates
behaves now exactly as InsetGraphics for these files: If the input format is
jpg, use that for pdflatex, else convert to png.
This is another advantage of the new logo insets: We see in LyX where they are
inserted for the output. In these two cases, the text describes keywords of
the external template configuration file language, so these should not be
typeset as logos.
The difference to bitmap graphics is that these will be included as PDF for
pdflatex, so the vector properties are retained if a suitable conversion path
exists.
When adding units to the external inset bounding box I overlooked that
InsetGraphics supports only bb, cm, mm and in. Therefore I added too many
units for the external insets. We are not as strict as the graphics inset
and allow all absolute units, but no relative ones.
In breakRow set left and right margin properly for RTL paragraphs.
Remove corresponding code from ComputeRowMetrics.
In row painter, check the use of left and right margin depending on
context. The problem in the original text is that the various
leftMargin() methods actually represent right margin for RTL
paragraphs. This should be fixed eventually.
This made text in smallcaps+emph display as upright instead of plain
emph. There is no latex font for smallcaps + emph, but it is not a
reason for displaying it wrong.