-
-
Notifications
You must be signed in to change notification settings - Fork 704
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
Font rendering issue: can only concatenate str (not "float") to str #910
Comments
Ah, that's another crossing-the-margin bug. This time related to the floating department. div {
font-family: sans-serif;
max-width: 13em;
}
div:first-letter {
float: left;
}
</style>
<div>
<span>Xpart that fits into one line</span>
more text required to trigger the crash
</div> Font family and max-width ensure that "part that fits into one line" fills the line. The additional |
I dunno why the Error Message is "TypeError: must be str, not int" but it's definitely raised by a |
Ah, stupid me: 'auto' is a string and adding the padding numbers fails of course |
In BTW: Adding a |
I tried setting the height, but it seems to introduce some other issues. The issue appears only when the first letter is enclosed in another (inline) tag. <p class="lh-copy measure f4 mv1 tj">
<em class="i">All the diagrams you studied so far didn't picture any server.</em>
All of them were focussed on the logical architecture of your application and not the physical infrastructure which is necessary to deploy containers, Pods, Services and Ingresses.
</p> I have an example without the extra inline tag and it works: |
Yes, the height only prevents the crash.
Right. Unless you put it in an inline tag that (without the fisrst letter) is shorter or longer than the available width. Wrapping the first letter in a dummy-span also renders perfectly: <p class="lh-copy measure f4 mv1 tj"><em class="i"><span>A</span>ll the diagrams you studied so far didn't picture any
server.</em>
All of them were focussed on the logical architecture of your application and not the physical infrastructure
which is necessary to deploy containers, Pods, Services and Ingresses.</p> @liZe - as always: I don't get what happens when and why in the thoroughgoing recursively layout source. I see that When the first letter is put in its own inline tag (or an inline box that's shorter or longer than the width) the BlockBox created by Have no idea where the decision is made, to resolve_percentages or not to resolve_percentages for the floating (excluded_shape) BlockBox. |
The real problem isn't the crash / the height being reset to First floating letter with height and some deco added: Inserting elif child in context.excluded_shapes:
waiting_children.append((index, child))
continue into WeasyPrint/weasyprint/layout/inlines.py Line 697 in 63fe312
almost fixes the bug: |
The problem is: WeasyPrint/weasyprint/layout/inlines.py Lines 815 to 816 in 5f7a104
WeasyPrint/weasyprint/layout/inlines.py Lines 832 to 836 in 5f7a104
Absolute, relative and floating boxes have already been gathered in the previous The layout of the first letter box is done twice, causing the crash. We could add more workarounds to avoid this, but the real solution is to rewrite |
This bug has actually been fixed in version 52. |
It took me a while to isolate the issue, but I think I have a snippet of HTML that consistently breaks weasyprint with the following error:
The HTML snippet is available here: https://gist.github.com/danielepolencic/04d506fde37f0e81b9e365fdd1908339
I also found the fix. If I remove the
class
from the<body>
tag, the error disappears.I can also remove the float from:
and that seems to work too.
My limited Python proficiency didn't help me diagnose the bug further.
I'm not sure how fonts and floating are related.
The text was updated successfully, but these errors were encountered: