Git Product home page Git Product logo

Comments (6)

jfbu avatar jfbu commented on June 2, 2024 1

I applied @n-peugnet advice and this works at my locale

latex_engine = 'lualatex'
latex_theme = 'howto'

latex_elements = {
    "preamble": r"""
\directlua {
  luaotfload.add_fallback("emoji",
  {
     "[TwemojiMozilla.ttf]:mode=harf;",
     "[DejaVuSans.ttf]:mode=harf;",
  } 
  )
}
\setmainfont{LatinModernRoman}[RawFeature={fallback=emoji},SmallCapsFont={* Caps}]
\setsansfont{LatinModernSans}[RawFeature={fallback=emoji}]
\setmonofont{DejaVuSansMono}[RawFeature={fallback=emoji},Scale=0.8]
    """,
}

produces

Capture d’écran 2024-04-28 à 14 52 19

from sphinx.

jfbu avatar jfbu commented on June 2, 2024 1

I changed the type of this ticket to question because it does not seem to be related to a bug in Sphinx LaTeX support, except if one considers support for color emojis should be built-in, on which topic I don't have myself any strong opinion!

from sphinx.

LuisBL avatar LuisBL commented on June 2, 2024

Using #12195 n-peugnet solution I go it (almost) working:

Change latex_elements in conf.py:

latex_elements = {"preamble": r"""
\directlua{ luaotfload.add_fallback("emoji", {"[TwemojiMozilla.ttf]:mode=harf"}) }
\setmainfont{LatinModernRoman}[RawFeature={fallback=emoji},SmallCapsFont={* Caps}]
\setsansfont{LatinModernSans}[RawFeature={fallback=emoji}]
\setmonofont{DejaVuSansMono}[RawFeature={fallback=emoji},Scale=0.8]
""" }

content, titles and code Colors emoji in PDF !

image

But ⣿ character missing, in content, code and titles ;(

$ grep Missi _build/latex/test_emoj.log 
Missing character: There is no ⣿ (U+28FF) in font LatinModernRoman/B:mode=harf
Missing character: There is no ⣿ (U+28FF) in font LatinModernSans/B:mode=harf;
Missing character: There is no ⣿ (U+28FF) in font LatinModernRoman:mode=harf;s
Missing character: There is no ⣿ (U+28FF) in font DejaVuSansMono:mode=harf;scr
Missing character: There is no ⣿ (U+28FF) in font DejaVuSansMono:mode=harf;scr
Missing character: There is no ⣿ (U+28FF) in font DejaVuSansMono:mode=harf;scr
Missing character: There is no ⣿ (U+28FF) in font DejaVuSansMono:mode=harf;scr
$ 

How to have both hammer 🔨 and ⣿ (U+28FF) in the final PDF ?

from sphinx.

n-peugnet avatar n-peugnet commented on June 2, 2024

You can provide a chain of fallback fonts in add_fallback. I didn't test myself but check the description of the function in luaotfload's documentation.
I guess you could add some Noto symbolic font (or Symbola) to the chain.

from sphinx.

LuisBL avatar LuisBL commented on June 2, 2024

Yes working like a charm !

from sphinx.

maurerle avatar maurerle commented on June 2, 2024

As I stumbled across this issue:
For other unicode characters like greek letters, it is enough to add \usepackage{commonunicode} to the preamble in the latex_elements config in the sphinx conf.py:

latex_elements = {
    'preamble': r"""
\usepackage{commonunicode}
""",
}

from sphinx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.