-
-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
properly handle SVGs generated by SVGMath #468
Comments
(continuing discussion from #220) Looking at a list of elements described in SVG 1.1 spec vs. what nanosvg supports, there seem indeed to be some seemingly non-stupid missing entries (apart from numerous text-related ones), e.g.: clipPath, marker, mask, symbol & use, ... |
I don't think nanosvg is going to serve SILE very well. As mentioned in #446 the support is just too rudimentary for even fairly basic use cases importing a figure. |
Ok, got some code which does the parsing of svgmath-generated SVGs in pure Lua, and managed to get prototype rendering done in ZeroBrane Studio with love2d: (compare with third-party rendering of the SVG at: https://github.com/akavel/svgmath/blob/master/testdata/test13.out.svg) Not all elements supported yet, but matrices, glyphs and simple lines seem to work ok now. So, now mostly waiting till someone provides me with a Windows binary of SILE so that I can try:
Though I may have somewhat less time for that over the next 2 weeks. |
Very interesting! I think long term we are going to want to render SVG to PDF drawing operators ourselves, or use a better library which does that, to keep things in vector format. Doing it ourselves means we can keep the text pipeline going through SILE and leverage the existing fonts/rendering support. |
When rendering an equation, how can I output some unicode glyph g at some position dx, dy relative to "current cursor" in the PDF from Lua? I understand that
etc. is expected to let me draw curves, but I also need to render some glyphs. I tried using \begin{document}
Sample inital text
\begin{script}
local pdf = require 'justenoughlibtexpdf'
local buf = 'A'
local font = SILE.font.cache(SILE.font.loadDefaults{}, SILE.shaper.getFace)
local f = pdf.loadfont(font)
if f< 0 then SU.error("Font loading error for "..options) end
font = f
pdf.setstring(100, 100, buf, string.len(buf), font, 0)
\end{script}
Sample final text
\end{document} but got some assertion fail in
Not sure what else I can try... |
Ok, got some kind of even more slightly misaligned result by virtue of some unholy abomination of code - but hey, it worked! :D 😄 😂 will need a hell of a cleanup :) and integration work, obviously, for now it's just a one-off prototype of the final element of the pipeline. I cannot upload the code yet as I'm in travel, but here's a teaser screenshot: |
Ok, to reduce the bus factor a bit, the code of the prototype is now at: https://github.com/akavel/silemath/blob/master/sample.sil.
|
Ok, given that I have this sub-problem resolved in principle now, I'm closing this sub-issue and will get back to reporting/discussing in the main #220 issue. |
For #220, it would be nice if SVGs generated by SVGMath rendered correctly in SILE.
Sample such SVG, which didn't work for me: https://github.com/akavel/svgmath/blob/master/testdata/test13.out.svg
I tried a doc like below, with current codebase (7f677a1):
Initially,
foo.tmp
contained0 0 [...]
, but after looking into nanosvg.h I noticed it doesn't accept XML namespaces. Aftersed -i 's/svg://g' test13.svg
there was some more interesting stuff infoo.tmp
, but still no image in the generated PDF.Is it because the SVG seems to use mostly
<svg:text>
elements? Maybe nanosvg ignores them?The text was updated successfully, but these errors were encountered: