# Minion Pro and breve under accent

I am having a problem with Minion Pro and breve under accent (via semtrans package or via ḫ). How can I adapt this solution by @egreg to this case?

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Minion Pro}
\usepackage{semtrans}

\begin{document}

Test \U{h}. Test ḫ.

\end{document}

• I added a better version that also keeps into account the slant. – egreg May 6 '18 at 19:26

semtrans is no good for this, because it uses \u and Minion Pro lacks the combining breve (it lacks so many things it is not really good for extensive work).

We can patch the semtrans definition to directly use the breve character (at least Minion Pro has something in it).

\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}

\setmainfont{Minion Pro}

% from semtrans
\newcommand*\U[1]{{\oalign{#1\crcr\hidewidth
\vbox to .2ex{\hbox{\char"02D8}\vss}\hidewidth}}}
\newunicodechar{ḫ}{\U{h}}

\begin{document}

Test \U{h}. Test ḫ.

\end{document}


A version that also keeps into account the slant for italics:

\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}

\setmainfont{Minion Pro}

% from semtrans, with changes
\makeatletter
\newcommand*\U[1]{{%
\oalign{%
#1\crcr
\hidewidth
\vbox to .2ex{\hbox{\kern-\f@size\fontdimen1\font\char"02D8}\vss}%
\hidewidth\crcr
}%
}}
\makeatother
\newunicodechar{ḫ}{\U{h}}

\begin{document}

Test \U{h}. Test ḫ. Test \U{m}.

\itshape

Test \U{h}. Test ḫ. Test \U{m}.

\LARGE

Test \U{h}. Test ḫ. Test \U{m}.

\end{document}


• The tick stealer strikes again. Just before I wanted to post mine. :-) +1 – Henri Menke May 6 '18 at 9:18
• @egreg What typeface do you prefer which is both aesthetic and suitable for extensive work. (Except, perhaps, libertine.) – blackened May 6 '18 at 9:19
• @blackened It's not just a question of preferences; it also depends on what features you require from your font. – egreg May 6 '18 at 9:20
• Since anyone transliterating stray Semitic words in an English context is likely to set them in italics, how would one define, say, a \UI command which would put the breve in the right spot for italics? – Thérèse May 6 '18 at 17:45
• @Thérèse Done, without \UI. :-) – egreg May 6 '18 at 19:25

It never ceases to amaze me how powerful LuaTeX's callback mechanism is. Here I hook into pre_linebreak_filter. When I encounter an h with breve in the node list, I replace it by an ordinary h and inject a negative kern and a lowered breve character after it.

On the TeX level this is now completely transparent, no catcode changes required.

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Minion Pro}

\usepackage{luacode}
\begin{luacode*}

local function hbreve(head)
if n.id == node.id("glyph") then
if n.char == 0x1e2b then
n.char = 0x68
local f = n.font
local slant = font.fonts[f].parameters.slant
local size = font.fonts[f].size / 2^16

local breve = node.new("glyph")
breve.font = f
breve.lang = tex.language
breve.char = 0x02D8
breve.width = n.width

local hbox = node.hpack(breve)
hbox.shift = n.height

local kern = node.new("kern")
kern.kern = -(n.width+breve.width+slant*size)/2

local kern = node.new("kern")
kern.kern = (n.width-breve.width+slant*size)/2
end
end
end
end


\begin{document}

• @HenriMenke The slant parameter is “slant per point” with unit points. As you see from my addition, I multiply it by the current fontsize using \f@size. – egreg May 6 '18 at 21:38