From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: Aditya Mahajan via ntg-context <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: SVG text alignment issue
Date: Wed, 29 Jun 2022 09:03:03 +0200 [thread overview]
Message-ID: <a31aa8e3-29ff-db12-7732-bead2b4e9425@xs4all.nl> (raw)
In-Reply-To: <nycvar.YAK.7.78.908.2206282219360.10974@nqv-guvaxcnq>
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" />
>> <text
>> x="-48.831322"
>> y="15.60547"
>> id="text4933-8-6"
>> transform="rotate(-90)"
>>
>> 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"><tspan
>> id="tspan159594-1"
>> x="-48.831322"
>> y="15.60547"
>>
>> 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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2022-06-29 7:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 6:07 Thangalin via ntg-context
2022-06-29 2:35 ` Aditya Mahajan via ntg-context
2022-06-29 4:55 ` Thangalin via ntg-context
2022-06-29 7:03 ` Hans Hagen via ntg-context [this message]
2022-06-29 18:48 ` Thangalin via ntg-context
2022-06-29 21:23 ` Hans Hagen via ntg-context
2022-06-30 2:49 ` Thangalin via ntg-context
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a31aa8e3-29ff-db12-7732-bead2b4e9425@xs4all.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).