etresoft wrote:
If the string you are trying to display cannot be represented in the specified font, there is an internal list of fallback fonts for any given run of text glyphs. It will pick the best match to your text and use that as the font.
This is where I'd like to have a little more control--i.e., to make the browser download a specified web font (e.g., Noto Sans Egyptian Hieroglyphs) and ensure that it uses the downloaded font.
To simplify greatly, I'm posting content to a web site whose CSS specifies Georgia for article text and Noto Sans for section headings and pretty much everything else. The web content is produced via an XML-to-HTML conversion. For reasons I can't currently change, it's not possible to wrap selected text in an HTML element that specifies a font other than the two basic fonts of the stylesheet. So when an article whose text is normally displayed in Georgia contains characters not in the Unicode range covered by Georgia (e.g., an Egyptian hieroglyph), I'd like to ensure that the browser chooses my preferred font from any list of fallback fonts for that character.
As you said, Safari already does this like magic (even apparently using fonts that I don't see installed in Font Book). Meanwhile, over on Windows, the browsers all seem to be using the Segoe UI Historic font, which has the necessary glyphs for a lot of ancient scripts, but I'd prefer to see the same font across platforms, and I prefer the Noto versions.
I've experimented with adding
@import url(https://fonts.googleapis.com/css?family=Noto+Sans+Egyptian+Hieroglyphs&display=swap);
to the site's stylesheet, which results in this being added to the stylesheet:
/* egyptian-hieroglyphs */
@font-face {
font-family: 'Noto Sans Egyptian Hieroglyphs';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://fonts.gstatic.com/s/notosansegyptianhieroglyphs/v26/vEF42-tODB8RrNDvZSUmRhcQHzx1s7y_F9-j3qSzEcbEYintdVi95xsrig.woff2) format('woff2');
unicode-range: U+13000-1342E, U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
But I found that that doesn't change the display of the text containing hieroglyphs--presumably because the font-family name 'Noto Sans Egyptian Hieroglyphs' isn't explicitly used elsewhere in the stylesheet or in the HTML markup. Is a web font downloaded this way available to be one of those "fallback fonts" that an app will use when the default font doesn't have a glyph for the character(s) to be displayed?
In the past we have posted articles with a note at the beginning, to the effect of "You may need to download and install the following fonts to view this article: [link to the necessary fonts]". But it seems that doesn't guarantee the browser will use that font if another fallback is available (e.g., Segoe UI Historic vs. Noto Sans Egyptian Hieroglyphs). I'd much prefer to force the browser to download and use the preferred font without requiring the reader to do extra work.