Commit Graph

51 Commits

Author SHA1 Message Date
Richard Heck
51aebc9327 Fix whitespace at EOL. 2017-07-03 13:46:30 -04:00
Enrico Forestieri
cb70946960 Fix bug #9616 2016-09-10 13:36:45 +02:00
Richard Heck
6675601147 Fix a number of other uninitialized members.
Fixes coverity #23392, 23394, 23397, 23403, 23414, 23424,
23448, 23477.
2016-06-11 23:59:55 -04:00
Georg Baum
f35ed0c168 Improve \AA and \aa tex2lyx import
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.
2016-01-08 21:06:24 +01:00
Georg Baum
699a6db9fa Add some missing member variable initializations
These were all found by cppcheck. Even in constructors that are there "only
because of std containers" the class should be initialized correctly. You can
never know whether such an object does not get used, and then a nice crash
caused by dereferencing a NULL-pointer is better than undefined behaviour.
2015-09-13 19:47:21 +02:00
Georg Baum
c6b98a504f Make Encoding class thread-safe
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.
2014-12-08 22:25:40 +01:00
Georg Baum
25344de51d Make Language and Encoding threadsafe
Read-only access to these classes is now threadsafe, with one exception:
The encoding neds to be already initialized (i.e. init() must not be called).
This makes bug 9336 unreproducable on my machine, although it is not completely
fixed yet.
2014-12-07 18:26:44 +01: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 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
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
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
Georg Baum
ff8450f839 Add missing member initializations 2014-05-27 22:13:58 +02:00
Vincent van Ravesteijn
88d0939166 Encodings: Make members of CharInfo private 2013-09-29 15:26:20 +02:00
Stephan Witt
2e23774c6c Encodings: Split off the functions that need Buffer
This is needed to be able to use Encodings in tex2lyx without the need to
compile Buffer as well, or to use a TEX2LYX define.
2013-09-29 15:26:18 +02:00
Vincent van Ravesteijn
01e94f5e03 Encodings: Add CharInfo to Encoding.h 2013-09-29 15:26:17 +02:00
Pavel Sanda
718eeba60f Another attempt at Encoding::any (we don't compile at linux now). 2013-01-25 21:19:10 -08:00
Julien Rioux
2eea1590b1 Separation of the various names for encodings.
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.
2013-01-22 23:43:18 +01:00
Georg Baum
7c6a6a05a2 Fix bug #5087 as suggested by Jürgen
Now it is possible to force certain commands only for some encodings.
2013-01-13 21:36:41 +01:00
Georg Baum
ee3ce572a0 Fix import of shift-jis and big5 CJK texts.
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).
2012-12-30 20:52:50 +01:00
Juergen Spitzmueller
51d591d168 Factor out method to get a properly encoded latex string 2012-06-30 13:30:48 +02:00
Georg Baum
1a6c599917 Extend the notermination flag to math as well.
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).
2012-03-25 15:57:38 +02:00
Jürgen Spitzmüller
2cf5de28a9 Add "notermination" flag to unicodesymbols. This tells us not to try any termination of the command (such as '{}' or ' ' ).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40905 a592a061-630c-0410-9148-cb99ea01b6c8
2012-03-10 13:34:42 +00:00
Jürgen Spitzmüller
84971fb27e * implement possibility to use IPA shortcut notation (the actual shortcuts will follow)
* 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
2012-03-09 09:05:13 +00:00
Georg Baum
bb0432d74a Beautify output of \usepckage statements (each statement is on its own line
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
2011-12-08 20:05:51 +00:00
Richard Heck
d89d60c5a7 Fix bug #7682. Problem was that we were finding the children using the
BufferList, which knows nothing about clones.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39327 a592a061-630c-0410-9148-cb99ea01b6c8
2011-07-16 13:30:17 +00:00
Enrico Forestieri
f5cc73f583 Avoid unnecessary exceptions.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33516 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-19 16:31:15 +00:00
Enrico Forestieri
411b7a1dec Fix display of BibTeX entries in the info field of the citation
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
2009-06-12 14:03:57 +00:00
Enrico Forestieri
3175a28893 Fix bug 5836 (http://bugzilla.lyx.org/show_bug.cgi?id=5836)
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
2009-03-09 06:34:00 +00:00
Enrico Forestieri
7728b5cbb9 Fix bug 5665
http://bugzilla.lyx.org/show_bug.cgi?id=5665


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28058 a592a061-630c-0410-9148-cb99ea01b6c8
2009-01-09 16:09:41 +00:00
André Pönitz
f1cba8ff64 more latin1..utf8 schanges. all of src/* should be utf8 now
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27425 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-14 15:58:50 +00:00
Enrico Forestieri
5ca3be4d67 In mathmode, treat nonascii chars with diacritical marks as an input method
for entering math accents, such that an umlauted A is translated as \ddot{A},
for example.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26577 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-26 15:53:15 +00:00
Enrico Forestieri
b5dcdbc960 When in mathmode, always use the mathcommand replacement from the
unicodesymbols file. Also take into account that a unicode symbol
may appear in both mathmode and textmode and thus both the mathmode
and textmode features may be required. As a side effect, the problem
that the \lyxmathsym definition is added to the preamble even when
a unicode symbol appears only in textmode is solved.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26548 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-25 18:38:25 +00:00
Jürgen Spitzmüller
a2906cb877 ** proper implementation of pLaTeX by Tetsuya Makimura and me, fixes many remaining problems and bugs with language "japanese" (bugs 4863, 4290, 4700 and partially 4697) **
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26200 a592a061-630c-0410-9148-cb99ea01b6c8
2008-08-18 17:26:09 +00:00
Jürgen Spitzmüller
af9305f4ac *** sanitize listing's encoding handling ***
* src/Encoding.h:
	- new member hasFixedWidth()
* src/output_latex.{cpp,h} (switchEncoding):
	- add option to force encoding switch
* src/insets/InsetListing.cpp (latex):
	- force encoding switch only in multibyte context, switch the encoding properly,
	  and add some error messages.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25730 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-20 17:14:10 +00:00
Enrico Forestieri
0e834b9342 When producing latex output, check whether a character entered in mathed
can be encoded in the current latex encoding before resorting to the
unicodesymbols file.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25725 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-20 01:50:54 +00:00
Jürgen Spitzmüller
dcc4d58b66 *** Implement GUI names for encodings (part of bug 4971) ***
* lib/encodings:
	- add new column "GUI names"

* src/Encoding.{cpp,h}:
	- read in and handle GUI names

* src/frontends/qt4/GuiDocument.cpp:
	- display GUI names instead of LaTeX names

* po/lyx_pot.py:
* po/Rules-lyx:
* development/scons/SConstruct:
	- add encoding GUI names to the po files.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25558 a592a061-630c-0410-9148-cb99ea01b6c8
2008-07-11 08:56:17 +00:00
Jürgen Spitzmüller
8cbc28d880 * src/Encoding.{cpp,h}:
- build an exception list of characters that must be output as LaTeX command in any case
	  (except in utf8-plain). I.e., the utf8 encodings now also honour the "force" flag.
* lib/unicodesymbols:
	- add "force" flag to combine characters. Fixes rest of bug 4946.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25361 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-23 18:00:43 +00:00
Enrico Forestieri
90837aaf6e Fix bug 1527
http://bugzilla.lyx.org/show_bug.cgi?id=1527

* src/mathed/*.cpp:
	- Track mode (math or text) when outputting latex code and
	  properly wrap commands that are in the wrong mode with
	  either \ensuremath or \lyxmathsym.

* src/mathed/MathParser.cpp:
	- Parse \ensuremath and \lyxmathsym, such that exported latex
	  produces the same result when imported back.
	- Replace latex commands with corresponding unicode symbols.

* src/Encoding.cpp:
	- Implement Encodings::fromLaTeXCommand() for converting either
	  a single or a sequence of latex commands to unicode symbols.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25270 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-16 01:21:17 +00:00
Enrico Forestieri
1a2af1197e Allow to specify either text mode or math mode commands (or both) in the
unicodesymbols file. When the command for a mode is not specified, the
other one is used (taking care that it also works in the "wrong" mode).
This allows to avoid the \lyxmathsym macro when a native math command
is available. Patch from Georg, modifications to the unicodesymbols
file by me.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25061 a592a061-630c-0410-9148-cb99ea01b6c8
2008-06-02 01:35:42 +00:00
Enrico Forestieri
a694de895e Fix bug 3938
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25028 a592a061-630c-0410-9148-cb99ea01b6c8
2008-05-31 20:54:50 +00:00
André Pönitz
6b28f08ff2 cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23891 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-21 21:47:37 +00:00
André Pönitz
f8afb49165 forgot this part...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23890 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-21 21:08:57 +00:00
Abdelrazak Younes
69d755054b Encoding::getSymbolsList(): make it const.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22870 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-08 17:52:07 +00:00
Jürgen Spitzmüller
9bdca85f26 *** New Symbols Dialog ***
* src/Encoding.{cpp,h}:
	- new public member getSymbolsList()

* src/frontends/qt4/GuiSymbols.cpp:
* src/frontends/qt4/GuiSymbols.h:
* src/frontends/qt4/ui/SymbolsUi.ui
	- new files

* src/frontends/qt4/GuiView.cpp:
* src/frontends/qt4/Makefile.am:
* development/scons/scons_manifest.py:
	- add new dialog

* lib/ui/classic.ui:
* lib/ui/stdmenus.ui:
	- menu item for symbols dialog.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22832 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-07 13:18:07 +00:00
Bo Peng
837f7f2b6b Use ErrorList to handle encoding error
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22208 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-18 17:51:20 +00:00
Enrico Forestieri
f48d7caee3 Small tweaks
* src/Paragraph.cpp (knownLangChars): renamed as writeScriptChars.
	Now only deals with characters that cannot be encoded using the
	current latex encoding.
	(latexSpecialChars): only call writeScriptChars if the character
	cannot be encoded.

	* src/Encoding.{cpp,h} (isKnownLangChar): renamed as isKnownScriptChar.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21183 a592a061-630c-0410-9148-cb99ea01b6c8
2007-10-24 17:22:57 +00:00
Enrico Forestieri
d88aac0e1f Add support for greek and cyrillic chars such that it is not
necessary to mark them in the proper language for typesetting.

	* src/Paragraph.cpp
	(Paragraph::Pimpl::knownLangChars): new method.
	(Paragraph::Pimpl::simpleTeXSpecialChars): output proper
	latex code for greek and cyrillic chars.

	* src/LaTeXFeatures.cpp: add textgreek and textcyr features.

	* src/Encoding.{cpp,h}
	(Encodings::isKnownLangChar): new method.

	* lib/unicodesymbols: add greek and cyrillic alphabetic chars.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20931 a592a061-630c-0410-9148-cb99ea01b6c8
2007-10-12 18:21:51 +00:00
Lars Gullik Bjønnes
897436efbb Whitespace cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18550 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-28 22:27:45 +00:00
Uwe Stöhr
80b94c6bf5 Georg's patch for bug 3043:
Introduces new encodings for the CJK-languages.
The CJK-languages can now be selected from LyX's menu.
For remaining small problems, see the thread "Help needed for bug 3043" on the devel-list.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18216 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-06 20:26:02 +00:00