Skip to content

Commit

Permalink
[38_7] SVG: prefer the scm converter
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii committed Feb 23, 2024
1 parent e8b8f3d commit 235053c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
16 changes: 1 addition & 15 deletions TeXmacs/progs/texmacs/menus/preferences-widgets.scm
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,6 @@
(eval `(define-preference-names "texmacs->image:format" ,@valid-image-format-list))
(cadr (apply map list valid-image-format-list))))

(define (supports-inkscape?) (url-exists-in-path? "inkscape"))

(tm-widget (image-preferences-widget)
======
(bold (text "TeXmacs -> Image"))
Expand All @@ -600,19 +598,7 @@
(enum (set-pretty-preference "texmacs->image:format" answer)
(pretty-format-list)
(get-pretty-preference "texmacs->image:format")
"8em")))
====== ======
(bold (text "Image -> TeXmacs"))
===
(aligned
(meti
(when (supports-inkscape?)
(hlist // (text "Use Inkscape for conversion from SVG")))
(when (supports-inkscape?)
(toggle (set-boolean-preference
"image->texmacs:svg-prefer-inkscape" answer)
(get-boolean-preference
"image->texmacs:svg-prefer-inkscape"))))))
"8em"))))

;; All converters ----------

Expand Down
14 changes: 11 additions & 3 deletions TeXmacs/tests/tm/38_7.tm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<style|<tuple|generic|no-page-numbers|chinese>>

<\body>
small svg:

<image|../../misc/images/new-mogan.svg|100pt|||>

big svg:

<image|../../misc/images/new-mogan.svg|213pt|213pt||>

<section|rsvg-convert Binary Plugin >
Expand Down Expand Up @@ -62,9 +68,7 @@
<\references>
<\collection>
<associate|auto-1|<tuple|1|1>>
<associate|auto-2|<tuple|2|?>>
<associate|part:|<tuple|?|?>>
<associate|part:../../misc/images/new-mogan.svg|<tuple|?|?>>
<associate|auto-2|<tuple|2|1>>
</collection>
</references>

Expand All @@ -74,6 +78,10 @@
<vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|1<space|2spc>rsvg-convert
Binary Plugin > <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-1><vspace|0.5fn>

<vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|2<space|2spc>inkscape
Binary Plugin> <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-2><vspace|0.5fn>
</associate>
</collection>
</auxiliary>
4 changes: 1 addition & 3 deletions src/System/Files/image_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,7 @@ image_to_pdf (url image, url pdf, int w_pt, int h_pt, int dpi) {
if (DEBUG_CONVERT) debug_convert << "image_to_pdf ... ";
string s= suffix (image);
// First try to preserve "vectorialness"
if ((s == "svg") && !wrap_qt_supports (image) &&
call_scm_converter (image, pdf))
return;
if ((s == "svg") && call_scm_converter (image, pdf)) return;
#ifdef USE_PLUGIN_GS
if (gs_supports (image)) {
if (DEBUG_CONVERT) debug_convert << " using gs " << LF;
Expand Down

0 comments on commit 235053c

Please sign in to comment.