Subsets of fonts with CSS set to uppercase or small-caps variants

Bug #1568555 reported by Kalle on 2016-04-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Calibre: 2.54.0

After subsetting my embedded fonts, font-characters are not displayed as the embedded font if the related characters are set in the CSS to "font-variant: small-caps" or "text-transform: uppercase".
That's probably because the subset-function does not check if the fonts are set to uppercase or small-caps in the current CSS and so it includes only the regular small variants, as they are written in the eBook.

Imho the subset-function should regard those special CSS styles, cause right now you either don't want to use the subset in that case or you need to hard-edit all letters to uppercase, if you want the subset to contain all the right letters.
Maybe the function could get a switch for the user to chose if the subset should look out for CSS-styles. Thanks in advance.

font-variant is based on substitution rules in the GSUB table of the
font file, since those rules are automatically parsed and all related
glyphs included automatically, it should work already. If not, then you
need to atatch a file demonstrating the problem.

As for text-transform, sure support for it can be added, however, why on
earth would anyone want to use text-transform in an ebook -- why not
just include the correct text in the first place? Given that
text-transform is unlikely to be supported across all reader
implementations, using it is a pretty bad idea.

 status incomplete

Changed in calibre:
status: New → Incomplete
Kalle (kamano) wrote :

Alright, just made a demo file and screenshots. Seems I can only upload one file per post, so this is a screenshot of the file before and after subsetting the font.
I used a recognizable font for demonstration purposes. As you can see, both styles conflict with the subset, the letters get replaced with standard (Sans-Serif) ones.

I see "text-transform: uppcase" usually on title-headings if the creator wants to style or highlight the caption a bit, but to keep the words correctly captioned written or something. - So, in the meaning of seperating the content from the style, it actually makes sense to me to use "text-transform: uppercase". However I would also never want to read a whole book in uppercase letters, haha. ;)
Btw, if you use "text-transform: uppercase" and after it the automatic TOC thingy, the TOC is containing the right captions and not every word in large letters, what is looking kind of weird there.

Kalle (kamano) wrote :

And now the test-eBook file after subsetting the font.
You can recreate it with any other font that has got large and small letters. You need to save and load the book to see the change though.

Kovid Goyal (kovid) wrote :

The font used there has no small caps capability -- which means the renderer is faking small-caps by rendering normal caps letters in smaller size. Use a font that has the actual smcp feature, as described here: and it will work fine.

Still, I suppose I can modify the subsetting code to handle this case, of using a font-variant with a font that has no small-caps support.

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: Incomplete → Fix Released
Kalle (kamano) wrote :

Ah okay, that explains why small-caps are not working here. - I don't know very much about typography.

The modified function would be awesome, thanks! And please consider changing it for uppercase styles too. My favorite publisher is using this a lot on headings and at least it works just fine on my (3 years old) eBook-reader.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers