04-28-2017, 11:16 AM | #1 |
Librarian
Posts: 346
Karma: 72225
Join Date: Apr 2015
Location: Liège - Belgium
Device: kobo gloHD - KA1
|
text-indent sets in 'pt'
Hello,
I noticed today that some of my epubs which have text-indent css set in with 'pt' values are not indented at all. When switched to 'em' or 'px' values, indentation is displayed correctly. is it a known bug ? I check with https://github.com/koreader/koreader/issues/2715 but doesn't seems related. |
04-28-2017, 11:48 AM | #2 |
Wizard
Posts: 1,653
Karma: 730583
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
|
Yes, it's a known bug: https://github.com/koreader/koreader/issues/1010
pt isn't recommended for on-screen display but obviously the present situation is rather stupid regardless. The browser method of 1em = 12pt = 16px = 100% seems like a fairly reasonable default even if it's technically against the spec because px is a relative value while pt is absolute. I suspect it's currently undefined in order to wait for a proper solution, which is something we'd probably be able to do as well. So the simple solution: pt_value/12*base_px The complex solution (but possibly not that complex): use DPI to actually calculate the physical size of 12pt — however, on devices like cellphones doing so would actually result in an inferior experience… which is of course why pt isn't recommended for on-screen display in the first place. So I think the easier solution actually sounds best. Edit: actually looking at it a bit more I think hwhw might've been mistaken https://github.com/koreader/crengine...rend.cpp#L1876 seems to do what I suggest In that case the issue must be something slightly different. Last edited by Frenzie; 04-28-2017 at 11:57 AM. |
Advert | |
|
05-10-2017, 01:53 AM | #3 |
Librarian
Posts: 346
Karma: 72225
Join Date: Apr 2015
Location: Liège - Belgium
Device: kobo gloHD - KA1
|
Any help to create a regex for calibre to replace in all css a string like this ?
text-indent: 'ptvalue'pt; with text-ident: '??'em with '??' = pt_value/12*base_px for the value ? (i don't know if it's possible to calculate in a regex) |
05-11-2017, 04:37 AM | #4 |
creator of calibre
Posts: 44,243
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You dont use regex for that you use the the Look & Feel->Transform styling section of the conversion dialog. There you can create rules to make the changes you want, including multiplication, addition, etc.
|
05-11-2017, 04:50 AM | #5 |
Librarian
Posts: 346
Karma: 72225
Join Date: Apr 2015
Location: Liège - Belgium
Device: kobo gloHD - KA1
|
Oh, i forgot about this option ! thanks !
|
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Possible bug with negative text-indent? | ShellShock | Marvin | 5 | 02-21-2017 06:31 PM |
Text Indent | copaw | Editor | 10 | 11-09-2014 11:44 AM |
Cannot get rid of text-indent | dawood | Conversion | 3 | 10-21-2013 10:10 PM |
How do you turn off default text-indent <p> in Nook | DAntkowiak | Barnes & Noble NOOK | 9 | 07-11-2013 10:43 AM |