Angus Leeming wrote:
> I use it within LyX to calculate the 'ascent fraction' of the 
> snippet. (A snippet whose base line was in the middle of the image 
> would have an ascent fraction of 0.5.) The code that does this inside 
> LyX is (stripped down):
> 
<snip>
> 
> This information is used to position the image on the LyX screen.
> 
> Since both dvipng and dvips,gs,pnmcrop use the same dvi file, it 
> seems to make sense to use the same mechanism. However, if you have 
> another mechanism to obtain this info within dvipng, then please do 
> tell me.

I see. There are two possibilities:

1) Make dvipng detect usage of the 'tightpage' option and use the
   image metrics within the DVI.

2) Output the position of the baseline of the first character output
   in each image, in pixels or possibly as a fraction


> > You are using dvipng-0.4, right? 
> 
> No, I am using whatever is in last night's preview-latex cvs tree.

Odd. The cvs web interface was running against the backup server
yesterday. Possibly you got an old copy.

> Will try '-T tight' tonight. What about colour? 

dvipng supports color except for the postscript names and it is still
lacking a color stack that remembers the state between pages when
processing pages backwards, for instance. Normal-ordered operation is
OK.

> At the moment, going 
> the dvips,gs,pnmcrop route I encode the forground and background 
> colours of the lyx screen as postscript specials:
> 
> \AtBeginDocument{\AtBeginDvi{%
> \special{!userdict begin/bop-hook{//bop-hook exec
> <000000faf0e6>{255 div}forall setrgbcolor
> clippath fill setrgbcolor}bind def end}}}
> 
> My reading of the dvipng manual suggests that I can discard this when 
> using dvipng and use the command line options
>         -fg "rgb 0.0 0.0 0.0" -bg "rgb 0.980 0.941 0.902"
> instead. Have I got this right?

Yep. That would work. The antialiasing would be OK, even ;-)

/JÅ

Reply via email to