[Tex/LaTex] Using the Google Noto fonts with fontspec

fontspecxetex

I've been typing a multilingual document that uses Latin, Cyrillic and Georgian characters, and I'm utterly stumped as to how to get fontspec to select the right fonts.

If I use the MWE below, it kind of works, but the comma and full stop in the Georgian text show up as boxes because Noto Serif Georgian doesn't include those characters (presumably it's meant to link to Noto Serif). Ideally I'd get fontspec to automatically select the sub-font based on what characters are being rendered, so I wouldn't need to specifically create a \georgianfont command.

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Noto Serif}
\newfontfamily\georgianfont{Noto Serif Georgian}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{georgian}

\begin{document}

{\georgianfont გუშინ ორი საათი ვწერე ერ სტატია, მაგრამ ვერ დავწერე ბოლომდე.}

For two hours yesterday I wrote this article, but I could not complete it.

В течение двух часов я вчера написал этот документ, но не смог завершить его.

\end{document}

EDIT I tried using the ucharclasses package as recommended below, and the updated MWE doesn't work at all:

\documentclass{article}
\usepackage{fontspec}
\usepackage[Latin, Georgian, Cyrillic]{ucharclasses}
\setmainfont[Ligatures=TeX]{Noto Serif}
\setDefaultTransitions{\fontspec{Noto Serif}}{}
\setTransitionTo{Georgian}{\fontspec{Noto Serif Georgian}}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{georgian}

\begin{document}

გუშინ ორი საათი ვწერე ერ სტატია, მაგრამ ვერ დავწერე ბოლომდე.

For two hours yesterday I wrote this article, but I could not complete it.

В течение двух часов я вчера написал этот документ, но не смог завершить его.


\end{document}

latexmk hangs my computer for at least 15 mins before crashing, and xelatex seems to be the cause of the issue, but I don't know what it's trying to do. The output gets this far, and then sits there for many minutes until eventually my entire computer locks up:

$ xelatex georgian.tex
This is XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015/Arch Linux) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./georgian.tex
LaTeX2e <2015/10/01> patch level 2
Babel <3.9m> and hyphenation patterns for 79 languages loaded.
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texmf-dist/tex/latex/l3kernel/l3unicode-data.def)
(/usr/share/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def))
(/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec-patches.sty)
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/share/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texmf-dist/tex/latex/euenc/eu1enc.def)
(/usr/share/texmf-dist/tex/latex/euenc/eu1lmr.fd))
(/usr/share/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/share/texmf-dist/tex/latex/tipa/t3enc.def
(/usr/share/texmf-dist/tex/latex/euenc/eu1lmss.fd))
(/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texmf-dist/tex/xelatex/xetex-def/xetex.def
(/usr/share/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))))
(/usr/share/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(/usr/share/texmf-dist/tex/xelatex/ucharclasses/ucharclasses.sty
(/usr/share/texmf-dist/tex/generic/ifxetex/ifxetex.sty)) (./georgian.aux)
(/usr/share/texmf-dist/tex/latex/tipa/t3cmr.fd)

I usually resort to ^C if it hasn't done anything after five minutes.

Best Answer

I don't know anything about the internals of ucharclasses, but there's some suspicious usage of the \fontspec{} command in the manual — generally that command isn't recommended for changing fonts regularly.

Whether this used to work but something changed in fontspec is unclear, but you should be using \newfontfamily instead as shown here: (different fonts but same idea)

\documentclass{article}
\usepackage{fontspec}
\usepackage[Latin,Georgian,Cyrillic]{ucharclasses}
\setmainfont[Ligatures=TeX]{Palatino}

%%%%
\newfontfamily\pala{Palatino}
\newfontfamily\helv{Helvetica}
\setDefaultTransitions{\pala}{}
\setTransitionTo{Georgian}{\helv}
%%%%

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{georgian}
\begin{document}
გუშინ ორი საათი ვწერე ერ სტატია, მაგრამ ვერ დავწერე ბოლომდე.

For two hours yesterday I wrote this article, but I could not complete it.

В течение двух часов я вчера написал этот документ, но не смог завершить его.
\end{document}
Related Question