inheritFont() semantics: exorcist wanted.
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Sat Apr 10 12:35:15 UTC 2021
In my naïve mind, life was simple.: inheritFont was intended to convey
the fact that the font inside the inset is the same as outside.
Actually it is possessed by some demon:
/**
* The font is inherited from the parent for LaTeX export if this
* method returns true. No open font changes are closed in front of
* the inset for LaTeX export, and the font is inherited for all other
* exports as well as on screen.
* If this method returns false all open font changes are closed in
* front of the inset for LaTeX export. The default font is used
* inside the inset for all exports and on screen.
*/
virtual bool inheritFont() const { return true; }
Note that inheritFont() itself is the consequence of some previous
exorcism work:
---------------------------
commit f176a18434d40eead5f5a64234db9445053cbf76
Author: Georg Baum <Georg.Baum at post.rwth-aachen.de>
Date: Tue Feb 22 19:41:04 2011 +0000
Fix bug #6919 by splitting Inset::noFontChange() into inheritFont() and
resetFontEdit(). The former is used for on-screen and export
formatting,
and the latter is used for interactive editing.
----------------------------
The problem is that is makes screen display impossible to solve issues
that are only LaTeX related (and probably harm docbook and LyXHtML). The
two problematic cases I am aware of are:
* the footnote inset, which does not inherit font, but pretends to do in
order to be able to output the footnote marker in the correct font.
* the tabular inset, which now when exported takes great pain to pretend
that it does not inherit fonts
The attached lyx file demonstrate issues:
In 2.3.x, the footnote is correct in LaTeX and pdf but the tabular is
correct only in output. I master, the footnote is incorrect in ouput,
and the tabular is coerced to reset font, which incidentally breaks
existing documents (since 2.3 did produce an emphasized tabular in 2.3).
It may be that InsetTabular case can be fixed by making it
inheritFont=true. I am not sure what bad thing may happen then.
But in the case of footnote, this is very disturbing.
What I would propose is to split again inheritFont() in two
* inheritScreetFont(), or better inheritFont()
* needsSomethingWeirdWithFontsInLaTeX() for the other uses (or a better
name ;). This one will probably only be needed in Paragraph.cpp, maybe
in conjunction with the real inheritFont.
Does this seem doable?
JMarc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inheritfont.lyx
Type: application/x-lyx
Size: 3053 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210410/c1a6e8c3/attachment.lyx>
More information about the lyx-devel
mailing list