0
$\begingroup$

I would like to render an emoji in the label of a TimelinePlot DateObject.

E.g.

pubemoji = FromCharacterCode[{9999, 65039}] <> " "; (* space added otherwise glyph clipped *)
{pubemoji, TimelinePlot[
  Style[
   Labeled[
    DateObject[],
    pubemoji <> "<- different glyph!"
    ]
   ]
  ]}

Where I expect the emoji to render in the form returned by FromCharacterCode[{9999, 65039}].

It however renders a different glyph entirely.

enter image description here

Whereas other emoji render closer to what is returned in FromCharacterCode in the notebook frontend.

$\endgroup$
2
  • 1
    $\begingroup$ What version are you using? Might have been a fixed bug recently. $\endgroup$
    – user5601
    Commented Nov 10, 2021 at 1:47
  • $\begingroup$ Using version 12.3.1.0 (Mac OS X) x86 64 bit $\endgroup$
    – mcg256
    Commented Nov 11, 2021 at 2:07

1 Answer 1

0
$\begingroup$

In version 12.3.1 for Microsoft Windows (64-bit) (June 24, 2021), both of them are rendered correctly.

Mathematica graphics

However, when exported to PDF, both of them get rendered as black&white characters.

PDF export

I think the easiest solution is to rasterize the glyph.

pubemoji = Rasterize[Style[FromCharacterCode[{9999, 65039}], FontSize -> 20]]; 
{pubemoji, TimelinePlot[Style[Labeled[DateObject[], Row[{pubemoji, "<- same glyph"}]]]]}

Mathematica graphics

Note that this is note a quirk of the TimelinePlot, but appears to be a general problem of rendering "non-standard" glyphs.

$\endgroup$
2
  • $\begingroup$ Different result on "12.3.1 for Mac OS X ARM (64-bit) (July 8, 2021)" i.sstatic.net/eFZ5C.png $\endgroup$ Commented Nov 10, 2021 at 14:22
  • $\begingroup$ On 12.3.1 Mac OS X x86 the emoji do not render whatsoever in PDF/PNG or any graphic format i've tried. For the emoji, it looked like it was vectorized but now that i think about it likely not. I'll use your rasterize method (thank you) and likely that will help get the emoji into the output format. thanks again. $\endgroup$
    – mcg256
    Commented Nov 11, 2021 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.