[XeTeX] forming a star around a number in Arabic script

Jonathan Kew jonathan_kew at sil.org
Fri Dec 14 22:39:00 CET 2007


On 14 Dec 2007, at 4:58 am, Computer Support Chad wrote:

> I have a challenge for someone out there. I'm working in Arabic  
> script, and have a need to include numbers in the text (in Hindi  
> number format) that are superscripted and enclosed in a kind of  
> "star". I have included an image below, but I don't know if that  
> can come through on the list. (I can email it offline if anyone is  
> interested.) The image shows a "star" that is actually the outside  
> border of two squares rotated 45 degrees from each other. It may be  
> acceptable for the actual shape of the "star" in my application to  
> be different, so if someone wanted to produce a circle or a square  
> (at least as a first draft), I would be interested in that as well.
>
> So is anyone up to the challenge of producing a (Xe)TeX macro that  
> will do this?

This sounds like the kind of thing for which U+06DD is intended,  
though its glyph varies a lot and is not usually star-shaped. But you  
might like to try this, with a font such as Scheherazade that  
supports this character:

     \TeXXeTstate=1
     \font\ar="Scheherazade:script=arab" at 24pt \ar
     \def\num#1{\char"202E\char"06DD #1\char"202C\relax}

     \noindent\beginR السلام \num{١٢٣} عليكم

     \end

(Note that directional overrides are needed in order to make the  
rendering work properly; this is currently a limitation of how xetex,  
bidi ordering, and the OpenType tables interact.) You can enclose the  
whole sequence in \raise<dimen>\hbox{......} if you want to shift it  
up from the baseline.

Alternatively, you can locate a glyph you like in some other font,  
and use overlaid boxes to place your digits into it; here's an  
example using a plain square from Webdings:

     \font\webdings="Webdings" at 14pt
     \font\arsmall="Scheherazade:script=arab" at 11pt

     \def\boxednum#1{\setbox0=\hbox{\webdings \char"F063}%
       \setbox2=\hbox to \wd0{\hfil \arsmall #1\hfil}%
       \raise.5ex\hbox{\rlap{\box0}\raise3pt\box2}}

     \noindent\beginR السلام \boxednum{٤٢} عليكم

If your original numbers are using Western digits (0123...), but you  
want to print them with the ٠١٢٣... characters, the easiest way is  
to apply a font-mapping that does this conversion; this has been  
discussed previously, or see examples in the ArabXeTeX package on CTAN.

JK


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/xetex/attachments/20071214/8f1c2e7a/attachment.html 


More information about the XeTeX mailing list