New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tibetan pagination #1786
Comments
Hi! As far as I know, the Maybe there’s something included somewhere in a CSS specification to handle this use case. There’s a dedicated section in a W3C document, but not CSS feature seems to be linked to this requirement. The next step to solve this problem is to find a feature in the CSS specification that could be useful. And if it doesn’t exist, it should be interesting to open an issue on the CSSWG’s repository explaining this requirement and asking for a feature that could help. |
Look like for that rule implementation it is need access to Python pages and phrases rendering rules. |
It’s theoretically possible to change the content on the fly, but you’ll need to rely on a private API that may change in the future. I’ve used the sample you provided in the other issue and I’ve added some code before this line: WeasyPrint/weasyprint/layout/inline.py Line 37 in 005aa31
if 30 < position_y < 31:
child = box
child_skip_stack = skip_stack
while isinstance(child, boxes.ParentBox):
if child_skip_stack:
skip = tuple(child_skip_stack.keys())[0]
child_skip_stack = child_skip_stack[skip]
else:
skip = 0
child = child.children[skip]
if child_skip_stack:
skip = tuple(child_skip_stack.keys())[0]
else:
skip = 0
child.text = child.text[:skip] + 'abc' + child.text[skip:] Of course, that’s a huge hack, and you’ll need more work to get something more robust that than. The test of the position (the first line) is a quick and dirty way to check that we’re at the top of the page (and not on the second line, or in a page margin). There’s probably a much better way to do this… The We then insert the text we want at the current position. Here’s, it’s You can modify WeasyPrint itself for your needs, or just monkey-patch the |
Great! One more question for now. Thank you from my heart for help. |
The "clean" way would be to have a CSS specification we could follow. We never add unspecified behaviors directly in WeasyPrint, it’s already really hard and time consuming to implement the existing specifications 😄. But, of couse, you can hack WeasyPrint to fit your needs. It’s even possible to override WeasyPrint’s function without touching its code, that’s part of Python’s beauty (or ugliness, who knows?).
The Happy new year for you too! |
For Tibetan text print layout it is need insert ༄༅། in beginning of first text string on every odd page.
Please help us understand how apply this rule for page layout
With best regards
Open Source Buddhism Library
Alexander Stroganov
The text was updated successfully, but these errors were encountered: