commit f838b4fb18d1860d646212aa22355e19eae4e696
Author: Günter Milde <[email protected]>
Date: Thu Apr 11 00:31:48 2019 +0200
platex fixes.
* Force unicodesymbols conversion for all *-platex input encodings,
* except some characters that work well in utf8.
* Use platex if document language is "japanese" and input encoding is
"utf8".
---
lib/doc/ja/Intro.lyx | 6 ++--
.../ja/Multilingual_Typesetting_%28platex%29.lyx | 24 ++++++-------------
lib/examples/ja/Welcome.lyx | 2 +-
lib/unicodesymbols | 16 ++++++------
src/BufferParams.cpp | 2 +
src/Encoding.cpp | 17 +++++++------
6 files changed, 31 insertions(+), 36 deletions(-)
diff --git a/lib/doc/ja/Intro.lyx b/lib/doc/ja/Intro.lyx
index ff5042e..f69e16c 100644
--- a/lib/doc/ja/Intro.lyx
+++ b/lib/doc/ja/Intro.lyx
@@ -58,9 +58,9 @@ End
\language_package auto
\inputencoding jis-platex
\fontencoding global
-\font_roman "palatino" "default"
-\font_sans "helvet" "default"
-\font_typewriter "courier" "default"
+\font_roman "lmodern" "default"
+\font_sans "default" "default"
+\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
diff --git a/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx
b/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx
index 40bb2ab..212228b 100644
--- a/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx
+++ b/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx
@@ -9,7 +9,7 @@
\maintain_unincluded_children false
\language japanese
\language_package auto
-\inputencoding utf8-platex
+\inputencoding utf8
\fontencoding auto
\font_roman "lmodern" "default"
\font_sans "default" "default"
@@ -104,19 +104,11 @@ Deutsch: Grüße aus Österreich!
\end_layout
\begin_layout Standard
-Greek and Cyrillic Unicode characters are too wide.
- With Document\SpecialChar menuseparator
-Settings\SpecialChar menuseparator
-Language\SpecialChar menuseparator
-Encoding
-\begin_inset Quotes eld
-\end_inset
-
-Japanese (platex) (utf8)
-\begin_inset Quotes erd
-\end_inset
-
- they are converted to LaTeX macros, so that the output matches Latin letters:
+Some Japanese fonts contain Greek and Cyrillic characters, however they
+ are are considerabely wider than characters in Latin, Greek, and Cyrillic
+ TeX fonts.
+ Therefore, LyX converts them to LaTeX macros, so that the output matches
+ other non-Japanese text:
\end_layout
\begin_layout Quotation
@@ -132,8 +124,8 @@ Russisch: Привет с
\end_layout
\begin_layout Standard
-Text in other languages with correct language setting - works only for some
- languages:
+Text in some other languages with correct language setting (not all languages
+ supported by LyX are compatible with pLaTeX):
\end_layout
\begin_layout Standard
diff --git a/lib/examples/ja/Welcome.lyx b/lib/examples/ja/Welcome.lyx
index 21e5fa6..1355b39 100644
--- a/lib/examples/ja/Welcome.lyx
+++ b/lib/examples/ja/Welcome.lyx
@@ -9,7 +9,7 @@
\maintain_unincluded_children false
\language japanese
\language_package auto
-\inputencoding utf8-platex
+\inputencoding utf8
\fontencoding auto
\font_roman "lmodern" "default"
\font_sans "default" "default"
diff --git a/lib/unicodesymbols b/lib/unicodesymbols
index 54959d6..57dbf78 100644
--- a/lib/unicodesymbols
+++ b/lib/unicodesymbols
@@ -60,13 +60,13 @@
#
0x00a0 "~" ""
"force=cp862;cp1255;cp1256;koi8-u;iso8859-6;iso8859-7,notermination=both" "~"
"" # NO-BREAK SPACE
0x00a1 "\\textexclamdown" "" "force=cp862;cp1255;euc-jp;euc-kr" #
INVERTED EXCLAMATION MARK
-0x00a2 "\\textcent" "textcomp"
"force=cp862;cp1255;cp1256;euc-jp;jis" #"\\mathcent" "txfonts|pxfonts" # CENT
SIGN
-0x00a3 "\\pounds" ""
"force=cp862;cp1255;cp1256;iso8859-7;euc-jp;jis" "\\pounds" "" # £ POUND SIGN
+0x00a2 "\\textcent" "textcomp"
"force=cp862;cp1255;cp1256;euc-jp;euc-jp-platex;jis;shift-jis-platex"
#"\\mathcent" "txfonts|pxfonts" # CENT SIGN
+0x00a3 "\\pounds" ""
"force=cp862;cp1255;cp1256;iso8859-7;euc-jp;euc-jp-platex;jis;shift-jis-platex"
"\\pounds" "" # £ POUND SIGN
0x00a4 "\\textcurrency" "textcomp"
"force=cp1256;euc-cn;euc-jp;euc-kr;gbk;iso8859-6" # CURRENCY SYMBOL
-0x00a5 "\\textyen" "textcomp"
"force=cp862;cp1255;cp1256;euc-jp;jis" "\\yen" "amssymb" # YEN SIGN
+0x00a5 "\\textyen" "textcomp"
"force=cp862;cp1255;cp1256;euc-jp;jis;shift-jis-platex" "\\yen" "amssymb" # YEN
SIGN
0x00a6 "\\textbrokenbar" "textcomp"
"force=cp1255;cp1256;iso8859-7;euc-jp" # BROKEN BAR
-0x00a7 "\\textsection" "textcomp"
"force=cp1255;cp1256;iso8859-7;euc-cn;euc-jp;euc-kr;euc-tw;gbk;jis"
"\\mathsection" "" # SECTION SIGN
-0x00a8 "\\textasciidieresis" "textcomp"
"force=cp1255;cp1256;iso8859-7;euc-cn;euc-jp;euc-kr;gbk;jis" # DIAERESIS
+0x00a7 "\\textsection" "textcomp"
"force=cp1255;cp1256;iso8859-7;euc-cn;euc-jp;euc-kr;euc-tw;gbk;jis;shift-jis-platex"
"\\mathsection" "" # SECTION SIGN
+0x00a8 "\\textasciidieresis" "textcomp"
"force=cp1255;cp1256;iso8859-7;euc-cn;euc-jp;euc-kr;gbk;jis;shift-jis-platex" #
DIAERESIS
0x00a9 "\\textcopyright" "textcomp"
"force=cp1255;cp1256;koi8-u;iso8859-7;euc-jp" # COPYRIGHT SIGN
0x00aa "\\textordfeminine" "textcomp" "force=cp862;euc-jp;euc-kr" #
FEMININE ORDINAL INDICATOR
0x00ab "\\guillemotleft" ""
"force=armscii8;cp862;cp1255;cp1256;iso8859-7" # LEFT-POINTING DOUBLE ANGLE
QUOTATION MARK
@@ -74,13 +74,13 @@
0x00ad "\\-" ""
"force=cp1255;cp1256;iso8859-13;euc-jp;euc-kr;iso8859-6,notermination=text" ""
"" # SOFT HYPHEN
0x00ae "\\textregistered" "textcomp"
"force=cp1255;cp1256;euc-jp;euc-kr" "\\circledR" "amssymb" # REGISTERED SIGN
0x00af "\\textasciimacron" "textcomp" "force=cp1255;cp1256;euc-jp" #
MACRON
-0x00b0 "\\textdegree" "textcomp"
"force=cp862;cp1255;cp1256;koi8-u;iso8859-7;euc-cn;euc-jp;euc-kr;euc-tw;gbk;jis"
"{^\\circ}" "" # DEGREE SIGN
+0x00b0 "\\textdegree" "textcomp"
"force=cp862;cp1255;cp1256;koi8-u;iso8859-7;euc-cn;euc-jp;euc-jp-platex;euc-kr;euc-tw;gbk;jis;shift-jis-platex"
"{^\\circ}" "" # DEGREE SIGN
0x00b1 "\\textpm" "textcomp" "force" "\\pm" "" # ± PLUS-MINUS
SIGN
0x00b2 "\\texttwosuperior" "textcomp" "force" "{{}^2}" "" # ²
SUPERSCRIPT TWO
0x00b3 "\\textthreesuperior" "textcomp" "force" "{{}^3}" "" # ³
SUPERSCRIPT THREE
-0x00b4 "\\textasciiacute" "textcomp"
"force=cp1255;cp1256;euc-jp;euc-kr;jis" # ACUTE ACCENT
+0x00b4 "\\textasciiacute" "textcomp"
"force=cp1255;cp1256;euc-jp;euc-kr;jis;shift-jis-platex" # ACUTE ACCENT
0x00b5 "\\textmu" "textcomp" "force!=utf8;jis" "" "" # µ MICRO
SIGN (upright, not $\mu$)
-0x00b6 "\\textparagraph" "textcomp"
"force=cp1255;cp1256;euc-jp;euc-kr;jis" "\\mathparagraph" "" # PILCROW SIGN #
not equal to \textpilcrow
+0x00b6 "\\textparagraph" "textcomp"
"force=cp1255;cp1256;euc-jp;euc-kr;jis;shift-jis-platex" "\\mathparagraph" "" #
PILCROW SIGN # not equal to \textpilcrow
0x00b7 "\\textperiodcentered" ""
"force=cp862;cp1255;cp1256;koi8-u;iso8859-7;euc-kr;euc-tw;gbk" "\\cdot" "" #
MIDDLE DOT
0x00b8 "\\c{ }" "" "force=cp1255;cp1256;euc-jp;euc-kr" "" ""
# CEDILLA
0x00b9 "\\textonesuperior" "textcomp" "force" "{{}^1}" "" # ¹
SUPERSCRIPT ONE
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 5704940..aee184c 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3435,6 +3435,8 @@ Encoding const & BufferParams::encoding() const
return *(encodings.fromLyXName("utf8-plain"));
if (inputenc == "auto" || inputenc == "default")
return *language->encoding();
+ if (inputenc == "utf8" && language->lang() == "japanese")
+ return *(encodings.fromLyXName("utf8-platex"));
Encoding const * const enc = encodings.fromLyXName(inputenc);
if (enc)
return *enc;
diff --git a/src/Encoding.cpp b/src/Encoding.cpp
index 321744c..b3efc20 100644
--- a/src/Encoding.cpp
+++ b/src/Encoding.cpp
@@ -189,17 +189,18 @@ bool Encoding::encodable(char_type c) const
{
// assure the used encoding is properly initialized
init();
-
if (iconvName_ == "UTF-8" && package_ == none)
return true;
// platex does not load inputenc: force conversion of supported
characters
- if (name_ == "utf8-platex"
- && c > 0x007f // Latin-1 Supplement
- && (c < 0x05ff || c > 0x1d00) // ... Hebrew + Phonetic
Extensions
- && (c < 0x2aff || c > 0xfb00) // ... Supplemental Mathematical
Operators + Alphabetic...
- && (c < 0xfb4f || c > 0x1d400) // ...Presentation Forms +
Mathematical...
- && c < 0x1d7ff) // ...Alphanumeric Symbols
- return false;
+ if (package_ == Encoding::japanese
+ && ((0x7f < c && c <= 0x05ff) // Latin-1 Supplement ... Hebrew
+ || (0x1d00 < c && c <= 0x218f) // Phonetic Extensions
... Number Forms
+ || (0x2193 < c && c <= 0x2aff) // Arrows ...
Supplemental Mathematical Operators
+ || (0xfb00 < c && c <= 0xfb4f) // Alphabetic
Presentation Forms
+ || (0x1d400 < c && c <= 0x1d7ff)) // Mathematical
Alphanumeric Symbols
+ && c != 0xa2 && c != 0xa3 && c != 0xa5 && c != 0xa7 //
exceptions
+ && c != 0xa8 && c != 0xb0 && c != 0xb4 && c != 0xb6)
+ return false;
if (c < start_encodable_ && !isForced(c))
return true;
if (encodable_.find(c) != encodable_.end())