Jean-Marc Lasgouttes wrote:

> Juergen, could you tell me when setting local_font is necessary? I did
> not see the problem when creating a new listing inset with caption.

The problem showed up when you created a listings inset with a caption
before the patch: somehow (and I never actually found out where/why) the
caption inherits the language and encoding of the listings insets, which is
latex/latin1 (latin1, because listings fails with utf8; the hardcoding is
certainly not ideal). Therefore, the caption was embedded in
\encoding{latin1}...\selectlanguage{english} (or whatever the document
language is).
I forced the caption to use the buffer font (buffer()->params().getFont())
in metrics and draw, which solved the display issue (which is now correctly
roman, not typewriter), but not the language issue (which is apparently
still latex).

What the code in InsetListings does, is to force the params.local_font to
real_current_font, before the params are passed to
InsetCaption::getArgument, which removes the wrong encoding and language
switches.

I agree that this smells fishy, but I didn't find another way to solve the
issue (which results in LaTeX errors).
(Dov might know better; I stole the code from his patch).

Any input highly appreciated.

Jürgen

Reply via email to