[Tex/LaTex] xelatex: Japanese + latin diacritics with cedilla/comma, slanted text

accentscjkfontsxetex

In a document, I need to get all these working:

  • japanese text
  • latin diacritics with cedilla, e.g şţ and with comma, e.g șț
  • slanted text

This is a book I also distribute to others, so I can't change back to pdflatex, it has to remain xelatex (and besides, in xelated the second criteria is fulfilled).

With the following POC, the former and the latter don't work:

\documentclass[10pt]{article}
\usepackage{ifxetex}

\ifxetex
  \usepackage{fontspec}
  \usepackage{xunicode}
  \defaultfontfeatures{Mapping=tex-text} % To support LaTeX quoting style
  \defaultfontfeatures{Ligatures=TeX}
\else
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
\fi

\usepackage{helvet}

\begin{document}
    \setmainfont[Ligatures={TeX, Common}, % sequences of two or more characters yeld one character]
    ItalicFont={Charis SIL:style=Italic},
%    SlantedFont={SourceSansPro Slanted},
    ItalicFeatures=FakeSlant,
    %MonoFont={Myriad CAD:style=Regular},
    Mapping=tex-text,AutoFakeSlant=0.2
    ]{Source Sans Pro:style=Regular} % found by $ fc-list

hello world \textit{italic text} and \textsl{slanted text} and \texttt{monospaced text}.

Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

Japanese: 守 破 離

\end{document}

The output looks like:

enter image description here

How to get it working properly?

Working example

Thanks to @Ulrike Fischer, I got it working like this on ArchLinux with xelatex:

\documentclass[10pt]{article}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[SlantedFont={Charis SIL},SlantedFeatures={FakeSlant=0.2}]{Charis SIL}

\usepackage{xeCJK}
\setCJKmainfont{DejaVu Sans Mono}
\setCJKfamilyfont{sf}{Kozuka Mincho Pr6N:style=R,Regular}
\setCJKfamilyfont{tt}{DejaVu Sans Mono}
\newcommand{\jptext}[1]{\sffamily#1}


\begin{document}
%Roman font Charis SIL:
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

\texttt{monospaced font}

Japanese: \jptext{守 破 離}

----------------------------------------------

%Sans serif font:
\sffamily
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

\texttt{monospaced font}

Japanese: \jptext{守 破 離}
\end{document}

Hope it helps someone.

Best Answer

Regarding the japanese you should imho use xecjk and setup a suitable cjk-font. I don't have much fonts with japanese glyphs so I used Arial Unicode, but there are other.

(Side remark: The xecjk version currently distribuated with miktex doesn't work with the newest l3kernel. You need to get the xecjk from CTAN if you run into errors).

I don't understand which setup for the text fonts you actually want. Your mix of a serif font (Charis Sil) and a sans serif font (Source Sans Pro) is rather curious. As a general remark: There don't exist much fonts with a slanted and an italic version, so normally fontspec maps the two commands to the same font. If you really want both types you can do something like this:

\documentclass[10pt]{article}


\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont[SlantedFont={Charis SIL},
             SlantedFeatures={FakeSlant=0.2}]{Charis SIL}
\setsansfont[SlantedFont={Source Sans Pro},
             SlantedFeatures={FakeSlant=0.2}]{Source Sans Pro}

\usepackage{xeCJK}
\setCJKmainfont{Arial Unicode MS}

\begin{document}
%Roman font Charis SIL:
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă

%Sans serif font:
\sffamily
hello world \textit{italic text} and \textsl{slanted text}.
Diacritics: șş țţ ȘŞ ȚŢ î Î ă Ă


Japanese: 守 破 離
\end{document}
Related Question