Commit Graph

552 Commits

Author SHA1 Message Date
Juergen Spitzmueller
9d8fbc7fd1 Amend a754912
Switch logic, since isStyle() does not cover inline math

Fixes: #11338
2018-10-09 18:04:51 +02:00
Juergen Spitzmueller
10c06f67c9 Use LTR environment for forceLTR content with polyglossia
Fixes: #10548
2018-09-28 08:36:44 +02:00
Juergen Spitzmueller
3bacc3c6e7 Par alignment in floats must be swapped for all RTL langs, not only Hebrew
Fixes: #11029
2018-07-15 19:23:19 +02:00
Juergen Spitzmueller
195f62ac93 Fix bracket output in RTL languages
This is a real mess!

Fixes: #11187
2018-07-15 14:26:29 +02:00
Juergen Spitzmueller
57dc817581 Add \nospellcheck font property
This revives a ten year old idea (and patch) by Dov.

You can now mark in the character dialog text and exclude it from spell
checking.

Fixes: #1042

File format change

Remaining issue: The instant spell checking marks are not immediately
removed, but only after some editing.
2018-05-06 19:48:21 +02:00
Juergen Spitzmueller
a853dab61f Check script char fontenc from main language. 2018-05-05 15:26:37 +02:00
Juergen Spitzmueller
768c9a552e cprotect allows to place environments in fragile contexts.
use that possibility.

Fixes parts of #5128.
2018-04-30 09:06:15 +02:00
Juergen Spitzmueller
0b2fae66e3 unicodesymbols: add general way to require a feature only for specific encodings
A feature can now be required only for specific input or font encodings:
- <feature>=enc1;enc2...  Require the feature <feature> only if the
                          character is used in one if the specified font
                          or input encodings.
- <feature>!=enc1;enc2... Require the feature <feature> only if the
                          character is used in a font or input encoding
                          that is not among the specified.
2018-04-28 13:31:29 +02:00
Juergen Spitzmueller
1af0832f75 Do not require cprotect if we only have a cprotectible inset in the maintext. 2018-04-23 11:04:18 +02:00
Juergen Spitzmueller
a883133e8d Paragraph on top level do not need cprotection. 2018-04-22 20:15:04 +02:00
Juergen Spitzmueller
26ea1e1496 Align fontenc with document fonts
Following a request by Günter, we consider the document fonts (only rm
for now) when selecting an appropriate font encoding.

See #9741

The new default font encoding setting "auto" does

* consider the font encoding needed by the language(s), which can now
  have fallback alternatives
* Consider which font encoding is provided by the document font

Thus, cm now will result in OT1 fontenc, if the language can deal with
that.

The font_enc pref is ditched: it is no longer needed.

The automatism is still very basic and is subject to extension.

File format and prefs format change.
2018-04-22 19:06:46 +02:00
Juergen Spitzmueller
3457d9d25f Output "textbaltic" definitions only if needed. 2018-04-22 10:08:07 +02:00
Juergen Spitzmueller
02d37932d0 \textcyr -> \textcyrillic
Use the command as defined by Babel. This allows us to use the (more
advanced) Babel command if provided instead of rolling our own.

I add a dummy file format change in case it turns out we need to
do something here for old documents (e.g. with user preamble definitions)
2018-04-21 16:28:15 +02:00
Juergen Spitzmueller
4010ccafbd Factor out test for script wrapper in given font enc 2018-04-21 12:55:11 +02:00
Juergen Spitzmueller
b7223bc5d1 Handle script chars in latexSurrogatePair
If we have "script chars" (\textcyr or \textgreek) combined with
combining chars, the combining chars need to go inside the script
macro.

Fixes: #6463
2018-04-21 11:38:19 +02:00
Juergen Spitzmueller
4e5e1de086 Align \textgreek and \textcyr with font encoding, part II
Also embrace encodable chars to those macros if we don't have a font
encoding that can handle the glyphs.

Fixes the remaining part of #9637
2018-04-20 20:00:01 +02:00
Juergen Spitzmueller
d77c0707e0 Handle combining characters in writeScriptChars
They were output in the wrong order and thus produced wrong result.
2018-04-20 18:17:18 +02:00
Juergen Spitzmueller
a6c6bffbed Align \textgreek and \textcyr with font encoding
Fixes part of #9637
2018-04-20 18:01:16 +02:00
Juergen Spitzmueller
6f2eda8a0c Simplify 2018-04-15 12:37:41 +02:00
Juergen Spitzmueller
c082c3a0f6 needsCProtection(): check all insets. 2018-04-15 12:29:49 +02:00
Juergen Spitzmueller
ef359f58b5 Add cprotection support for paragraph layouts. 2018-04-14 12:57:23 +02:00
Juergen Spitzmueller
2ba584957c Add basic support for cprotect
This allows (some) verbatim contents in macros, such as \url's with
specific chars (#, % etc.) in section headings or footnotes (#449)
or comments in captions (#9313).

The mentioned two bugs are fixed by this commit.

Note that the implementation is still rather basic and might need
extension for other cases.
2018-04-13 17:46:37 +02:00
Richard Heck
e857fee741 Fix bug #10920, and some for loops. 2018-02-24 00:04:34 -05:00
Juergen Spitzmueller
8a703573ea Implement IsTocCaption for normal layouts.
But use default "true" to maintain current behavior if not explicitly
stated otherwise.

Fixes: #11045
2018-02-21 16:37:07 +01:00
Jean-Marc Lasgouttes
1dba36c7ce Implement buffer-anonymize more efficiently
The work is done now in Paragraph::anonymize().

Move the handling of the lfun to Buffer class.
2018-02-12 14:38:28 +01:00
Juergen Spitzmueller
10f02c4160 Whitespace 2018-01-29 08:37:25 +01:00
Juergen Spitzmueller
974553d858 Fix Null-checking issue detected by Coverity. 2018-01-11 13:43:35 +01:00
Günter Milde
fcc1cffb1a Do not write LICR macro if character is encodable.
No hardcoded conversion of literal dashes to
\textemdash and \textendash macros.
2018-01-10 15:31:32 +01:00
Günter Milde
d852bbd5d9 Fix a comment.
Ligating of -- to en dashes occure also in teletype fonts.
With some 8-bit fonts, em and en dashes are not copied
exported from the PDF (but this is not limited to dashes in teletype).
With LatinModern, PDF export works fine
MWE:
\documentclass[]{article}
%\usepackage{lmodern}
\usepackage[T1]{fontenc}
\begin{document}
Hallo \texttt{Welt --Welt ---Welt}
Hallo Welt --Welt ---Welt
2018-01-02 09:28:04 +01:00
Juergen Spitzmueller
a2f886d526 Use TeXOnePar for the inpreamble layouts
This considers paragraph language and spacing (and simplifies the code)
2017-12-26 13:11:00 +01:00
Juergen Spitzmueller
e55e9c842f Fix inpreamble styles. 2017-12-26 11:40:58 +01:00
Juergen Spitzmueller
49e3f8e830 Fix switch of language and line spacing in InTitle commands.
Fixes: #9332, #10849
2017-12-23 13:27:10 +01:00
Juergen Spitzmueller
d56a5447f3 Consistent output of breakable/non-breakable dashes on all TeX engines.
Fixes: #10839
2017-12-16 16:12:26 +01:00
Juergen Spitzmueller
aaa6150089 Fix footnote output in description item
Fixes: #9387
2017-11-19 10:41:17 +01:00
Enrico Forestieri
7e51b5f301 Fix #10778 (issue with CJK and language nesting)
When using CJK, don't try to close a language that was never
opened before, such as when it is the main language.
2017-11-02 10:41:08 +01:00
Enrico Forestieri
7f23ca912c Fix issue with change-tracked deleted display math
- If a display math not starting a new paragraph is deleted, the
  current \lyxdeleted macro (if any) must be closed and a new one
  started, otherwise the display math will be shifted up.

- Use \linewidth instead of \columnwidth because the former will adapt
  to the reduced horizontal width in list environments, avoiding shifting
  to the right the diplay math.
2017-10-22 13:12:33 +02:00
Richard Heck
0bcb9732c5 Rename Paragraph::setBuffer to Paragraph::setInsetBuffers, to avoid
confusion about what this routine does.
2017-10-16 15:48:47 -04:00
Juergen Spitzmueller
1249e5e13e Mark some intentional fall-throughs (in a way understandable to gcc)
This silences -Wimplicit-fallthrough warnings with gcc7.

(Re-Apply without the unintended commits)
2017-08-12 09:06:29 +02:00
Juergen Spitzmueller
0120c3fc10 Revert "Mark some intentional fall-throughs (in a way understandable to gcc)"
This reverts commit 6dc1884d05.
2017-08-12 09:04:23 +02:00
Juergen Spitzmueller
6dc1884d05 Mark some intentional fall-throughs (in a way understandable to gcc)
This silences -Wimplicit-fallthrough warnings with gcc7.
2017-08-12 08:57:02 +02:00
Juergen Spitzmueller
b2841e9570 Require textquotedbl def with second language that has internal fontenc
Since these switch locally to encodings that do not define \textquotedbl
themselves.
2017-08-10 11:47:52 +02:00
Juergen Spitzmueller
094341fa5a Fix straight quote character in non-T1 encoding
Fixes: #10584
2017-08-09 17:25:02 +02:00
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.

The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.

Further details on the steps below, in case they're of interest to
someone else in the future.

1. Checkout a fresh and up to date version of src/

    git pull && git checkout -- src && git status src

2. Ensure there's a suitable .clang-format in place, i.e. with options
   to fix the comment at the end of namespaces, including:

    FixNamespaceComments:                           true
    SpacesBeforeTrailingComments:                   1

and that clang-format is >= 5.0.0, by doing e.g.:

    clang-format -dump-config | grep Comments:
    clang-format --version

3. Apply clang-format to the source:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")

4. Create and filter out hunks related to fixing the namespace

    git diff -U0 src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace.patch

5. Filter out hunks corresponding to simple fixes into to a separate patch:

    pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n'  \
        -e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n'         \
        fix_namespace.patch > fix_namespace_simple.patch

6. Manually review the simple patch and then apply it, after first
   restoring the source.

    git checkout -- src
    patch -p1 < fix_namespace_simple.path

7. Manually review the (simple) changes and then stage the changes

    git diff src
    git add src

8. Again apply clang-format and filter out hunks related to any
   remaining fixes to the namespace, this time filter with more
   context. There will be fewer hunks as all the simple cases have
   already been handled:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")
    git diff src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace2.patch

9. Manually review/edit the resulting patch file to remove hunks for files
   which need to be dealt with manually, noting the file names and
   line numbers. Then restore files to as before applying clang-format
   and apply the patch:

    git checkout src
    patch -p1 < fix_namespace2.patch

10. Manually fix the files noted in the previous step. Stage files,
    review changes and commit.
2017-07-23 13:11:54 +02:00
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
Enrico Forestieri
80f3f219b7 Clarify the status of thread local storage on OSX
The __thread local storage is supported on OSX since 10.7 (Lion),
released in 2012. For example, see:
http://forum.dlang.org/post/mailman.3439.1452269142.22025.digitalmars-d-bugs@puremagic.com
2017-06-26 14:41:34 +02:00
Enrico Forestieri
55bbd67cde Fix bugs #10650 and #9598 2017-06-03 17:26:05 +02:00
Enrico Forestieri
2a5bb7ab67 Fix bug #10685
Make sure to properly nest \begin{lang} and \end{lang} tags even
when no language package is selected. In this case, LyX assumes
that babel is being used, so the language names might be wrong
if the user arranged for using polyglossia in the preamble.
Nevertheless, we assure that the produced output is syntactically
correct, so that by adding proper preamble code a correct output
is still possible.
2017-05-30 17:57:37 +02:00
Uwe Stöhr
e575e7eebd Add support to cross out characters
- adds support for the command \xout of the LateX package ulem
- fileformat change
2017-04-05 00:01:19 +02:00
Enrico Forestieri
72a488d7e6 Fix output of en- and em-dashes with TeX fonts
This commit fixes the regression introduced in 2.2 about the
output of en- and em-dashes. In 2.2 en- and em-dashes are output as
the \textendash and \textemdash macros when using TeX fonts, causing
changed output in old documents and also bugs (for example, #10490).

Now documents produced with older versions work again as intended,
while documents produced with 2.2 can be made to produce the exact
same output by simply checking "Don't use ligatures for en-and
em-dashes" in Document->Settings->Fonts.

When exporting documents using TeX fonts to earlier versions, in order
to avoid changed output, a zero-width space character is inserted after
each en/em-dash if dash ligatures are allowed. These characters are
removed when reloading  documents with 2.3, so that they don't accumulate.
2017-03-19 20:50:34 +01:00
Juergen Spitzmueller
73ccee113e rename BufferParams::font_encoding() to ::main_font_encoding()
Because that's what's actually returned.
2017-02-25 12:49:49 +01:00