ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] SVG ViewBox figure battle
@ 2023-05-20  0:49 Thangalin via ntg-context
  2023-05-20 20:39 ` Thangalin via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Thangalin via ntg-context @ 2023-05-20  0:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thangalin

Hi there!

The following document contains SVG. Save the SVG as "problem.svg" and
run the document through LMTX version 2023.05.08 17:39:

% SOF
\startbuffer[csvg]
<svg viewBox="0 0 100 100" version="1.1">
  <path d="M0 0h100v100H0z" />
  <path fill="#2d514e" d="M 72.474,42.6 33.073,42.8 51.872,-26.7 Z" />
</svg>
\stopbuffer

\starttext
  % honours viewbox
  \placefigure[none]{}{\includesvgbuffer[csvg]}
  \page
  % dishonours viewbox
  \externalfigure[problem.svg]
\stoptext
% EOF

The ViewBox is ignored when run through Inkscape. Is this because the
--export-area-page option is not being passed when invoked?

Given identical inputs, would it make sense for placefigure and
externalfigure to produce identical results?

Cheers!
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [NTG-context] SVG ViewBox figure battle
  2023-05-20  0:49 [NTG-context] SVG ViewBox figure battle Thangalin via ntg-context
@ 2023-05-20 20:39 ` Thangalin via ntg-context
  2023-05-20 23:26   ` Max Chernoff via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Thangalin via ntg-context @ 2023-05-20 20:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Thangalin

Hi again,

I changed tex/texmf-context/tex/context/base/mkiv/grph-con.lua to
replace "" with "--export-area-page" in the inkscapecrop function:

    local function inkscapecrop(specification)
        return (specification and specification.crop == v_yes) and
"--export-area-drawing" or "--export-area-page"
    end

This produces the desired results.

Any ideas on how to force that setting without modifying grph-con.lua?

Thank you!
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [NTG-context] SVG ViewBox figure battle
  2023-05-20 20:39 ` Thangalin via ntg-context
@ 2023-05-20 23:26   ` Max Chernoff via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Max Chernoff via ntg-context @ 2023-05-20 23:26 UTC (permalink / raw)
  To: ntg-context; +Cc: Max Chernoff

Hi,
> Any ideas on how to force that setting without modifying grph-con.lua?

This seems to work:

   \startluacode
   function figures.converters.svg.pdf(oldname, newname)
       figures.programs.inkscape.runner {
           format     = "filename",
           resolution = "600",
           crop       = "--export-area-page",
           newname    = dir.expandname(newname),
           oldname    = dir.expandname(oldname),
       }
   end
   \stopluacode
   
I mostly just copied that from grph-con.lua, but the CLD manual has a
few more details:

   https://www.pragma-ade.com/general/manuals/cld-mkiv.pdf#%5B%7B%22num%22%3A89%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22Fit%22%7D%5D

-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-20 23:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-20  0:49 [NTG-context] SVG ViewBox figure battle Thangalin via ntg-context
2023-05-20 20:39 ` Thangalin via ntg-context
2023-05-20 23:26   ` Max Chernoff via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).