thegetty / egypt-classical-world

"Egypt and the Classical World," edited by Jeffrey Spier and Sara E. Cole
0 stars 0 forks source link

Dealing with unusual characters like ꜣ #38

Closed geealbers closed 3 years ago

geealbers commented 3 years ago

Essay 4 uses the ꜣ character, which is a small letter Egyptological alef (U+A723). It's Unicode and part of Latin-Extended-D, and generally not represented in many fonts. In the browser, the browser itself will find a fallback for it, but in our PDF output, PrinceXML has no such built-in fallback system. So for the PDF we need to explicitly provide a font or other rendering option that covers this character.

geealbers commented 3 years ago

My first idea was to surround the words with a span element use CSS to assign them a font that included the character: <span lang="egypt">*wꜣs*-scepter</span>. However, there were two-dozen instances of it and so that would have led to a lot of excess markup in the files that would have hindered editing. I also didn't like the font options I was finding.

My second idea was to used an inline SVG: *w![ꜣ](/img/aleph.svg)s*-scepter. I liked that the alt text then could be the character (keeping it reasonably human and screenreader readable), and I had complete control over how the character looked, however it would have again led to a lot of excess markup in the files.

My last idea was to add the specialty font on as a fallback for the the body of the page: .quire-page__content p { font-family: "Noto Serif", "Junicode", serif !important; }. I need to test it in other browsers, but this seems to be working nicely. The only real issue then is the quality of the specific fallback font, and the characters don’t really go well with our base font.

Long term, I'm interested in creating a custom font with these characters, and maybe even contributing them back to the open source version.

geealbers commented 3 years ago

Our main body fonts in Quire are Noto Sans and Noto Serif. In doing further digging, I found (using the Glyphs app) that the source files (at https://github.com/googlefonts/noto-source) for both fonts include the small letter Egyptological alef that we need for this project along with the other Egyptological characters that are part of Latin Extended D. It seems only that this source version of Noto hasn't fully been pushed up to the public version available through Google Fonts.

By cloning the noto-source repo, I was able to build the fonts with commands like ./build src/NotoSans-MM.glyphs, which resulted in new OTF files, which I then converted to EOT, WOFF and WOFF2 files with CloudCovert and added to the project as overrides of our exiting versions of the Noto fonts.

geealbers commented 3 years ago

FWIW, this is a good list of full-featured scholarly fonts with lots of character coverage: https://mufi.info/m.php?p=mufi&i=960. (Note that we used Cardo is CVA 10, details on that here: https://github.com/thegetty/cva10/issues/6.)

For proprietary fonts, check out Skolar, which Getty currently uses for the Getty Research Journal.