View Single Post
Old 09-24-2022, 12:28 PM   #1
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Subsetting fonts problem when using pseudo-classes

I was hoping to use existing code from calibre.ebooks.oeb.polish.subset, specifically subset_all_fonts, to build some extra functionality into one of my personal plugins.

The problem I'm seeing is that text which will be displayed by a CSS rule such as:
Code:
.tx1::first-line {font-family: MySmallcapsFont;}
doesn't seem to be taken into account when the existing subsetting code is deciding which characters need to be retained in the MySmallcapsFont font. In the worst-case scenario, if the above CSS rule was the only one referencing MySmallcapsFont then currently this font would be completely removed from the container.

I do understand that calibre has no idea which/how many characters will appear on the first-line but I wonder if it's possible to have some sort of compromise, i.e. keep all characters used by class="tx1", i.e. the main part of the selector. Just a personal opinion but I'd rather keep too many than too few.

If this is a non-starter then I'll just have to live with it, but if it's something you'd consider fixing/improving I'm happy to open a bug report with a sample epub.
jackie_w is offline   Reply With Quote