The lib/unicodesymbols part is based on work by Günter Milde:
Both, \r{A} and \AA (rsp. \r{a} and \aa) are equivalent standard LICR macros
for Aring/aring as well as the deprecated "angstrom sign" character (212B).
However, with \AA for 212B and \r{A} for 00C5, tex2lyx converts \AA to the
deprecated "angstrom sign" which is missing in many fonts including the
Unicode version of Latin Modern.
I added the normalize_c() calls so that tex2lyx prefers the precomposed forms
(these are better editable in LyX) and the deprecated flag.
Now all const methods may be called without additional locking.
This is assumed by the threaded LaTeX export, which always useses a globally
unique instance for each encoding.
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.
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.
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.
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.
This fixes bug #8554 and some recently introduced busg:
- Encodings::fromLaTeXCommand() can now handle all combining characters,
not only the one letter ones
- The remainder returned from Encodings::fromLaTeXCommand() must never be
thrown away in tex2lyx, but output as ERT
- No special case for combining diacritical marks needed anymore in parse_text()
- No special cases for accents and IPA combining diacritical marks needed
anymore in parse_text()
- special tipa short cuts may only be recognized if the tipa package is loaded
- Use requirements returned by Encodings::fromLaTeXCommand() instead of
hardcoded registering of tipa and tipax
- Get rid of the name2 variable in parse_text(): We must use name, otherwise
the extra stuff that might have been put into name vanishes
Provide functions for translating to the LyX name
of an encoding from either a LaTeX name or an Iconv
name, with the possibility to specify the package.
This is in anticipation of changing to use the LyX
name of the encoding in the .lyx file format and
allowing multiple lib/encodings entries to have
the same LaTeX name (but different packages!).
The tex2lyx parser needs to worry about the iconv
name of the input encoding, so store that instead
of the latex name.
These encodings were not defined, since they must not be used as document
encodings (the characters {, } and \ may appear in high bytes, and latex
would be confused). However, they are supported by CJK.sty (which uses a
preprocessor to circumvent the limitations of the latex executable). These
encodings are now defined, but used for import in tex2lyx only.
The test case CJK.tex contained fake tests for shift-jis and big5 (the
japanese and chinese characters were entered using the utf8 encoding), and
therefore the wrong interpretation of these encoding looked as if it worked.
The comments about missing iconv support of shift-jis and big5 were wrong as
well (otherwise shift-jis-plain would not work either).
With non-TeX fonts, you can select a 'Non-TeX Font Default' math font, which simply loads unicode-math without actually selecting a math font, this then uses the default math otf font, currently Latin Modern. Other fonts still need to be set manually in the preamble, via \setmathfont.
The implementation suppresses unneeded package requests from unicodesymbols, but the output still uses macros instead of full unicode (both is possible with unicode-math).
The whole thing is a proof of concept, and it needs to be tested. I have tested it with the math manual, which compiles and seems to display correctly if I remove some hardcoded package loadings. OTOH I have not much experience with math.
This addresses #7449 partly.
Math commands need it as well as text commands. At the same time, this
further unifies the checking for termination and fixes cases of wrong
output (e.g. for 0x2005).
* do not terminate macros by {} if not necessary (prevent kerning violation)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40891 a592a061-630c-0410-9148-cb99ea01b6c8
now) and move more packages to the new exclude mechanism.
The remaining ones are not so easy.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40442 a592a061-630c-0410-9148-cb99ea01b6c8
Now you can also require a|b|c, and if any of the features is already used,
no other one will be loaded. The first feature wins if none is already used.
This is required for a part of bug #7811.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39884 a592a061-630c-0410-9148-cb99ea01b6c8
dialog by only converting text mode latex macros to unicode points.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30070 a592a061-630c-0410-9148-cb99ea01b6c8
Cyrillic formatted text in mathmode
If some other letters from some script need to be typeset in italic,
it will suffice adding the flag "mathalpha" to the unicodesymbols file.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28731 a592a061-630c-0410-9148-cb99ea01b6c8
that entries in the unicodesymbols file may not start with '\'.
Maybe the method should be renamed as fromLaTeXCode?
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27957 a592a061-630c-0410-9148-cb99ea01b6c8
to the method does not match any of the known unicode symbols.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27953 a592a061-630c-0410-9148-cb99ea01b6c8