In LuaLaTeX, you can use the features of babel
to automatically change fonts to match the script you’re typing in. In this example, the serif font is Libertinus Serif for Latin and Gentium Plus for Greek. The sans-serif letters are in Libertinus Sans (a clone of Linux Biolinum), but have the OpenType script and language feature set to Latin/English or Greek/Greek automatically. This also selects Greek or English hyphenation patterns.
\documentclass[english]{article}
\usepackage{babel}
\usepackage{unicode-math}
\usepackage{microtype}
\usepackage{uninormalize}
\babelprovide[import=el-polyton, onchar=ids fonts]{greek}
\defaultfontfeatures{ Ligatures=TeX,
Scale=MatchLowercase }
\babelfont{rm}
[Ligatures={Common,Rare}, Scale=1.0]{Libertinus Serif}
\babelfont[greek]{rm}
{Gentium Plus}
\babelfont{sf}
[Ligatures={Common,Rare}]{Libertinus Sans}
\babelfont{tt}
{Libertinus Mono}
\setmathfont{Libertinus Math}
\begin{document}
uῶ \textsf{uῶ}
\end{document}

I selected a matching OpenType math font, uninormalize
to prevent a bug that could strand naked accents at the start of a new line, and microtype
to enable font expansion.
You will get some harmless warning messages about English and Polytonic Greek font features not being available in those fonts. This just means that these fonts do not define any special OpenType features for the Greek language over and above those it defines for the Greek script. You can suppress the warnings by adding the Language=Default
option when you load the font, the same way you enable Ligatures=
. This is also where you should select Variant=78
(the sugared name for cv78
).
In XeLaTeX, you would want to use ucharclasses
for this, and have it change the current language rather than select a particular font. This way, it works for serif, sans-serif and monospace, and correctly hyphenates Greek words.
\documentclass[english]{article}
\usepackage{babel}
\usepackage{unicode-math}
\usepackage{ucharclasses}
\babelprovide[import=el-polyton]{greek}
\defaultfontfeatures{ Ligatures=TeX,
Scale=MatchLowercase }
\babelfont{rm}
[Ligatures={Common,Rare}, Scale=1.0]{Libertinus Serif}
\babelfont[greek]{rm}
{Gentium Plus}
\babelfont{sf}
[Ligatures={Common,Rare}]{Libertinus Sans}
\babelfont{tt}
{Libertinus Mono}
\setmathfont{Libertinus Math}
\setDefaultTransitions{\selectlanguage{english}}
{\selectlanguage{english}}
\setTransitionTo{GreekAndCoptic}
{\selectlanguage{greek}}
\setTransitionTo{GreekExtended}
{\selectlanguage{greek}}
\begin{document}
uῶ \textsf{uῶ}
\end{document}

\babelprovide[import]{ancientgreek} \babelfont[ancientgreek]{rm}[RawFeature=+cv78]{Gentium Plus}
but this didn't change the fonts either. It only works if I use a macro such as\selectlanguage
to change the language.