On 2013-03-13, Uwe Stöhr wrote:
> Currently Cyrillic Serbian documents are uncompilable which is a
> regression to LyX 2.0.5. This bug was uncovered by commit 25e4bf4b2 by
> Enrico which correctly loads the T2A font encoding. The problem is
> that Cyrillic Serbian (and only that language) requires "T2A" as last
> option for fontenc.
Babel's Serbian support misses the auto set-up of a cyrillic font
encoding present in Babel's support for Russian and other languages using
the Cyrillic script. Instead, it relies on the user to hand-insert the
T2A option. (According to the documentation in my Debian/testing-TeXLive
2012 system, there is no support for Serbian Cyrillic.)
The "font encoding definition files" (e.g. t2aenc.def for T2A) loaded by
the fontenc package set up "LaTeX Internal Character Representations"
(LICRs) for all non-ASCII characters defined in the respective font
encoding. A character input via LICR is safe for use also in other font
encodings (if it exists there), e.g. in PDF text (table of contents in the
PDF sidebar).
Loading font encoding files is "the right thing" if you want to use the
corresponding font encoding.
The last option to fontenc determines the default font encoding.
Alternatively, the font encoding can be switched via
\fontencoding{T2A}\selectfont
(this is the content of the \textcyr command defined by Babel) and
similar for other font encodings.
An alternative to the hardcoded changes in C code would be to edit the
languages file and add to
Language serbian
the following code to load the font encoding file and set the font encoding:
PostBabelPreamble
\input{t2aenc.def}
\fontencoding{T2A}\selectfont
EndPostBabelPreamble
Günter
LyX currently does not do this for Cyrillic
and Greek.
I propose a change to "unicodesymbols" to use LICRs instead of hard-coded
character numbers, e.g.
- 0x0410 "\\textcyr{\\char192}" "textcyr" "" # CYRILLIC CAPITAL LETTER A
+ 0x0410 "\\textcyr{\\cyrA}" "textcyr" "" # CYRILLIC CAPITAL LETTER A
so that LyX-converted cyrillic text works in the PDF sidebar.
This requires to change the "textcyr" feature to load t2aenc.def either via
an option to "fontenc" or via \input{t2anec.def}. A similar change is
required for Greek.
The "textcyr/textgreek" from "unicodesymbols" should, however, not append
the required font encoding to the options, as
IMO, the right thing would be to include a cyrillic font encoding in the
fontenc options via the "textcyr" option of "unicodesymbols":
pseudo code:
for fe in ("T2A", "T2B", "T2C", "X2"):
if fe in font_encodings:
return
font_encodings.append("X2")
Maybe we also need