standardebooks / tools

The Standard Ebooks toolset for producing our ebook files.
Other
1.42k stars 125 forks source link

add script as additional class to `xml-lang` #698

Closed ousia closed 4 months ago

ousia commented 4 months ago

@standardebooks,

passage from the Plato (compatible version):

Omitting <i class="xml-lang" lang="grc" xml:lang="grc">ἤ τινος</i>

The default reader fonts don’t contain polytonic Greek glyphs.

To add a different font-family, I need a CSS selector such as:

i.greek-script {
    font-family: "Greek font";
}

More complex selectors (such as i.[lang="grc"]) won’t work with my reader.

But for that, I think it would be worth considering to add a class with the script with xml:lang values not using the Latin script.

This would read in Python pseudocode:

if xml-lang == "el" or xml-lang == "grc":
    add_class("xml-lang greek-script")

Of course, similar would be a cyrillic-script class with all languages that use the script, and so on.

Would it be possible to have this feature added to the tools?

Many thanks for your help.

acabal commented 4 months ago

i.[lang="grc"] is not a valid CSS selector; you probably mean i[lang="grc"] (no period). Try if that works in your reader.

I don't think we want to add a class to all of our ebooks just to support an edge case. There are tons of weird issues in ereaders, especially older ones using old versions of ADE, and we just can't support them all in a way that makes sense in 100% of cases.

The core issue is the font your ereader is using. Lack of Greek characters is a common problem. But if you're already editing the CSS, you may as well just add your own font to the ebook and display it that way.

ousia commented 4 months ago

Sorry, I even thought that i.[lang="grc"] worked on my laptop with Calibre.

ousia commented 4 months ago

BTW, i[lang="grc"] works perfectly fine.