[XeTeX] Cutting a character
Ross Moore
ross at ics.mq.edu.au
Sat Apr 10 23:53:48 CEST 2010
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 --------------
A non-text attachment was scrubbed...
Name: texshop_image.jpeg
Type: image/jpeg
Size: 53356 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20100411/a53f49a2/attachment-0001.jpeg>
-------------- next part --------------
> Mehdi
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
------------------------------------------------------------------------
Ross Moore ross at maths.mq.edu.au
Mathematics Department office: E7A-419
Macquarie University tel: +61 (0)2 9850 8955
Sydney, Australia 2109 fax: +61 (0)2 9850 8114
------------------------------------------------------------------------
More information about the XeTeX
mailing list