[XeTeX] Fake italics for some characters only

Benct Philip Jonsson bpj at melroch.se
Wed Dec 5 17:19:37 CET 2018


John, Zdenek, thanks for your most helpful hints.

Below is what I came up with eventually, with MWE attached. The 
spacing adjustments are still subject to change. I have no idea 
why the spacing adjustments are required in roman! It turns out I 
need to fake bold as well, and I will probably need to redefine 
`\textbf` eventually, without breaking things I hope!

John, your version worked once I had removed most whitespace, 
which leaked through to the output, but I ended up using more 
LaTeXy language to help myself keep things straight in my head 
when I added the bold(italic) alternatives.

Ross, I believe I am subscribed with my bpj at melroch.se address. If 
there is a problem with this mail too I'm probably not, otherwise 
there may have been a glitch with using an alternate From address 
on my phone. I have my email forwarded around a lot these days. 
Hard to disentagle!

/bpj

````
\usepackage{ifthen}
\usepackage{newunicodechar}
\newfontface\fakeslantfont{FreeSerif}[FakeSlant=0.3]
\newfontface\fakeboldfont{FreeSerif}[FakeBold=1.05]
\newfontface\fakeboldslantfont{FreeSerif}[FakeBold=1.1,FakeSlant=0.3]
\newcommand\objLang[1]{{\italictrue\textit{#1}}} % (double braces 
to keep things local).
\newcommand\myStrong[1]{{\boldtrue\textbf{#1}}}
\newif\ifitalic
\newif\ifbold
\newcommand\fakeBSChar[1]{% #1 = the char
   \newunicodechar{#1}{{%
     \ifthenelse{\boolean{italic}}{%
       \ifthenelse{\boolean{bold}}{%
         \fakeboldslantfont\hspace{-0.07em}#1\hspace{0.05em}}{%
           \fakeslantfont\hspace{-0.05em}#1\hspace{0.05em}}}{%
         \ifthenelse{\boolean{bold}}{%
           \fakeboldfont\hspace{-0.05em}#1\hspace{0.02em}}{%
             \hspace{-0.03em}#1}}}}
}
````


-------------- next part --------------
A non-text attachment was scrubbed...
Name: fakeit.ltx
Type: text/x-tex
Size: 1193 bytes
Desc: not available
URL: <https://tug.org/pipermail/xetex/attachments/20181205/5e0c8091/attachment.bin>


More information about the XeTeX mailing list