From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>,
"Kevin W. Rudd" <ke6fzi@gmail.com>,
"Rudd, Kevin" <kevin@lps.umd.edu>
Subject: Re: Outlined text (from MP) inline in ConText has incorrect baseline (i.e. no depth)
Date: Fri, 8 Oct 2021 13:36:38 +0200 [thread overview]
Message-ID: <ccff30a9-5c27-2036-8e50-136fb41b80d0@xs4all.nl> (raw)
In-Reply-To: <DB6C6D20-8FD0-4063-91C9-4CAFE07050CE@lps.umd.edu>
On 10/7/2021 4:14 PM, Rudd, Kevin via ntg-context wrote:
> Hey---
>
> I'm trying to insert outlined text (derived from MetaFun example code)
> into a document and it seems to work up to the point that the text has
> depth (descenders). There's a previous post that mentions using
> textcommand for titles to ensure that the appropriate baseline is used
> but I haven't figured out why that would work; for my purposes, I'm
> insert the text inline so that solution wouldn't work here. I have
> included a MWE that demonstrates the problem; I've tried putting both
> the text and the outlined text in a box, then adjusting the outlined
> text by the depth of the text itself but that doesn't seem to work. I
> expect that there's an easy way either in MP or ConTeXt, but I haven't
> found it yet.
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> % \OutlinedText[glyph][outline]{text}
> \def\OutlinedText{\dodoubleempty\doOutlinedText}
>
> \def\doOutlinedText[#1][#2]#3%
> {%
> % ((((\type{#1}::\type{#2}::\type{#3}))))
> \ifsecondargument
> \makeOutlinedText{#1}{#2}{#3}%
> \else\iffirstargument
> \makeOutlinedText{#1}{black}{#3}%
> \else
> \makeOutlinedText{white}{black}{#3}%
> \fi\fi
> }
>
> \def\makeOutlinedText#1#2#3%
> {%
> \startMPcode
> draw outlinetext.b("#3")
> (withcolor "#1")
> (withcolor "#2" withpen pencircle scaled 1/16);
> \stopMPcode
> \autoinsertnextspace
> }
>
> \starttext
> start
> \OutlinedText{aaa}
> and \OutlinedText{Bbb}
> and \OutlinedText{ggg}
> and \OutlinedText{Yyy}
> finish
> \stoptext
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
> (Here is the code with my attemps to shift the baseline; the \dp & \wd
> approach seems to do nothing, and the \lower doesn't compile and I
> haven't pursued why yet.)
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> % \def\makeOutlinedText#1#2#3%
> % {%
> % \newbox\tBox
> % \newbox\uBox
> % \setbox\tBox\hbox{#3}
> % \setbox\uBox
> % \hbox{%
> % \startMPcode
> % draw outlinetext.b("#3")
> % (withcolor "#1")
> % (withcolor "#2" withpen pencircle scaled 1/16);
> % \stopMPcode
> % }%
> % % \lower\uBox\dp\tBox
> % \ht\uBox=\ht\tBox
> % \dp\uBox=\dp\tBox
> % \unbox\uBox
> % \autoinsertnextspace
> }
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
> Any feedback or suggestions would be appreciated.
\defineeffect[MyEffect][alternative=outer,rulethickness=.1pt]
\starttext
start
{\effect[MyEffect]{aaa}} \OutlinedText{aaa}
and {\red \effect[MyEffect]{Bbb}} \OutlinedText{Bbb}
and {\green\effect[MyEffect]{ggg}} \OutlinedText{ggg}
and {\blue \effect[MyEffect]{Yyy}} \OutlinedText{Yyy}
finish
\stoptext
>
> Kevin W. Rudd, Ph.D.
> CAPT, USN (Ret)
>
> Computer Architecture & Computer Engineering
> Advanced Computing Systems (ACS) Research Program
> Laboratory for Physical Sciences (LPS)
>
> 443-654-7878
> kevin@lps.umd.edu <mailto:kevin@lps.umd.edu>
>
> Visiting Research Professor
> United States Naval Academy
>
> rudd@usna.edu <mailto:rudd@usna.edu>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
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:[~2021-10-08 11:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 14:14 Rudd, Kevin via ntg-context
2021-10-08 11:36 ` Hans Hagen via ntg-context [this message]
2021-10-08 15:26 ` Rudd, Kevin via ntg-context
2021-10-12 16:26 ` Rudd, Kevin 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=ccff30a9-5c27-2036-8e50-136fb41b80d0@xs4all.nl \
--to=ntg-context@ntg.nl \
--cc=j.hagen@xs4all.nl \
--cc=ke6fzi@gmail.com \
--cc=kevin@lps.umd.edu \
/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).