On 6/29/2022 4:35 AM, Aditya Mahajan via ntg-context wrote:
On Mon, 27 Jun 2022, Thangalin via ntg-context wrote:
In the following example, the line and text should be aligned to the middle when LMTX converts the SVG figure using MP. (Note that you may have to install Roboto, but the font isn't the issue.)
% SOF \startbuffer[svg] <svg width="25mm" height="70mm" viewBox="0 0 25 70" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <path d="m 12.500001,63.971412 v -12.4787" id="path2" style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1" />
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;font-family:Roboto;-inkscape-font-specification:'Roboto, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal">
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12px;font-family:Roboto;-inkscape-font-specification:'Roboto, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal">16p13.3</tspan></text> </svg> \stopbuffer
\starttext \placefigure[]{}{\includesvgbuffer[svg][conversion=mp]} \stoptext % EOF
This has nothing to do with SVG. Looking at the definition of \includesvgbuffer, here is a simpler example illustrating the issue:
\starttext \startplacefigure[location=here, title={Test}] \dontleavehmode\begingroup \startMPcode draw fullcircle scaled 2cm; \stopMPcode\endgroup \stopplacefigure \stoptext
One way to "fix" the alignment is to wrap everything in an hbox:
\placefigure[]{}{\hbox{\includesvgbuffer[svg][conversion=mp]}}
Maybe there is a simple way to modify the definition of includesvgbuffer so that an \hbox is not needed. Thanks for checking it. Can you test with
\pushoverloadmode \unprotect \permanent\tolerant\protected\def\includesvgfile[#1]#*[#2]% {\hbox\bgroup % no \dontleavehmode \getdummyparameters[\c!offset=\zeropoint,#2]% \clf_includesvgfile{#1}\dimexpr\dummyparameter\c!offset\relax \egroup} \permanent\tolerant\protected\def\includesvgbuffer[#1]#*[#2]% {\hbox\bgroup % no \dontleavehmode \getdummyparameters[\c!offset=\zeropoint,#2]% \clf_includesvgbuffer{#1}\dimexpr\dummyparameter\c!offset\relax \egroup} \protect \popoverloadmode Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------