commit 46119b35645c9f8d8f1e512964df80f90d0577e1
Author: Günter Milde <[email protected]>
Date:   Tue May 7 16:12:41 2019 +0200

    Make Japanese documentation more robust.
    
    The locally defined Ruby (furigana) inset now
    works also with non-TeX fonts.
---
 development/autotests/invertedTests                |   14 +-----
 lib/doc/ja/Additional.lyx                          |   12 ++++-
 lib/doc/ja/Customization.lyx                       |   12 ++++-
 lib/doc/ja/EmbeddedObjects.lyx                     |   12 ++++-
 lib/doc/ja/Formula-numbering.lyx                   |    2 +-
 lib/doc/ja/Intro.lyx                               |   12 ++++-
 lib/doc/ja/Math.lyx                                |   12 ++++-
 lib/doc/ja/Shortcuts.lyx                           |   14 +++++--
 lib/doc/ja/Tutorial.lyx                            |   20 ++++++---
 lib/doc/ja/UserGuide.lyx                           |   11 ++++-
 lib/examples/ja/Modules/Braille.lyx                |    2 +-
 .../ja/Multilingual_Typesetting_%28CJKutf8%29.lyx  |   42 +++++++++++++++++--
 .../ja/Multilingual_Typesetting_%28platex%29.lyx   |    6 +-
 lib/examples/ja/Welcome.lyx                        |    2 +-
 src/PDFOptions.cpp                                 |    6 +-
 15 files changed, 126 insertions(+), 53 deletions(-)

diff --git a/development/autotests/invertedTests 
b/development/autotests/invertedTests
index 0e7807f..8d8bd75 100644
--- a/development/autotests/invertedTests
+++ b/development/autotests/invertedTests
@@ -87,8 +87,9 @@ 
export/export/latex/unicodesymbols/031-thai_th_(euc-|gbk|jis|utf8-cjk).*
 #
 # The textclass-loaded jsclasses/okumacro.sty needs format `pLaTeX2e'
 # (okumacro provides \ruby support).
-export/doc/ja/(Additional|Customization|EmbeddedObjects|Intro|LaTeXConfig|Math|Shortcuts|Tutorial|UserGuide).*_systemF
-export/doc/ja/Formula-numbering_pdf4_systemF
+export/doc/ja/(Additional|LaTeXConfig|Math|UserGuide).*_systemF
+export/doc/ja/(Formula-numbering|Customization|EmbeddedObjects|Intro)_pdf4_systemF
+export/doc/ja/Tutorial_(dvi3|pdf5)_systemF
 # Test for command \pdfsave fails:
 # ! Package xypdf Error: pdfTeX version 1.40.0 or higher is needed for the 
xypdf
 export/examples/ja/Graphics_and_Insets/XY-Pic.*_systemF
@@ -345,15 +346,6 @@ Sublabel: externalissues
 #
 # e.g. a bug or missing feature in ps2pdf
 
-# Japanese (platex)
-# dvips requires special font setup for kanji, otherwise
-# * the Postscript file has wrong and missing characters
-#   (without error or warning)
-# * as a consequence, ps2pdf fails for some documents on TL18 and TL19:
-#
-# The following may also fail for other reasons with TL19
-#export/doc/ja/(Additional|Customization|EmbeddedObjects|Math|UserGuide)_pdf
-
 # ps2pdf gives the following and exits with error:
 # Error: /invalidfileaccess in --file--
 # ps2pdf succeeds if the -dNOSAFER flag is used. For discussion, see:
diff --git a/lib/doc/ja/Additional.lyx b/lib/doc/ja/Additional.lyx
index de97bb6..aaba580 100644
--- a/lib/doc/ja/Additional.lyx
+++ b/lib/doc/ja/Additional.lyx
@@ -84,9 +84,15 @@ EndFont
 Mandatory      1
 EndArgument
 Preamble
-\IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 End
 \end_local_layout
diff --git a/lib/doc/ja/Customization.lyx b/lib/doc/ja/Customization.lyx
index e42b35b..175f7d9 100644
--- a/lib/doc/ja/Customization.lyx
+++ b/lib/doc/ja/Customization.lyx
@@ -74,9 +74,15 @@ EndFont
 Mandatory      1
 EndArgument
 Preamble
-\IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 ResetsFont true
 End
diff --git a/lib/doc/ja/EmbeddedObjects.lyx b/lib/doc/ja/EmbeddedObjects.lyx
index fc60b22..8359ea5 100644
--- a/lib/doc/ja/EmbeddedObjects.lyx
+++ b/lib/doc/ja/EmbeddedObjects.lyx
@@ -197,9 +197,15 @@ EndFont
 Mandatory      1
 EndArgument
 Preamble
-\IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 End
 \end_local_layout
diff --git a/lib/doc/ja/Formula-numbering.lyx b/lib/doc/ja/Formula-numbering.lyx
index 60464e5..47196da 100644
--- a/lib/doc/ja/Formula-numbering.lyx
+++ b/lib/doc/ja/Formula-numbering.lyx
@@ -43,7 +43,7 @@
   \let\c@equation\c@org@eq
   \let\theequation\org@theeq}
 \end_preamble
-\use_default_options false
+\use_default_options true
 \maintain_unincluded_children false
 \language japanese
 \language_package default
diff --git a/lib/doc/ja/Intro.lyx b/lib/doc/ja/Intro.lyx
index 9f98608..8ff8db9 100644
--- a/lib/doc/ja/Intro.lyx
+++ b/lib/doc/ja/Intro.lyx
@@ -48,9 +48,15 @@ EndFont
 Mandatory      1
 EndArgument
 Preamble
-\IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 End
 \end_local_layout
diff --git a/lib/doc/ja/Math.lyx b/lib/doc/ja/Math.lyx
index f181cfe..e257f5d 100644
--- a/lib/doc/ja/Math.lyx
+++ b/lib/doc/ja/Math.lyx
@@ -168,9 +168,15 @@ EndFont
 Mandatory      1
 EndArgument
 Preamble
-\IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 End
 \end_local_layout
diff --git a/lib/doc/ja/Shortcuts.lyx b/lib/doc/ja/Shortcuts.lyx
index dbcfb0c..800fd2a 100644
--- a/lib/doc/ja/Shortcuts.lyx
+++ b/lib/doc/ja/Shortcuts.lyx
@@ -5,7 +5,7 @@
 \save_transient_properties true
 \origin /systemlyxdir/doc/ja/
 \textclass bxjsarticle
-\use_default_options false
+\use_default_options true
 \maintain_unincluded_children false
 \begin_local_layout
 InsetLayout            Flex:Ruby
@@ -28,9 +28,15 @@ EndFont
 Mandatory      1
 EndArgument
 Preamble
-\IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 End
 \end_local_layout
diff --git a/lib/doc/ja/Tutorial.lyx b/lib/doc/ja/Tutorial.lyx
index b698437..146aee9 100644
--- a/lib/doc/ja/Tutorial.lyx
+++ b/lib/doc/ja/Tutorial.lyx
@@ -1,11 +1,11 @@
-#LyX 2.3 created this file. For more info see http://www.lyx.org/
+#LyX 2.4 created this file. For more info see https://www.lyx.org/
 \lyxformat 544
 \begin_document
 \begin_header
 \save_transient_properties false
 \origin /systemlyxdir/doc/ja/
 \textclass bxjsbook
-\use_default_options false
+\use_default_options true
 \maintain_unincluded_children false
 \begin_local_layout
 InsetLayout            Flex:Ruby
@@ -28,9 +28,15 @@ EndFont
 Mandatory      1
 EndArgument
 Preamble
-\IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 End
 \end_local_layout
@@ -40,7 +46,7 @@ End
 \fontencoding global
 \font_roman "lmodern" "IPAexMincho"
 \font_sans "default" "IPAexGothic"
-\font_typewriter "default" "default"
+\font_typewriter "default" "IPAGothic"
 \font_math "auto" "auto"
 \font_default_family default
 \use_non_tex_fonts false
@@ -62,7 +68,7 @@ End
 \pdf_author "LyX Team, Japanese translation: Koji Yokata"
 \pdf_subject "LyX-documentation Tutorial"
 \pdf_keywords "LyX, documentation"
-\pdf_bookmarks false
+\pdf_bookmarks true
 \pdf_bookmarksnumbered true
 \pdf_bookmarksopen true
 \pdf_bookmarksopenlevel 2
diff --git a/lib/doc/ja/UserGuide.lyx b/lib/doc/ja/UserGuide.lyx
index f464eff..bbb35df 100644
--- a/lib/doc/ja/UserGuide.lyx
+++ b/lib/doc/ja/UserGuide.lyx
@@ -77,8 +77,15 @@ Mandatory    1
 EndArgument
 Preamble
 \IfFileExists{okumacro.sty}
-{\usepackage{okumacro}}
-{\newcommand{\ruby}[2]{#2}}
+\ifdefined\kanjiskip
+  \IfFileExists{okumacro.sty}%
+    {\usepackage{okumacro}}%
+    {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}%
+\else \ifdefined\luatexversion
+  \usepackage{luatexja-ruby}
+\else \ifdefined\XeTeXversion
+  \usepackage{ruby}%
+\fi\fi\fi
 EndPreamble
 End
 \end_local_layout
diff --git a/lib/examples/ja/Modules/Braille.lyx 
b/lib/examples/ja/Modules/Braille.lyx
index 8e0454a..8bf26da 100644
--- a/lib/examples/ja/Modules/Braille.lyx
+++ b/lib/examples/ja/Modules/Braille.lyx
@@ -10,7 +10,7 @@
 \renewenvironment{lyxgreyedout}
  {\textcolor{blue}\bgroup}{\egroup}
 \end_preamble
-\use_default_options false
+\use_default_options true
 \begin_modules
 braille
 \end_modules
diff --git a/lib/examples/ja/Multilingual_Typesetting_%28CJKutf8%29.lyx 
b/lib/examples/ja/Multilingual_Typesetting_%28CJKutf8%29.lyx
index 06f3df6..52572bd 100644
--- a/lib/examples/ja/Multilingual_Typesetting_%28CJKutf8%29.lyx
+++ b/lib/examples/ja/Multilingual_Typesetting_%28CJKutf8%29.lyx
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 572
+\lyxformat 573
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -31,7 +31,7 @@
   %\setmonojfont{WenQuanYi Micro Hei Mono}
 \fi
 \end_preamble
-\use_default_options false
+\use_default_options true
 \begin_modules
 logicalmkup
 \end_modules
@@ -63,6 +63,15 @@ logicalmkup
 \paperfontsize default
 \spacing single
 \use_hyperref false
+\pdf_bookmarks false
+\pdf_bookmarksnumbered true
+\pdf_bookmarksopen false
+\pdf_bookmarksopenlevel 1
+\pdf_breaklinks false
+\pdf_pdfborder true
+\pdf_colorlinks false
+\pdf_backref false
+\pdf_pdfusetitle true
 \papersize default
 \use_geometry false
 \use_package amsmath 1
@@ -135,7 +144,17 @@ For multi-lingual documents with parts in European 
languages, you can use
 \begin_layout Itemize
 
 \lang english
-Set a standard document class (document classes starting with 
+Use one of the Japanese 
+\begin_inset CommandInset href
+LatexCommand href
+name "BXjscls"
+target "https://www.ctan.org/pkg/bxjscls";
+literal "false"
+
+\end_inset
+
+ classes or a standard document class.
+ The other document classes starting with 
 \begin_inset Quotes bld
 \end_inset
 
@@ -143,7 +162,7 @@ Japanese
 \begin_inset Quotes brd
 \end_inset
 
- use pLaTeX).
+ require pLaTeX.
 \end_layout
 
 \begin_layout Itemize
@@ -161,7 +180,7 @@ Japanese (CJK)
 \begin_inset Quotes bld
 \end_inset
 
-Unicode (CJK) (utf8)
+Unicode (utf8)
 \begin_inset Quotes brd
 \end_inset
 
@@ -291,5 +310,18 @@ Russisch:
 \end_layout
 
 \end_deeper
+\begin_layout Enumerate
+
+\lang english
+Japanese characters (
+\lang japanese-cjk
+介, し
+\family sans
+, 門
+\family default
+\lang english
+) may also be used in text parts set to other languages.
+\end_layout
+
 \end_body
 \end_document
diff --git a/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx 
b/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx
index 51a038d..32ec8c4 100644
--- a/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx
+++ b/lib/examples/ja/Multilingual_Typesetting_%28platex%29.lyx
@@ -1,11 +1,11 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 572
+\lyxformat 573
 \begin_document
 \begin_header
 \save_transient_properties true
 \origin /systemlyxdir/examples/ja/
 \textclass bxjsarticle
-\use_default_options false
+\use_default_options true
 \maintain_unincluded_children false
 \language japanese
 \language_package auto
@@ -103,7 +103,7 @@ Japanese … (BXJS Class)
 \begin_inset Quotes erd
 \end_inset
 
- or non-Japaneses standard classes).
+ or non-Japanese standard classes).
 \end_layout
 
 \begin_layout Subsection*
diff --git a/lib/examples/ja/Welcome.lyx b/lib/examples/ja/Welcome.lyx
index 5dbdfdd..944c7a5 100644
--- a/lib/examples/ja/Welcome.lyx
+++ b/lib/examples/ja/Welcome.lyx
@@ -5,7 +5,7 @@
 \save_transient_properties true
 \origin /systemlyxdir/examples/ja/
 \textclass bxjsarticle
-\use_default_options false
+\use_default_options true
 \maintain_unincluded_children false
 \language japanese
 \language_package auto
diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp
index 0b5b139..026c22d 100644
--- a/src/PDFOptions.cpp
+++ b/src/PDFOptions.cpp
@@ -102,9 +102,9 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, 
otexstream & os,
                opt += runparams.hyperref_driver + ",";
 
        // Since LyX uses unicode, also set the PDF strings to unicode strings
-       // with the hyperref option "unicode".
-       // (With Xe/LuaTeX and pTeX, unicode=true is the default
-       // and the option leads to errors with some Japanese document classes)
+       // with the hyperref option "unicode". (With Xe/LuaTeX and pTeX,
+       // unicode=true is the default, with Japanese (platex), the option
+       // leads to errors (even if the input encoding is UTF-8).)
        if (!runparams.isFullUnicode() && !runparams.use_japanese)
                opt += "unicode=true,";
 

Reply via email to