2

I have encountered a strange problem using the Devanagari font Shobhika in ConTeXt, where the rakaara forms are not formed properly in some glyphs.

Here is a sample document I am using to demonstrate the issue:

\setupbodyfont[shobhika]
\definehighlight
  [wr]
  [color=red]
\starttext
\startcolumns
दं‌ष्ट्रा

ट्रा

ट्रि ट्री

ट्रो 
ट्रौ 
\column
त्रिदल \wr{त्रेता} 

विक्रिय \wr{विक्रेता} क्रोड 

प्रीति \wr{प्रेप्सित} 

तच्छ्री \wr{श्रेष्ठ} 
\stopcolumns
\stoptext

The typescript 'shobhika' above is as follows:

\starttypescript [serif] [shobhika]
  \definefontsynonym 
    [Serif] 
    [name:shobhikaregular] 
    [features=devanagari-two]
  \definefontsynonym 
    [SerifBold] 
    [name:shobhikabold]
    [features=devanagari-two]
\stoptypescript


\starttypescript [shobhika]
  \definetypeface [shobhika] [rm] [serif] [shobhika]
\stoptypescript 

With this typescript, which I call 'dev2', I get the following output:

enter image description here

The rakaar forms are not formed properly (highlighted in red) in all cases but that of the ट-varga. The 'devanagari-two' features use the 'dev2' script tag.

Now if I use the following typescript instead (which uses the 'deva' script tag instead of 'dev2'),

\starttypescript [serif] [shobhika]
  \definefontsynonym 
    [Serif] 
    [name:shobhikaregular] 
    [features=devanagari-one]
  \definefontsynonym 
    [SerifBold] 
    [name:shobhikabold]
    [features=devanagari-one]
\stoptypescript


\starttypescript [shobhika]
  \definetypeface [shobhika] [rm] [serif] [shobhika]
\stoptypescript 

with the document

\setupbodyfont[shobhika]
\definehighlight
  [wr]
  [color=red]
\starttext
\startcolumns
\wr{%
दं‌ष्ट्रा

ट्रा ट्रे
}

ट्रि ट्री

\wr{%
ट्रो 
ट्रौ}
\column
त्रिदल त्रेता

विक्रिय विक्रेताक्रोड 

प्रीति प्रेप्सित

\wr{तच्छ्री} श्रेष्ठ इन्द्रो 
\stopcolumns
\stoptext

I get the following output :

enter image description here

Here the rakaar forms are not formed properly in the case of the ट-varga and for some glyphs involving the consonant छ.

Using the 'devanagari-one' typescript above, I am able to 'circumvent' this issue by writing those forms as follows

छ्र‌ +‌ ​​​​​ZWS + Devanagari vowel sign

where ZWS is the zero-width space U+200B.

I must mention here that I have not had any problems using Shobhika font in XeLaTeX with either the 'deva' or the 'dev2' script tags. I must also mention that I have tried some other Devanagari fonts in ConTeXt and have had no such issues. I have also looked through font-pre.mkiv of the ConTeXt source and experimented with a mix of the features and the script tags, quite unfortunately, to no avail. As suggested in the ConTeXt wiki, I have also consulted the MS page on this topic.

I have, over the past two years migrated entirely to ConTeXt for most typesetting uses. I am no expert in ConTeXt by any stretch, but at the same time, I would humbly submit that I am no novice either. As a student, I have had no problems using ConTeXt to produce stunning documents in English language with a large number of mathematics.

However, I must admit that I am not sure if this is an issue with ConTeXt or with the font itself. I will be very grateful for any help by members here.

Thanks, Kauśika

2
  • Not a proper solution or answer, but as a hack: Since you say you're able to circumvent it by inserting U+200B zero-width space (ZWS), have you considered just doing a regex-replace on your input file (in your text editor say)? Or maybe ConTeXt has something like LuaTeX's process_input_buffer that can automatically insert those / pretend they exist in your document? (BTW, if there are cases where ZWS doesn't help, also try ZWJ and ZWNJ.) Sep 2 at 20:35
  • You mention that other fonts work correctly in ConTeXt. Then this is a font issue. Maybe there are some ligatures that are not defined in the font? It is possible to patch such fonts on the fly, but I don't know any details on that. It may be useful to ask on the context mailing list
    – Aditya
    Sep 10 at 16:43
1

I know nothing about devanagari. But the difference between xelatex and context is the difference between the context font renderer and harfbuzz.

You can test the difference with lualatex by setting the renderer explicitly:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Shobhika-Regular.otf}[Script=Devanagari]
\setsansfont{Shobhika-Regular.otf}[Script=Devanagari,Renderer=Harfbuzz]
\def\wr{}
\begin{document}
\begin{minipage}{2cm}
त्रेता
\end{minipage}
\quad%
\begin{minipage}{2cm}
\sffamily 
त्रेता
\end{minipage}

\end{document}

enter image description here

There is probably not much you can do apart from reporting this to the context mailing list. context doesn't include harfbuzz so there is no option to switch to this renderer.

1
  • Thanks very much for your response. I was hoping that font rendering would be the last thing to worry about here. I will now ask on the mailing list as you suggested. Hoping for a fix!
    – Kauśika
    Sep 1 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.