mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 19:14:51 +00:00
Allow previewing images generated through postscript specials which are
not correctly handled by dvipng. When a ps special is detected in the dvi file, the old good legacy method is used. Patch from Ale. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36685 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
69b228f9af
commit
32ea5966c5
@ -222,8 +222,25 @@ def main(argv):
|
||||
# FIXME: skip unnecessary dvips trial in legacy_conversion_step2
|
||||
return legacy_conversion_step2(latex_file, dpi, output_format)
|
||||
|
||||
# Run the dvi file through dvipng.
|
||||
# The dvi output file name
|
||||
dvi_file = latex_file_re.sub(".dvi", latex_file)
|
||||
|
||||
# Check for PostScript specials in the dvi, badly supported by dvipng
|
||||
# This is required for correct rendering of PSTricks and TikZ
|
||||
dv2dt = find_exe_or_terminate(["dv2dt"], path)
|
||||
dv2dt_call = '%s %s' % (dv2dt, dvi_file)
|
||||
|
||||
# The output from dv2dt goes to stdout
|
||||
dv2dt_status, dv2dt_output = run_command(dv2dt_call)
|
||||
psliteral_re = re.compile("^special[1-4] [0-9]+ '(\"|ps:)")
|
||||
for dtl_line in dv2dt_output.split("\n"):
|
||||
if psliteral_re.match(dtl_line) != None:
|
||||
# Literal PostScript special detected!
|
||||
# Fallback to legacy conversion
|
||||
vec = [argv[0], argv[2], argv[3], argv[1], argv[4], argv[5], latex]
|
||||
return legacy_conversion(vec)
|
||||
|
||||
# Run the dvi file through dvipng.
|
||||
dvipng_call = '%s -Ttight -depth -height -D %d -fg "%s" -bg "%s" "%s"' \
|
||||
% (dvipng, dpi, fg_color, bg_color, dvi_file)
|
||||
|
||||
|
@ -207,8 +207,25 @@ def main(argv):
|
||||
# FIXME: skip unnecessary dvips trial in legacy_conversion_step2
|
||||
return legacy_conversion_step2(latex_file, dpi, output_format)
|
||||
|
||||
# Run the dvi file through dvipng.
|
||||
# The dvi output file name
|
||||
dvi_file = latex_file_re.sub(".dvi", latex_file)
|
||||
|
||||
# Check for PostScript specials in the dvi, badly supported by dvipng
|
||||
# This is required for correct rendering of PSTricks and TikZ
|
||||
dv2dt = find_exe_or_terminate(["dv2dt"], path)
|
||||
dv2dt_call = '%s %s' % (dv2dt, dvi_file)
|
||||
|
||||
# The output from dv2dt goes to stdout
|
||||
dv2dt_status, dv2dt_output = run_command(dv2dt_call)
|
||||
psliteral_re = re.compile("^special[1-4] [0-9]+ '(\"|ps:)")
|
||||
for dtl_line in dv2dt_output.split("\n"):
|
||||
if psliteral_re.match(dtl_line) != None:
|
||||
# Literal PostScript special detected!
|
||||
# Fallback to legacy conversion
|
||||
vec = [argv[0], argv[2], argv[3], argv[1], argv[4], argv[5], latex]
|
||||
return legacy_conversion(vec)
|
||||
|
||||
# Run the dvi file through dvipng.
|
||||
dvipng_call = '%s -Ttight -depth -height -D %d -fg "%s" -bg "%s" "%s"' \
|
||||
% (dvipng, dpi, fg_color, bg_color, dvi_file)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user