-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Set canvas size based on text length #476
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
Conversation
|
The tests here fail (at least locally, so I'd be surprised if they would pass in the pipeline), because it seems it is not possible to call |
|
As discussed on Discord (@huguesdevimeux, @naveen521kk): if the I've tried to fix it in a similar way, but I fear that this hits some other limit than the canvas size: no matter how large I set the canvas, and no matter how I place the text, the error remains. If someone else has an idea how to fix this, suggestions are welcome. Otherwise I see two possible ways forwards:
|
|
If there is no fix, I think ignoring and warning the user that there is a problem is fine IMO |
@huguesdevimeux Good idea! I'll raise a warning if a font size larger than 500 or so is used. Another issue: the The reason seems to be that the |
|
This LGTM but all tests are failing :( |
Yes, this is what I mentioned recently on Discord. |
|
Ah I see. Well sounds like a great opportunity to use our handy new DEP bot. |
|
@behackl This can now continue development, no? Not trying to be pushy, just making sure :) |
|
I've merged master and applied the same solution/warning that I've added to
|
…ng factor for canvas width
|
The plan for Pango/CairoText is to start using the former instead of the latter (#609). Once that is merged, we will probably keep CairoText around for a bit until we are sure Pango is working well. Then, CairoText is going away completely. So I wouldn't worry too much about keeping them aligned. As long as #609 is merged soon, we should be able to completely forget about CairoText soon as well. |
|
@behackl don't stress about pango/cairo for this one ;) also, would it be possible to add a test so we don't regress in the future? |
|
I've already added a test here to check that. I am not entirely sure, however, why the tests on this PR fail only for windows; I need to investigate a bit more. |
|
The situation here has not become any clearer, and I have absolutely no clue why changing the canvas size dynamically (in particular: making it larger makes test fail on Windows. Overall, the Text class is very messy. I propose to get back to this PR once we have managed to refactor Text a little. |
List of Changes
Rendering long strings as
Textlets the text be outside of the predefined canvas, leading to only a part of the string being converted to the svg. This PR sets the canvas width dependent on the text width.Motivation
Resolves #469.
Testing Status
The issue is fixed, but the test I wanted to add is currently not working.
Depends on #492
Acknowledgement