Browse Source

Fall back on the DVIBackend if anything breaks, @eval in TikzPictures instead of Main

pull/63/head
Mirko Bunse 6 months ago
parent
commit
a2b192304b
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      src/svg.jl

+ 8
- 3
src/svg.jl View File

@ -23,7 +23,12 @@ function __init__svg()
if Sys.which("pdf2svg") != nothing
svgBackend(PdfToSvgBackend())
else
svgBackend(PopplerBackend())
try
svgBackend(PopplerBackend())
catch cause
@warn "Failed to load PopplerBackend; falling back on DVIBackend" cause
svgBackend(DVIBackend())
end
end
# define a new implementation for PopplerBackend, but only after `import Poppler_jll`
@ -55,11 +60,11 @@ end
_initialize(backend::SVGBackend) = nothing # default
_initialize(backend::PopplerBackend) =
if !Requires.isprecompiling()
@eval Main begin
@eval TikzPictures begin
try
import Poppler_jll # will trigger @require in __init__svg
catch
error("Unable to initialize $backend") # should not happen as long as Poppler_jll is a dependency
error("Unable to import Poppler_jll") # should not happen as long as Poppler_jll is a dependency
end
end
end


Loading…
Cancel
Save