koreader / crengine

This is the KOReader CREngine fork. It cross-pollinates with the official CoolReader repository at https://github.com/buggins/coolreader, in case you were looking for that one.
72 stars 45 forks source link

CSS/Fonts: add support for font-family to font name mapping #490

Closed poire-z closed 2 years ago

poire-z commented 2 years ago

CSS parsing: accept (and ignore) namesspaces

Properly parse (instead of dropping/skipping):

  m|math { display:block; }
  [m|foo] { background-color: yellow ; }
  [m|foo|="bar"] { font-weight: bold; }

so these are matched (namespaces are ignored when matching selectors):

  <math foo="bar-baz">
  <m:math m:foo="bar-baz">

isImage(): more checks for <object> as it can have inner content

getFontFileNameAndFaceIndex(): returns if font has math support

Check for math support at font registration time.

getFontFileNameAndFaceIndex(): returns if font has emojis

CSS/Fonts: add support for font-family to font name mapping

Allow frontends to provided a list of font to use with each of the generic font-family names. Also let font-family: math/emoji/fangsong be supported. Have the font set for "font-family: math" font be used with MathML <math>.

This will allow implementing support for font-family in KOReader, see https://github.com/koreader/koreader/issues/7426#issuecomment-1258335839 .


This change is Reviewable

poire-z commented 2 years ago

I think in some test suite EPUBs I found at http://apex.infogridpacific.com/df/apex20130913-idpf-2013-epub3-general-test-cases.html while reading these interesting pages http://apex.infogridpacific.com/df/home.html