[XeTeX] Cutting a character
Karljurgen Feuerherm
kfeuerherm at wlu.ca
Sun Apr 11 03:14:12 CEST 2010
I had been thinking of a related problem, may I pose it here?
I wish to shade quarters of characters, top left, top right, bottom
left, bottom right, or various combinations thereof.
I'm still pretty new at this, so if anyone can help with that, I'd be
grateful.
K
Karljürgen G. Feuerherm, PhD
Department of Archaeology and Classical Studies
Wilfrid Laurier University
75 University Avenue West
Waterloo, Ontario N2L 3C5
Tel. (519) 884-1970 x3193
Fax (519) 883-0991 (ATTN Arch. & Classics)
>>> Ross Moore <ross at ics.mq.edu.au> 10/04/2010 5:53 pm >>>
On 11/04/2010, at 3:56 AM, Mehdi Omidali wrote:
> Hi all,
> Is it possible to construct a box that contains a fraction (say
> half) of a character (horizontal half) of a font.
It isn't clear whether you want the width of the box
to be the original character width, or only the width
of what remains visible after knocking-out half of it.
Here are commands which implement both viewpoints,
with an optional parameter to adjust how much to
"knock out" (i.e., overprint with a white rule).
The examples test various amounts.
\usepackage{color}
\newcommand{\ko}[2][.25]{{#2%
\setbox0=\hbox{#2}\dimen0=#1\wd0
\dimen2=\ifdim \dp0=0pt .1ex\else 1.1\dp0\fi
\kern-\dimen0
{\color{white}\vrule height 1.1\ht0 depth\dimen2 width\dimen0}%
% \kern-\dimen0
}}
\newcommand{\kok}[2][.25]{{#2%
\setbox0=\hbox{#2}\dimen0=#1\wd0
\dimen2=\ifdim \dp0=0pt .1ex\else 1.1\dp0\fi
\kern-\dimen0
{\color{white}\vrule height 1.1\ht0 depth\dimen2 width\dimen0}%
\kern-\dimen0
}}
\begin{document}
\noindent Retain full character widths:\par
\medskip
{\LARGE\noindent
\ko{H}\ko{E}\ko{L}\ko{L}\ko{O} \ko{W}\ko{o}\ko{r}\ko{l}\ko{d}.\par}
{\LARGE\noindent
\ko[.5]{H}\ko[.5]{E}\ko[.5]{L}\ko[.5]{L}\ko[.5]{O} \ko[.3]{W}\ko[.3]
{o}\ko[.3]{r}\ko[.3]{l}\ko[.3]{d}.\par}
\bigskip
\noindent Use only the width remaining after knock-out:\par
\medskip
{\LARGE\noindent
\kok{H}\kok{E}\kok{L}\kok{L}\kok{O} \kok{W}\kok{o}\kok{r}\kok{l}\kok
{d}.\par}
{\LARGE\noindent
\kok[.5]{H}\kok[.5]{E}\kok[.5]{L}\kok[.5]{L}\kok[.5]{O} \kok[.3]{W}
\kok[.3]{o}\kok[.3]{r}\kok[.3]{l}\kok[.3]{d}.\par}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20100410/fe87bb5f/attachment.html>
More information about the XeTeX
mailing list