# Kashida-like Hebrew typesetting

I was wondering, what if there actually was a way to produce kashida-like typography in Hebrew in LaTeX. Not necessary as paragraph text, even as an image (nobody prints books like that to the best of my knowledge, but just for ethnographic exercise it would be nice).

To give you a sense of what it may look like: a traditional hand-written text:

A (not so modern font, this one however was cast in lead, of that I'm sure) reminiscent of this feature:

• Related: How to typeset a complex layout like a page of the Talmud? (duplicate?) – Alan Munn Jan 1 '15 at 19:10
• afaik it is only permissible to elongate the letters א, ד, ה, כ, ל, ם, ר, ת. Unicode has them as HEBREW LETTER WIDE ALEF etc on FB21--FB28. So it would be possible to use these to a mock the handwriting style. But as your scans show, this is only a crude simplification of the actual tradition and a more flexible solution would be needed. – Florian May 26 '16 at 18:54
• The Culmus Project has the wide letters of which Florian speaks in its Frank Ruehl CLM, Hadasim CLM, Keter Aram Tsova, Keter YG, Shofar Regular, and Simple CLM, which define a jalt feature for Hebrew justification alternates. One can imagine a font with a range of widths selected through stylistic sets, but it seems not to exist yet. Wide Hebrew letters are found in very few commercial fonts, and often the encoding is wrong, such that the text would be inaccessible. – Thérèse Jul 5 '16 at 1:05
• A different approach is to develop a similar package to this tug.org/TUGboat/tb35-3/tb111haralambous.pdf, which is for arabic. – Yiannis Lazarides Oct 17 '17 at 5:07
• It seems the answer is: Not yet. To summarise: For elongated characters, (a) the font must have the wide characters (e.g., Coelacanth does); (b) the font must have the jalt Justification Alternates font feature (e.g., Shofar does, for script='hebr'); (c) the font feature must be activated (fontspec does not support jalt: Table 5, p 40, v2.7c); (d) the font renderer must be able to handle the feature (e.g., in experiments, Word doesn't, for Hebrew; and HarfBuzz "knows nothing about ... lines", so can't help with justification); (e) there must be a justification context. – Cicada Oct 5 '19 at 6:35

## 1 Answer

The old-fashioned way, without relying on jalt or renderers:

(1) Using lamed as an example, for a certain size and a certain font, typeset the glyph as a standalone pdf.

(actual size)

\documentclass[12pt]{standalone}
\usepackage{fontspec}
\setmainfont[Script=Hebrew]{FreeSerif}\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{hebrew}

\begin{document}
{\texthebrew{ﬥ}}
\end{document}


(2) Then, with the graphicx package (or adjustbox, an extension of it), includegraphics{} lamed back in again three times, triming the pdf/glyph into three parts: left, middle, and right.

(3) And, lastly, multiply the middle out a number of times.

(top row: narrow and wide glyphs in the font)

(middle row: wide glyph divided into three parts)

(bottom row: the middle part multiplied)


\documentclass[12pt]{article}
%\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{fontspec}
\setmainfont[Script=Hebrew]{FreeSerif}\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{hebrew}

\newcommand\lleft{\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{lamedw}}
\newcommand\lmid{\includegraphics[clip,trim=0.15em 0em 0.3em 0em]{lamedw}}
\newcommand\lright{\adjincludegraphics[clip,trim=0.4em 0em 0em 0em]{lamedw}}

\begin{document}

\texthebrew{ﬥ}\texthebrew{ל}

\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{lamedw}
\includegraphics[clip,trim=0.15em 0em 0.3em 0em]{lamedw}
\adjincludegraphics[clip,trim=0.4em 0em 0em 0em]{lamedw}
\texthebrew{ﬥ}

\lleft\lmid\lright \lleft\lmid\lmid\lmid\lright
\lleft\lmid\lmid\lmid\lmid\lmid\lmid\lright

\end{document}


Edited to add:

It may be wortwhile to add the code snippets for the others, to save users having to type, because the trim can be slightly different between the glyphs.

This code be done in a loop.

In the preamble:


\newcommand\hleft{\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{hew}}
\newcommand\hmid{\includegraphics[clip,trim=0.16em 0em 0.3em 0em]{hew}}
\newcommand\hright{\adjincludegraphics[clip,trim=0.4em 0em -0.10em 0em]{hew}}

\newcommand\dleft{\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{daletw}}
\newcommand\dmid{\includegraphics[clip,trim=0.16em 0em 0.3em 0em]{daletw}}
\newcommand\dright{\adjincludegraphics[clip,trim=0.4em 0em -0.10em 0em]{daletw}}

\newcommand\kleft{\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{kafw}}
\newcommand\kmid{\includegraphics[clip,trim=0.16em 0em 0.3em 0em]{kafw}}
\newcommand\kright{\adjincludegraphics[clip,trim=0.4em 0em -0.10em 0em]{kafw}}

\newcommand\mleft{\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{memw}}
\newcommand\mmid{\includegraphics[clip,trim=0.16em 0em 0.3em 0em]{memw}}
\newcommand\mright{\adjincludegraphics[clip,trim=0.4em 0em -0.10em 0em]{memw}}

\newcommand\rleft{\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{reshw}}
\newcommand\rmid{\includegraphics[clip,trim=0.16em 0em 0.3em 0em]{reshw}}
\newcommand\rright{\adjincludegraphics[clip,trim=0.4em 0em -0.10em 0em]{reshw}}

\newcommand\tleft{\includegraphics[trim=0pt 0pt 6pt -2pt,clip]{tavw}}
\newcommand\tmid{\includegraphics[clip,trim=0.18em 0em 0.3em 0em]{tavw}}
\newcommand\tright{\adjincludegraphics[clip,trim=0.4em 0em -0.10em 0em]{tavw}}



In the document:


\texthebrew{ﬢ}\texthebrew{ד}

\dleft\
\dmid\
\dright\
\texthebrew{ﬢ}

\dleft\dmid\dright \dleft\dmid\dmid\dmid\dright
\dleft\dmid\dmid\dmid\dmid\dmid\dmid\dright

\texthebrew{ﬣ}\texthebrew{ה}

\hleft\
\hmid\
\hright\
\texthebrew{ﬣ}

\hleft\hmid\hright \hleft\hmid\hmid\hmid\hright
\hleft\hmid\hmid\hmid\hmid\hmid\hmid\hright

\texthebrew{ﬤ}\texthebrew{כ}

\kleft\
\kmid\
\kright\
\texthebrew{ﬤ}

\kleft\kmid\kright \kleft\kmid\kmid\kmid\kright
\kleft\kmid\kmid\kmid\kmid\kmid\kmid\kright

\texthebrew{ﬦ}\texthebrew{ם}

\mleft\
\mmid\
\mright\
\texthebrew{ﬦ}

\mleft\mmid\mright \mleft\mmid\mmid\mmid\mright
\mleft\mmid\mmid\mmid\mmid\mmid\mmid\mright

\texthebrew{ﬧ}\texthebrew{ר}

\rleft\
\rmid\
\rright\
\texthebrew{ﬧ}

\rleft\rmid\rright \rleft\rmid\rmid\rmid\rright
\rleft\rmid\rmid\rmid\rmid\rmid\rmid\rright

\texthebrew{ﬨ}\texthebrew{ת}

\tleft\
\tmid\
\tright\
\texthebrew{ﬨ}

\tleft\tmid\tright \tleft\tmid\tmid\tmid\tright
\tleft\tmid\tmid\tmid\tmid\tmid\tmid\tright



which leaves alef, and its diagonal bar, as a special case.