5

I'm using Tex with Telugu and English languages. When a word is hyphenated, the hyphen symbol, as apparently is not found in Telugu font, appears as undefined symbol. I want to change it's font to English hoping it would then appear properly. This is what I do for many other symbols in default Latin set.

This is what preamble in my tex file looks like.

\documentclass[12pt, a4paper, onecolumn]{book}
%\documentclass{memoir}
\usepackage{fontspec}
\setmainfont{Lohit Telugu}
\usepackage{polyglossia}
\setmainlanguage{telugu}

%The following is a workaround to substitute the font or default latin characterset
%with an English one, since none of the current Telugu fonts contains that set.
\setotherlanguage{english}
\newfontfamily{\TelSubstFont}[Ligatures=TeX]{Lucida Grande}

\newfontfamily{\TitleFont}{RaviPrakash}

\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\TelSubst

\count255="0000
\loop\ifnum\count255<"007F
  \XeTeXcharclass\count255=\TelSubst
  \advance\count255 by 1
\repeat


\XeTeXinterchartoks 0 \TelSubst = {\begingroup\TelSubstFont}
\XeTeXinterchartoks 255 \TelSubst = {\begingroup\TelSubstFont}
\XeTeXinterchartoks \TelSubst 0 = {\endgroup}
\XeTeXinterchartoks \TelSubst 255 = {\endgroup}

Here's the output:

  • I guess that the hyphen is inserted at a later stage than the work performed by the "interchartoken" procedure. Isn't there a hyphenation character in Telugu? – egreg Jun 21 '12 at 15:52
  • We use it. But unfortunately, in the font I want to use, it is not defined. Is there any workaround? – gopalkoduri Jun 21 '12 at 15:54
  • I'm afraid you have to change font or add the hyphen to it. – egreg Jun 21 '12 at 15:56
  • That is sad :( I'm not aware of how to do it, if I don't find it, I'll post a question. – gopalkoduri Jun 21 '12 at 16:03

1 Answers1

4

I'm afraid that the hyphen is inserted at a later stage than the work performed by the "interchartoken" procedure. So if the font hasn't a hyphen, there's nothing you can do.

The hyphen doesn't necessarily be in the normal position:

\setmainfont[HyphenChar={xyzt}]{Lohit Telugu}

will make the character in position U+xyzt (four or more hexadecimal digits) the one used for hyphenation.

egreg
  • 1,121,712