2

I would like to add the (Matrix) "red pill" glyph into text that I am writing. To make it even more difficult and painful, my document originates in pandoc and becomes beamer, powerpoint, and slidy.

Usually, for a red pill in latex, I would just create a tiny png file that contains a pill image, bind it to a macro, use it repeatedly, and call it a day. Unfortunately, powerpoint does not seem to support inline graphics (only display graphics; can you believe that???), so I need to use a pill glyph.

My confusion starts pretty early now. My macos terminal (and textedit) display the same looking unicode pill no matter what font I select in my terminal. It is pulling a pill (which I don't like much either because of its dual color on macos, but at least it looks like a pill!) from somewhere---beats me from where. I am scrounging around the fontbook app to see if I can find some place for the emoji unicodes like the pill, but they don't seem to be there.

OK, but these are not latex questions. When I try to run the resulting beamer source through lualatex, the log informs me

Missing character: There is no 💊 (U+1F48A) in font Andika:mode=node;script=latn;language=dflt;+tlig;!

Missing character: There is no 💊 (U+1F48A) in font Ubuntu:mode=node;script=l

Ergo,

  • either I need to learn how to instruct beamer to switch briefly to a font that does contain a pill glyph when it sees an U+1F48A request, but I have no clue even how to interrogate my installed fonts which ones of them contain the U+1F48A glyph;

  • or, better, I need to learn how to take the Ubuntu font, insert a glyph that looks like pill surreptitiously, and save it.

(If I could learn how to do the latter, I presume I could use the font in all output formats, including powerpoint and wouldn't have to rely on the macos-type U+1F48A looking double-color pill, though I am not sure how this would look on other operating systems.)

Is it easy or hard to take the ubuntu font and add a pill shape into a slot (ideally, the right slot of U+1F48A) where I can ask LuaLaTeX to use it, too? Are there programs with tutorials that make this easy? I don't need high-quality; just a basic pill.

red pill, blue bill

Advice greatly appreciated.

1
  • 2
    For what purpose you want to use it? This is not a solution, but I found two font-awesome icons which might be useful. They are respectively fa-pills and fa-tablets. These can be called by the fontawesome5 package with \faIcon{pills} and \faIcon{tablets} or their aliases \faPills and \faTablets.
    – Niranjan
    Dec 18, 2021 at 6:40

1 Answer 1

4

With a current texsystem you can use albatross to query fonts. Call on a terminal

  albatross U+1F48A

It should give a list of fonts. On my system (windows) it found the followings for your glyph. Some of them can be colored, the technical details can differ here: some need the harfbuzz renderer, others can be colored with lua code. But I have no idea how pandoc and powerpoint handle such fonts.

Extending a font to add a glyph is neither trivial nor it is clear if the license allows it.

\documentclass{article}
\usepackage{fontspec}

\directlua{fonts.handlers.otf.registerpalette("demo", {
        { g = 0  },
        { g = 0  },
        { r = 0  },
        { r = 0, b= 1, g= 1},
    }
    )}

\begin{document}
{\fontspec{Segoe UI Symbol} ^^^^^^01f48a}

{\fontspec{Segoe UI Emoji}^^^^^^01f48a}

{\fontspec{file:seguiemj.ttf:mode=node;colr=yes;}^^^^^^01f48a}

{\fontspec{file:seguiemj.ttf:mode=node;colr=demo;}^^^^^^01f48a}

{\fontspec{EmojiOne Color}^^^^^^01f48a}
                                        
{\fontspec{Noto Color Emoji}[Renderer=Harfbuzz]^^^^^^01f48a}

{\fontspec{Noto Emoji}^^^^^^01f48a}
 
{\fontspec{Twemoji Mozilla}[Renderer=Harfbuzz]^^^^^^01f48a}

\end{document}

enter image description here

5
  • terrific answer --- as usual! thanks, U. one minor problem --- albatross complains that it requires a java runtime.
    – ivo Welch
    Dec 18, 2021 at 16:14
  • could you please add how I coax, say, {\fontspec{EmojiOne Color}^^^^^^01f48a} to be substituted into another font (say, Andika) in lualatex? Is tex.stackexchange.com/questions/415171/… the right way?
    – ivo Welch
    Dec 18, 2021 at 16:24
  • you can declare a fallback, see tex.stackexchange.com/a/572220/2388, but I have some doubts that this will survive a pandoc conversion. Dec 18, 2021 at 16:29
  • So there will be Matrix 8, when we have 8 pills, asking for one. ;-) Dec 18, 2021 at 17:18
  • doesn't need to survive pandoc conversion...the glyph shows up in the other output formats.
    – ivo Welch
    Dec 20, 2021 at 16:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .