Thank you Ross and others.
In fact, \kok is what I need. I need it to implement the Kashida option in xepersian that I will post my implementation this week in a separate email.
Mehdi
On 4/11/2010 2:23 AM, Ross Moore wrote:

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}




Mehdi


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
 http://tug.org/mailman/listinfo/xetex

------------------------------------------------------------------------
Ross Moore                                       r...@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
------------------------------------------------------------------------






--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
   http://tug.org/mailman/listinfo/xetex


--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to