I believe that I have finished the preview stuff, bar some minor tidy-ups. 
Attached is a screen shot for you. It's now quick (doesn't block LyX when the 
buffer is loaded) and the user code has a nice, neat interface. Should please 
André ;-)

One minor question. Should the foreground colour of the preview be blue 
(math) or black (standard text)? Ie, should I use LColor::foreground or 
LColor::math?

Two points to address:

1. The preview lettering is not the same size as that of the rest of LyX. I 
believe that's because I've misunderstood something ;-)

I'm using
        \screen_dpi 95
        \screen_zoom 130
Running "gs -r124.5" (= 95 * 130 / 100) gives the result shown.

Anybody got any idea about this stuff?

2. The ascent/descent of the preview is incorrect. Not surprising since I 
haven't attempted to extract this info from the PostScript file. I /have/ 
kept a copy of David's mail on the subject so might look at it in the near 
future...

However, at the moment I don't understand the ascent/descent code in 
InsetFormula. André, why are you interested in par_->ascent(), 
par_->height()? Why not just return the image height? Basically, I don't 
understand what's meant to be happening.

 int InsetFormula::ascent(BufferView *, LyXFont const &) const
 {
        const int a = par_->ascent();
        if (!canPreview())
                return a + 1;
        return a + 1 - (par_->height() - loader_->image()->getHeight()) / 2;
 }
 
 
 int InsetFormula::descent(BufferView *, LyXFont const &) const
 {
        const int d = par_->descent();
        if (!canPreview())
                return d + 1;
        return d + 1 - (par_->height() - loader_->image()->getHeight()) / 2;
 }

Any insights?

Angus

Attachment: preview.png
Description: PNG image

Reply via email to