From: Thangalin via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Thangalin <thangalin@gmail.com>
Subject: Re: Switching fonts changes framedtext justification
Date: Thu, 7 Apr 2022 17:25:58 -0700 [thread overview]
Message-ID: <CAANrE7pCJrRLPC0bZFGRHB8K66_YUJx9HcgQhHLCZY5Lq8CNZw@mail.gmail.com> (raw)
In-Reply-To: <50adab01-734b-9724-ca18-30bbedaae169@gmx.es>
Works flawlessly, thank you!
Here's a demo with left and right speech bubbles:
\definefont [TextFontEmoji] [OpenSansEmoji]
\startuseMPgraphic{TextBubble}{side}
z1 = (0, 0) ;
z2 = (OverlayWidth, 0) ;
z3 = (OverlayWidth, OverlayHeight) ;
z4 = (0, OverlayHeight) ;
offset := 1 ;
tail := 1 ;
% Flip the tail's location and direction.
if \MPvar{side} = 1:
offset := 5 ;
tail := -1 ;
fi
(offset/6)[x1,x2] = x8 + .25cm * tail = x7 + .25cm = x9 - .25cm ;
y7 = 0cm ;
y8 = -.5cm ;
y9 = 0cm ;
path p ;
p = (z1--z7--z8--z9--z2--z3--z4--cycle) cornered .25cm ;
draw p withpen pencircle scaled 0.75 ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic
\defineframedtext[TextBubbleFrame][
style=TextFontEmoji,
frame=off,
width=.618\textwidth,
autowidth=force,
offset=.75em,
after={\blank[2*big]},
]
% Receive text (left-facing).
\defineoverlay[TextBubbleRxOverlay][\useMPgraphic{TextBubble}{side=0}]
\defineframedtext[TextBubbleRxFrame][TextBubbleFrame][
background=TextBubbleRxOverlay,
location=left,
]
% Send text (right-facing).
\defineoverlay[TextBubbleTxOverlay][\useMPgraphic{TextBubble}{side=1}]
\defineframedtext[TextBubbleTxFrame][TextBubbleFrame][
background=TextBubbleTxOverlay,
location=right,
]
% Map XHTML class names to start/stop environments.
\definestartstop[bubblerx][
before={\startnarrower\startTextBubbleRxFrame},
after={\stopTextBubbleRxFrame\stopnarrower},
]
\definestartstop[bubbletx][
before={\startnarrower\startTextBubbleTxFrame},
after={\stopTextBubbleTxFrame\stopnarrower},
]
\starttext
\startbubblerx
Welcome to the future, human 👽! \input zapf
\stopbubblerx
\startbubbletx
Welcome to the future, human 👽! \input zapf
\stopbubbletx
\stoptext
___________________________________________________________________________________
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-04-08 0:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-03 0:36 Thangalin via ntg-context
2022-04-03 8:30 ` Marco Patzer via ntg-context
2022-04-03 9:09 ` Pablo Rodriguez via ntg-context
2022-04-03 23:21 ` Thangalin via ntg-context
2022-04-04 6:40 ` Henning Hraban Ramm via ntg-context
2022-04-04 15:49 ` Thangalin via ntg-context
2022-04-04 15:53 ` Pablo Rodriguez via ntg-context
2022-04-05 1:16 ` Thangalin via ntg-context
2022-04-05 14:17 ` Pablo Rodriguez via ntg-context
2022-04-07 17:50 ` Thangalin via ntg-context
2022-04-07 19:41 ` Pablo Rodriguez via ntg-context
2022-04-08 0:25 ` Thangalin via ntg-context [this message]
2022-04-08 7:26 ` Henning Hraban Ramm via ntg-context
2022-04-08 19:41 ` 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=CAANrE7pCJrRLPC0bZFGRHB8K66_YUJx9HcgQhHLCZY5Lq8CNZw@mail.gmail.com \
--to=ntg-context@ntg.nl \
--cc=thangalin@gmail.com \
/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).