-
Notifications
You must be signed in to change notification settings - Fork 4
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
Make TextLayout use consistent font size. Do not merge. For testing only. #109
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
- positioning - redraw transparent Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
For Labels and Check/Radio-Buttons the parent should be visible. This is a canvas feature which is necessary to implement in the control. This also must be checked on mac and linux. Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Okay, that's interesting. Can you execute the test class |
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Currently all tests work, except two fail, but not with the stack overflow. Some asserts fail: java.lang.AssertionError: :k: expected:<0> but was:<1> |
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
I will check the existing tests for TextLayout. Some are failing. |
Strange. I am wondering what makes the tests behave differently on our systems. For example the test case
|
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Can you debug the getTextLayout in StyledTextRenderer?
The reason for this problem actually seems to be the new getFontSize() implementation. Can you revert only this method back to my heuristic code. And then run the test? |
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Yes, sorry that I did not mention that explicitly: without the change to |
Signed-off-by: Denis Ungemach <denis.ungemach@sap.com>
Yes, there were some other minor changes in TextLayout. This was also the first thing i found out. |
The bug comes up because of StyledTextRenderer in line 1346 - 1360. The size reaction for setAscent and setDescent is not implemented in TextLayout. This means it expects that the TextLayout got bigger, but this won't happen. and since the size update does not work it calls every time: styledText.setCaretLocations(); which calls the TextLayout size change once again. |
The combination of FontMetrics, ascent and descent does not work. |
Sounds reasonable. In particular, the TextLayout uses an internal GC for retrieving the font metrics which is based on a native GC rather than a SkijaGC. Does that make sense or can that produce inconsistencies?
Can you further explain this? What kind of reactions would the TextLayout need to do? While setting ascent/descent should of course have an effect on the layout, they should not have an effect on the font size. One thing I also noticed is that the marker for the corresponding brace is not sized correctly. This may also be an indicator for an inconsistency, as everything else (used font size, line number ruler, caret) seem to be consistent. |
StyledTextRenderer line 1345 - 1386: Here it first checks the heights and it wants to find out whether there are lines with bigger height than its own height. If it finds such a line, then it wants to modify all layouts with this fonts metrics ascent and descent parameter. With: styledText.setCaretLocations(); later the infinite loop is caused, if this won't be handled properly.
|
Thank you, @DenisUngemach! I finally got it: when computing the lines in |
a9f24e5
to
d2109d6
Compare
The branch contains some Test modifications for TextLayout. This might be good to have.... |
Indeed. Do you want to rebase on current master and extract those changes or should I do that while you are away? |
I will be in vacation in 5 minutes. I have to say, that the TextLayout code is messy, because i searched for the font size bug and also made some modifications for the tests. Since the skija paragraph TextBox defines sizes in float and not in int, there are some problems with the positions, because of rounding. |
I'll try to do it. Enjoy your vacation! 🙂 |
Do not merge. For testing only.