I use fontenc
, fontspec
and xelatex
to load the custom font.
\usepackage[T1]{fontenc}
\usepackage{fontspec}
\usepackage[utf8]{inputenc}
\usepackage{xunicode}
\setmainfont[Mapping=Tex-Text]{Warnock Pro}
But I have some problem about choosing char by using \char
. The \char"201C
is different than just type ``. `` displays correctly as what it is in glyphs. But \char"201C
is very similar to \textquotedblleft
(but a little bit different). That is, \char"201C is not belong to typefaces "Warnock Pro". Also, if I just type “, it is also similar to \textquotedblleft
.
How to output a char by specifying \char"xxx of custom loaded font?
That is, if possible, I don't want to use [Mapping=Tex-Text]
, and just want to type quote, or other char, such as α directly. Most chars can be displayed right. But some of them (especially quoted-related char) can't be showed right.
--UPDATE Some chars, such as ‡ or †, it won't be displayed no matter I type † or \char"2020. (no matter I use Mapping=Tex-Text or not). Do I need to add some other parameters?
--UPDATE 2
I found out the problems happends due to I use the package \usepackage{xeCJK}
. However, I need it to set up English/Forein language seperately. I seems it would make \char"xxx displays the font belongs to \setCJKmainfont
.
By xeCJK
, the char\"201C should use non-CJK font. But it seems it still use CJK-font now (even though I use \xeCJKsetcharclass{"2000}{"2FFF}{0}
). But if I turn of xeCJK (\makexeCJKinactive
then it displays correctly)
--UPDATE 3
I add the following testing code. It seems xeCJK
can't work correctly?
\documentclass[a4paper,10pt]{article}
\usepackage{xeCJK}
\setCJKromanfont{Verdana}
\setromanfont{Times New Roman}
\begin{document}
--\char"201C --``--“--‘‘--\char"60--\textquoteleft\\
%output: verdana--times("60)--verdana--verdana--times--verdana
\setromanfont[Mapping=tex-text]{Times New Roman}
--\char"201C --``--“--‘‘ --\char"60--\textquoteleft\\
% output: verdana, Times ("201C)--verdana--verdana--times("2018)--verdana
\xeCJKsetcharclass{"0}{"2FFF}{0} %same
--\char"201C --``--“--‘‘ --\char"60--\textquoteleft\\
\xeCJKsetcharclass{"0}{"2FFF}{1} %same
--\char"201C --``--“--‘‘ --\char"60--\textquoteleft\\
\makexeCJKinactive %all in roman
--\char"201C --``--“--‘‘ --\char"60--\textquoteleft\\
\end{document}
Thank you!
\char"201C
is different than just typing ``. That is, `` is correct.\char"201C
displays double quote mark, but this mark is not belong to Warnot Pro's font.\char"xx
, I will get the right char with wrong font. The problem is not a really problem, in fact. But for single/double quote, the different char make the text looked inconsistency sometimes.xeCJK
package. See also xeCJK messes with punctuation and Linebreak and \enquote.