8

I want to use the 'bar' accent (\={<letter>}) on capital letters in my document that is typesetted with roboto. If I compile the document using LaTeX, it works perfectly. But if I compile it using LuaLaTeX, \={A} is working great, but neither \={B} nor \={C}:

enter image description here enter image description here

Questions: Why? How to use the 'bar'-accent with roboto and LuaLaTeX?

Note: I've not encounter such problem with other fonts.


MWE

\documentclass{article}
    \usepackage[sfdefault]{roboto}
    \usepackage{ifluatex}
        \ifluatex
            \newcommand{\engine}{LuaTeX}
        \else
            \newcommand{\engine}{TeX}
        \fi
\begin{document}
    \engine: 
    \={A}
    \={B}
    \={C}
\end{document}
4
  • 1
    Missing character: There is no ̄ (U+0304) in font [Roboto-Regular.ttf]
    – egreg
    Sep 18, 2017 at 12:01
  • 1
    Roboto doesn't have the accent needed to build the B and C with a macron: in the log-file you get Missing character: There is no ̄ (U+0304) in font [Roboto-Regular.ttf]. (A with macron is a real glyph, U+100). Sep 18, 2017 at 12:01
  • 2
    As I wrote: A with macron is a real glyph with a unicode position and it is in the font. But B with macron must be build and while the one component (the B) is in the font, the other (the accent) is missing. Sep 18, 2017 at 12:18
  • @UlrikeFischer I misunderstood your first comment, my bad.
    – ebosi
    Sep 18, 2017 at 13:24

2 Answers 2

9

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

6

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

You must log in to answer this question.

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