View Single Post
Old 07-16-2014, 07:16 PM   #3
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
Quote:
Originally Posted by Jellby View Post
With firmware 3.5.0 (I'm not sure about previous versions) I've noticed that custom fonts override some embedded fonts, depending on how they are used.

For instance:

Code:
<div class="font">
<p>Test</p>
</div>

<div>
<p><span class="font">Test</span></p>
</div>
where the class "font" just uses some embedded font with font-family.

With "Document Default" font selected, both "Test" use the embedded font, but if I select any other font (included or sideloaded), only the second one uses the embedded font, and the first uses whichever font I've selected.

So, it looks like the selected font is being used "as if" in a p or * CSS rule. Does anyone have further information on how exactly this works? Could a patch be created to make the custom font apply to body only (I'm interested in chosing my default font, but not overriding document-defined fonts)?
It has been this way for many fw versions. The Kobo internal css override is something like this
Code:
@font-face { font-family: -ua-default; font-style: normal; font-weight: normal; src: url('res:///fonts/normal/%1') }
@font-face { font-family: -ua-default; font-style: italic; font-weight: normal; src: url('res:///fonts/italic/%1') }
@font-face { font-family: -ua-default; font-style: italic; font-weight: bold; src: url('res:///fonts/bolditalic/%1') }
@font-face { font-family: -ua-default; font-style: normal; font-weight: bold; src: url('res:///fonts/bold/%1') }
body, p { font-family: -ua-default !important; }
body {text-align: %1 !important;
line-height: %1em !important;
padding-bottom: %1em !important;
-kobo-font-sharpness: %1;
-kobo-font-thickness: %1;}
The problem being the red bit, as you suspected. Ironically, I suspect the body, p {...} was introduced by Kobo due to complaints from users because the Kobo override wasn't happening when they wanted it to.

As for a possible fix - you're in luck I also don't like the body, p {} so I've added this simple patch to the end of my libnickel.so.1.0.0.patch config file for fw 3.5.0 only.
Code:
<Patch>
patch_name = `jackie_w Font family override (all devices)`
patch_enable = `yes`
replace_bytes = C3DF10, 2C 00 20 00 70 00, 20 00 20 00 20 00
</Patch>
All it does is change the ', p' to 3 spaces. I've never made it public before because I couldn't face trying to explain to non-css-aficionados why it might be desirable. As you've asked, I have no problem sharing

Last edited by jackie_w; 07-16-2014 at 07:20 PM.
jackie_w is offline   Reply With Quote