Angus Leeming <[EMAIL PROTECTED]> writes:

> I'd suggest that we just leave things as they are. The "fix" is available 
> to you; you can fudge your script file.

Angus,
sorry to be a PITA, but I would like to get your attention to the fact
that a regular expression in lyxpreview2bitmap.py may be needs to be
revised.

After Paul's suggestion, I fixed the problem with dvipng, but the metrics
file turned out to be empty. I manually called dvipng and saw that its
output is as follows:

$ dvipng ... 0lyxpreview.dvi
...
[1 (preview-latex beginning-of-page-hook detected) (preview-latex tightpage \
option detected, will use its bounding box) depth=1 height=9]

So, I modified the following snippet in lyxpreview2bitmap.py:

def extract_metrics_info(dvipng_stdout, metrics_file):
    metrics = open(metrics_file, 'w')
-   metrics_re = re.compile("\[([0-9]+) depth=(-?[0-9]+) height=(-?[0-9]+)")
+   metrics_re = re.compile("\[([0-9]+).* depth=(-?[0-9]+) height=(-?[0-9]+)")

and everything was fine. However, changing the document fonts to pslatex,
the same problem (empty metrics file) showed up again. Calling manually
dvipng on the offending dvi, I got this:

$ dvipng ... 0lyxpreview.dvi
...
[1 (preview-latex beginning-of-page-hook detected)Trying to make \
PK font "psyr" (at 512 DPI)...
"makemf" --verbose "psyr"
"ttf2pk" -q -t "psyr"
Creating "psyr.512pk"...
"gsf2pk" "psyr" "StandardSymL" "" "" "usyr.pfb" "512" "psyr.512pk"
Reading TFM file "C:\texmf\fonts\tfm\adobe\symbol\psyr.tfm"...
Starting Ghostscript:
C:\texmf\miktex\bin\mgs.exe -dNODISPLAY -dNOGC -sSUBSTFONT="StandardSymL" \
-q -- "C:/texmf/dvips/gsftopk/render.ps" "StandardSymL"
"(C:/texmf/fonts/type1/urw/urwstd/usyr.pfb) brun" "" "512"
Writing Pk file "psyr.512pk"...
Trying to make PK font "ptmri8r" (at 512 DPI)...
"makemf" --verbose "ptmri8r"
"ttf2pk" -q -t "ptmri8r"
Creating "ptmri8r.512pk"...
"gsf2pk" "ptmri8r" "NimbusRomNo9L-ReguItal" "TeXBase1Encoding ReEncodeFont"
 "8r.enc" "utmri8a.pfb" "512" "ptmri8r.512pk"
Reading TFM file "C:\texmf\fonts\tfm\adobe\times\ptmri8r.tfm"...
Starting Ghostscript:
C:\texmf\miktex\bin\mgs.exe -dNODISPLAY -dNOGC
 -sSUBSTFONT="NimbusRomNo9L-ReguItal" -q -- "C:/texmf/dvips/gsftopk/render.ps"
 "NimbusRomNo9L-ReguItal" "(C:/texmf/fonts/type1/urw/urwstd/utmri8a.pfb) brun
 (C:/texmf/fonts/enc/dvips/fontname/8r.enc ) run" "TeXBase1Encoding
ReEncodeFont" "512"
Writing Pk file "ptmri8r.512pk"...
 depth=1 height=8]

That is what really goes to stdout, so IMO the RE should be changed to
account for the possible presence of newlines between "[1 " and " depth=...".
Or, the thing could be changed such that to catch separately the "[x "
and the " depth=...".

My first impression is that the dvipng generated previews are much better
than those obtained through the ghostscript route.

--
Enrico


Reply via email to