Fix line breaking, punctuation kerning and font switching with non-tex-fonts

Use "luatexja" or "xeCJK" with non-tex fonts in
Japanese and Chinese example documents.
This commit is contained in:
Günter Milde 2019-01-28 22:11:43 +01:00
parent 34f5ba3c54
commit d6aec0dd33
3 changed files with 61 additions and 13 deletions

View File

@ -10,6 +10,16 @@
\ifxetex \ifxetex
\usepackage{xeCJK} \usepackage{xeCJK}
\fi \fi
% proper line breaking, punctuation kerning and font switching
% features with LuaTeX
% see https://tex.stackexchange.com/questions/222980/how-to-use-chinese-with-lualatex
\usepackage{ifluatex}
\ifluatex
\usepackage{luatexja-fontspec}
\setmainjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
\setsansjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
\fi
\end_preamble \end_preamble
\use_default_options true \use_default_options true
\maintain_unincluded_children false \maintain_unincluded_children false
@ -17,9 +27,9 @@
\language_package default \language_package default
\inputencoding utf8-cjk \inputencoding utf8-cjk
\fontencoding auto \fontencoding auto
\font_roman "default" "Noto Serif CJK SC" \font_roman "lmodern" "WenQuanYi Micro Hei"
\font_sans "default" "Noto Sans CJK SC" \font_sans "default" "WenQuanYi Micro Hei"
\font_typewriter "default" "Noto Sans Mono CJK SC" \font_typewriter "default" "WenQuanYi Micro Hei Mono"
\font_math "auto" "auto" \font_math "auto" "auto"
\font_default_family default \font_default_family default
\use_non_tex_fonts false \use_non_tex_fonts false

View File

@ -13,7 +13,19 @@
%\XeTeXlinebreakskip = 0pt plus 1pt %\XeTeXlinebreakskip = 0pt plus 1pt
\usepackage{ifxetex} \usepackage{ifxetex}
\ifxetex \ifxetex
\usepackage{xeCJK} \usepackage{xeCJK}
%\setCJKmainfont{WenQuanYi Micro Hei}
%\setCJKmonofont{WenQuanYi Micro Hei Mono}
\fi
% proper line breaking, punctuation kerning and font switching
% features with LuaTeX
% see https://tex.stackexchange.com/questions/222980/how-to-use-chinese-with-lualatex
\usepackage{ifluatex}
\ifluatex
\usepackage{luatexja-fontspec}
\setmainjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
\setsansjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
\fi \fi
\end_preamble \end_preamble
\options cjk \options cjk
@ -23,9 +35,9 @@
\language_package default \language_package default
\inputencoding utf8-cjk \inputencoding utf8-cjk
\fontencoding auto \fontencoding auto
\font_roman "default" "Noto Serif CJK SC" \font_roman "lmodern" "WenQuanYi Micro Hei"
\font_sans "default" "Noto Sans CJK SC" \font_sans "default" "WenQuanYi Micro Hei"
\font_typewriter "default" "Noto Sans Mono CJK SC" \font_typewriter "default" "WenQuanYi Micro Hei Mono"
\font_math "auto" "auto" \font_math "auto" "auto"
\font_default_family default \font_default_family default
\use_non_tex_fonts false \use_non_tex_fonts false

View File

@ -6,9 +6,26 @@
\origin /systemlyxdir/examples/ja/ \origin /systemlyxdir/examples/ja/
\textclass article \textclass article
\begin_preamble \begin_preamble
% CJKutf8 (4.8.4) maps the Greek letter mu to a mathematical (italic) \usepackage{ifxetex}
% symbol $\mu$ unless the package "textcomp" is loaded. \ifxetex
\usepackage{textcomp} \usepackage{xeCJK}
\setCJKmainfont{IPAexMincho}
\setCJKsansfont{IPAexGothic}
\fi
% proper line breaking, punctuation kerning and font switching
% features with LuaTeX
% see https://tex.stackexchange.com/questions/222980/how-to-use-chinese-with-lualatex
\usepackage{ifluatex}
\ifluatex
\usepackage{luatexja-fontspec}
% use Mainfont (DejaVu) for Greek and Cyrillic:
\ltjsetparameter{jacharrange={-2}}
%\usepackage[match]{luatexja-fontspec}
%\setmainjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
%\setsansjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
%\setmonojfont{WenQuanYi Micro Hei Mono}
\fi
\end_preamble \end_preamble
\use_default_options false \use_default_options false
\begin_modules \begin_modules
@ -19,9 +36,9 @@ logicalmkup
\language_package auto \language_package auto
\inputencoding utf8-cjk \inputencoding utf8-cjk
\fontencoding auto \fontencoding auto
\font_roman "DejaVuSerif" "IPAMincho" \font_roman "DejaVuSerif" "DejaVu Serif"
\font_sans "default" "IPAGothic" \font_sans "DejaVuSans" "DejaVu Sans"
\font_typewriter "default" "default" \font_typewriter "DejaVuSansMono" "DejaVu Sans Mono"
\font_math "auto" "auto" \font_math "auto" "auto"
\font_default_family default \font_default_family default
\use_non_tex_fonts false \use_non_tex_fonts false
@ -194,6 +211,15 @@ Libertine
work). work).
\end_layout \end_layout
\begin_layout Itemize
\noindent
\lang english
Alternatively, you can use non-TeX fonts with xeCJK (XeTeX) or luatexja
(LuaTeX).
See the document preamble for an example.
\end_layout
\begin_layout Standard \begin_layout Standard
\lang english \lang english