-
|
I am currently using a rotated font + koreader_patch_vertical_read + "css text decoration" to achieve the effect below: Which I am think it's alright, but the lines are touching the text ATM, so here I believe I hit the limitation with css (unless there are solutions out there I am currently unaware of). Using the koreader lua API, is there a way to underline all the text on the current page? Would love to have someone help me get started on where I should start off from. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
|
Not able to test right now but can't you use the |
Beta Was this translation helpful? Give feedback.
-
|
My first idea was to use something like An other idea would be to hack your vertical patch so koreader frontend would get all text boxes from the current page, and draw these lines like it does with underlined highlight. But may be a no-code idea (keeping your own idea with text-decoration) would be to hack your font (as you are already using a hacked rotated font) so to tweak the font underline metrics. Our code do use |
Beta Was this translation helpful? Give feedback.
-
|
Some other ugly CSS solution (that may work or not and with side effects): p::before {content: '\200B'; display: block; line-height: 0;}
p { text-indent: 0 !important}
p > autoBoxing { display: inline }
p > autoBoxing { -cr-late; -cr-only-if: inline; border-bottom: 1px solid red; }1st line adds an invisible ::before block element, forcing the wrapping of everything else in the |
Beta Was this translation helpful? Give feedback.
-
|
Another ugly idea, that needs fine tuning of the size (to fit the real line height, on long paragraphs it would drift): p {
background-image: url(data:image/gif;base64,R0lGODlhCgAKAIEAAAAAAP8AAAAAAAAAACH5BAEAAAAALAAAAAAKAAoAAAgWAAEIHEiwoMGDCBMqXMiQYYCHECMGBAA7);
background-size: 1.4em;
background-position: bottom left;
}(Small 10x10px image, with a 1px red line at the bottom, encoded as base64.) |
Beta Was this translation helpful? Give feedback.
-
|
As for experimenting with frontend, I guess you would need to: Do a bit like in: koreader/frontend/apps/reader/modules/readerview.lua Lines 1436 to 1442 in 0115692 self.document:getScreenBoxesFromPositions() would give you an array of segments. (beware your patch tweak these functions, maybe it's for the best, if not you'll have to untweak them for your job). And for each segment, so like your patch do in ReaderView.drawHighlightRect for drawer=="underscore". |
Beta Was this translation helpful? Give feedback.
-
|
Also pinging @plateaukao, if he wants to add this as a feature to his vertical patch. |
Beta Was this translation helpful? Give feedback.




My first idea was to use something like
p > * { border-bottom: 1px solid gray }, but it won't match text direct child of<p>.An other idea would be to hack your vertical patch so koreader frontend would get all text boxes from the current page, and draw these lines like it does with underlined highlight.
But may be a no-code idea (keeping your own idea with text-decoration) would be to hack your font (as you are already using a hacked rotated font) so to tweak the font underline metrics. Our code do use
underline_positionandunderline_thicknessexposed by our font library: https://freetype.org/freetype2/docs/tutorial/step2.html. I have no idea how these are expressed in the font ie. in …