Switching fonts changes framedtext justification
Hi all, The following code produces framed text areas, each having different justification: \definefont [TextFontEmoji] [OpenSansEmoji] \definefontfamily [TextFont] [rm] [LibreBaskerville] \setupbodyfont [TextFont] \starttext \startframedtext \TextFontEmoji \input ward \stopframedtext \startframedtext \input ward \stopframedtext \stoptext How would you ensure that both text areas remain fully justified? Thank you!
On Sat, 2 Apr 2022 17:36:35 -0700
Thangalin via ntg-context
The following code produces framed text areas, each having different justification:
[…] How would you ensure that both text areas remain fully justified?
I don't have that Emoji font, but replacing it with other fonts, framedtext justifies the text here. Are you sure it's not a tolerance issue? Frames don't inherit the tolerance from the main environment¹. Try with \setupframedtext [align=verytolerant] %% [align={verytolerant, stretch}] Marco ¹ https://wiki.contextgarden.net/Command_old/setuptolerance
On 4/3/22 02:36, Thangalin via ntg-context wrote:
Hi all, [...] How would you ensure that both text areas remain fully justified?
I think (at least) LMTX has an issue with the font: \definefontfamily [TextEmoji] [rm] [OpenSansEmoji] \setupbodyfont [TextEmoji] \starttext \input knuth \stoptext I’m afraid I cannot test this with MkIV. Pablo
Confirmed there is a font issue with LMTX. $ context --version mtx-context | current version: 2022.04.01 09:37 The issue was also present with version 2021.11.30.
Are you sure it's not a tolerance issue?
Pablo's example also doesn't justify, so \framedtext is a red herring. The .otf file is from: https://github.com/MorbZ/OpenSansEmoji Thanks everyone!
Am 04.04.22 um 01:21 schrieb Thangalin via ntg-context:
Confirmed there is a font issue with LMTX.
$ context --version mtx-context | current version: 2022.04.01 09:37
The issue was also present with version 2021.11.30.
Are you sure it's not a tolerance issue?
Pablo's example also doesn't justify, so \framedtext is a red herring.
The .otf file is from:
That’s 9 years old. The linked resources were updated later and are still outdated. There must be a better Emoji font out there? Hraban
Hi again,
The .otf file is from: https://github.com/MorbZ/OpenSansEmoji
That’s 9 years old. The linked resources were updated later and are still outdated. There must be a better Emoji font out there?
You would think so. I haven't found any that are free for personal/commercial, open-source, black & white, and work with ConTeXt. Here's one list of various fonts: https://graphicdesign.stackexchange.com/a/117696/4902 The Noto Color Emoji font includes Noto B&W Emojis: https://github.com/googlefonts/noto-emoji/raw/main/fonts/NotoColorEmoji.ttf But it seems the Unicode glyphs and Latin glyphs won't appear at the same time. (Each glyph would have to be wrapped in its own font macro. Open Sans Emoji has glyphs that are a bit more print-friendly and supports both Latin and Emoji glyphs.) Thanks for taking a look.
On 4/4/22 08:40, Henning Hraban Ramm via ntg-context wrote:
Am 04.04.22 um 01:21 schrieb Thangalin via ntg-context:
[...] The .otf file is from:
That’s 9 years old. The linked resources were updated later and are still outdated. There must be a better Emoji font out there?
The font is too old, but the TTF version works just fine on both Linux and Windows. Just in case it may help, Pablo
The font is too old, but the TTF version works just fine on both Linux and Windows.
No dice with LMTX 2022.04.01 09:37 and the TTF file. Using the TTF, the emojis don't appear, but the text is justified. Using the OTF, the emojis appear, but the text is unjustified. What version of ConTeXt are you using, Pablo?
On 4/5/22 03:16, Thangalin via ntg-context wrote:
The font is too old, but the TTF version works just fine on both Linux and Windows.
No dice with LMTX 2022.04.01 09:37 and the TTF file. Using the TTF, the emojis don't appear, but the text is justified. Using the OTF, the emojis appear, but the text is unjustified.
Both things work on both Linux and Windows systems. \definefontfamily[emoj][rm][OpenSansEmoji] \setupbodyfont[emoj] \starttext \startTEXpage[offset=1em, align=center] Welcome to the future,\\human 👽! \stopTEXpage \startframedtext \input zapf \stopframedtext \stoptext
What version of ConTeXt are you using, Pablo?
Current latest from 2022.04.01 09:37. Binaries for 64bits on both OS. Just in case it may help, I recommend the following approach. 1. Remove the file OpenSansEmoji.ttf. 2. Remove the directory tex/texmf-cache/luametatex-cache. 3. Run mtxrun --generate. 4. Compile the sample above. BTW, "mtxrun --scripts cache --erase" doesn’t work for me (just in case anyone wonders). I hope it may help, Pablo
Appreciated, Pablo. The output remains unjustified: https://i.ibb.co/dM9LFWZ/future-human.png $ find /usr/share/fonts/ -name "*Emoj*" /usr/share/fonts/emoji/OpenSansEmoji.otf $ context --version mtx-context | current version: 2022.04.01 09:37 $ cat ~/bin/fontcache #!/usr/bin/env bash fc-cache -fv mtxrun --generate mtxrun --script fonts --reload $ cat ~/bin/fontgrep #!/usr/bin/env bash mtxrun --script fonts --list --all --name $1 | cut -d" " -f1 $ fontgrep emoji identifier opensansemoji opensansemojinormal opensansemojiregular Any other suggestions? Thank you!
On 4/7/22 19:50, Thangalin via ntg-context wrote:
Appreciated, Pablo.
The output remains unjustified:
https://i.ibb.co/dM9LFWZ/future-human.png
$ find /usr/share/fonts/ -name "*Emoj*" /usr/share/fonts/emoji/OpenSansEmoji.otf
Sorry, I gave you the wrong direction. The OTF version has to be removed, not the TTF version (it is the one that works). I already knew that (https://mailman.ntg.nl/pipermail/ntg-context/2022/105409.html), but I mixed (and messed) versions. Sorry, "OpenSansEmoji.otf" is the one to be removed and "OpenSansEmoji.ttf" is the one to be installed.
$ context --version mtx-context | current version: 2022.04.01 09:37
$ cat ~/bin/fontcache #!/usr/bin/env bash
fc-cache -fv mtxrun --generate mtxrun --script fonts --reload
I had problems in the past with "mtxrun --script fonts --reload --force", so I completely remove the contents from "tex/texmf-cache/luametatex-cache/" (which requires "mtxrun --generate" after). "mtxrun --script cache --erase" used to do the same, but I cannot get it working now (either on Linux or in Windows [as reported in https://mailman.ntg.nl/pipermail/ntg-context/2022/105420.html]).
Any other suggestions?
I hope it works now. Sorry for the mess, Pablo
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
Am 08.04.22 um 02:25 schrieb Thangalin via ntg-context:
Works flawlessly, thank you!
Here's a demo with left and right speech bubbles:
Thank you for the speech bubbles! This is something I need for the messenger chats in my novel. Will be a good learning experience to adapt your solution to my ideas. Hraban
I certainly can't claim credit for the speech bubbles!
https://wiki.contextgarden.net/index.php?title=Speech_bubble
https://mailman.ntg.nl/pipermail/ntg-context/2011/056496.html
I modified Wolfgang's code to provide a control for the tail, and,
thanks to Pablo, a decent font for embedding emojis.
There are a couple of problems with the speech bubbles that could use
fixing. First, the ability to have a fixed offset for the tail (e.g.,
2 em from the left and 2 em from the right). Second, when the speech
bubble is too short (e.g., a single emoji), the tail gets mangled.
Here's a screenshot showing speech bubbles using annotated Markdown:
https://github.com/DaveJarvis/keenwrite/releases
The ::: bubbletx eventually becomes a startbubbletx/stopbubbletx pair.
Greets!
On Fri, Apr 8, 2022 at 12:27 AM Henning Hraban Ramm via ntg-context
Am 08.04.22 um 02:25 schrieb Thangalin via ntg-context:
Works flawlessly, thank you!
Here's a demo with left and right speech bubbles:
Thank you for the speech bubbles! This is something I need for the messenger chats in my novel. Will be a good learning experience to adapt your solution to my ideas.
Hraban ___________________________________________________________________________________ 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 ___________________________________________________________________________________
participants (4)
-
Henning Hraban Ramm
-
Marco Patzer
-
Pablo Rodriguez
-
Thangalin