Martin Vermeer wrote:
On Sun, Oct 07, 2007 at 10:05:00AM +0300, Martin Vermeer wrote:
On Sun, Oct 07, 2007 at 02:26:48AM +0200, Dov Feldstern wrote:
 Hi!

...
AFAIU, charstyle insets "work" (i.e., determine the font attributes as they would appear in the latex output), in the following manner: when such an inset is reached, and say it's a "noun" inset, then the command for starting the "noun" command is output, followed by the text of the inset, followed by the command for closing "noun".
Yes, \noun{ and } respectively.
The problem with this is that it's a *new* method for determining the font attributes, which comes alongside the already existing method (character-attributes). And as complicated as character-attributes are, mixing two different methods for control fonts appearance is only going to make things more complicated. Firstly, just because every time someone now wants to somehow interact with font attributes, now two different "places" have to be checked in order to determine the current font attributes at a given position (1. what are the character attributes at this position? 2. is this position inside an inset which could affect font attributes? And note that the answer to (2) is not trivial, even if it's the *only* method being used). Secondly, this can lead to all kinds of situations of over-definition: what if the inset determines one thing, but font-attributes determine another?
What the inset does, is 'very' clear.

Or, what if you have two "emph" insets one inside the other --- using the current implementation, I believe you'd get something like "\emph{bla bla \emph{bla bla}}", which is probably *not* what we want. (To be sure, with the current character attributes implementation, I'm not sure that we'd get what we want, either: we'd probably get "\emph{bla bla bla bla}", which is at least better, IMO. What we'd really want might depend on the specific charstyles being used, but I don't see any good way to even recognize this situation using insets.
Emph handles this situation on the keyboard input level by
toggling. Which indeed is a good reason to keep it that way
i.e., the range approach.

I should add to this two things:

1) In LaTeX, \emph actually works in the 'toggling' way, which allows the emphasis style where you can emphasize a word inside a larger emphasized area -- or text that is italicized for some other reason -- by making it upright again. LyX just supports that practice on-screen.


I see, this *is* important to know, I was not aware of that...

2) This would be very easy to do in an inset, as getDrawingFont
is your friend: just make it test for italics in the surrounding
font and respond appropriately ;-) The current Emph inset does
not do this, which is a bug.

Or, alternatively, not to use getDrawFont at all; and instead, to set the font attributes to reflect their "real" value. Then, the correct font would be used automatically when painting. That's what I'm getting at: just set the font attributes of the text inside the inset, and let the drawing/latex output happen automatically...


As I said earlier, however, I propose _not_ to move emph to
inset mode, but hang on to the existing implementation, for
reasons explained: emphasization is a sui generis.

(But, what this implementation gets wrong is that is does not
distinguish the situations

\emph{aaa \emph{bbb} ccc}

and

\emph{aaa} bbb \emph{ccc}

which are visually identical but logically _vastly_ different)

Correct. With Ranges, we should be able to deal with this case nicely. We just have to figure out exactly how...


- Martin



Reply via email to