LuaTeX + Roboto + \= : working with A but not with B, nor C

The Roboto fonts miss the U+0304 COMBINING MACRON character, and indeed you get the dreaded message

Missing character: There is no ̄ (U+0304) in font [Roboto-Regular.ttf]

You can fix this by declaring that the combinations with \= are dealt with in the traditional way, via \accent.

\documentclass{article}
\usepackage{fontspec}

\makeatletter
\DeclareUnicodeEncoding{roboto}{%
  \input{tuenc.def}%
  \DeclareTextAccent{\=}{roboto}{"00AF}%
}
\makeatother

\setmainfont{Roboto}[
  Extension      = .ttf,
  NFSSEncoding   = roboto,
  UprightFont    = *-Regular,
  ItalicFont     = *-RegularItalic,
  BoldFont       = *-Bold,
  BoldItalicFont = *-BoldItalic,
]

\begin{document}
    \={A}
    \={B}
    \={C}
\end{document}

I don't see an easy way to use the package, because it doesn't allow for adding the NFSSEncoding option to the font choices.

enter image description here


The following workaround (inspired from: https://tex.stackexchange.com/a/233378/112503) seems to work:

\documentclass[12pt]{article}

\usepackage{fontspec}

\setmainfont{Roboto}[%
    Extension = .ttf ,
    Path = C:/path-to-font-file/ ,
    UprightFont = {Roboto-Regular},
]

\begin{document}
\=A (\accent"02C9 A)

\accent"02C9 B

\accent"02C9 C
\end{document}

enter image description here

Tags:

Luatex

Accents