On Tue, Dec 16, 2003 at 11:23:29AM +0000, Angus Leeming wrote: > Andre Poenitz wrote: > > > On Mon, Dec 15, 2003 at 09:19:00PM +0200, Martin Vermeer wrote: > >> Attached a patch to make the CharStyle inset honour the font in the > >> .layout file again. > >> > >> This should bring back the original functionality that was lost > >> with one of (André's?) > > > > Yes. > > > >> cleanup patches that removed getDrawFont() from the text?.C files. > >> Michael, if this doesn't collide with what you're doing I would > >> like to check this in. > > > > Looks ok, at least that's the way per-inset font changes should be > > handled nowadays. > > > > Andre' > > Could you not make it clearer that you're temporarily using a > different font to the one passed to you in mi, pi. Eg semantics like: > > LyXFont const font = getDrawFont(mi.base.font); > InsetCollapsable::metrics(MetricsInfo(mi).setFont(font), > dim); > > LyXFont const font = getDrawFont(pi.base.font); > inset.draw(PainterInfo(pi).setFont(font), x, y);
This needs to be re-set at the end of the block, i.e. the change should be temporary (Copying the whole struct was a performance bottleneck in mathed. It's probably less so in texted as changes are less frequent there). Furthermore, the pi and mi parameters are passed as non-const references as they are supposed to 'collect' information as well, so creating a temporary in the same expression would not work. The proper solution would be implementing a new 'FontChanger' similar to the stuff in metricsinfo.h. I'd wait a bit though until the dust has settled a bit. Andre'