Skip to content
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

Console font bug, cursor is off #19

Closed
clankill3r opened this issue Nov 6, 2019 · 8 comments
Closed

Console font bug, cursor is off #19

clankill3r opened this issue Nov 6, 2019 · 8 comments
Assignees

Comments

@clankill3r
Copy link

I reported a similar issue a while ago for the text editor but I noticed it happens in the console too.

2019-11-06 09 57 22

I'm using the latest version of Samuel's website (which is from some time back, so it might been have fixed).

@sampottinger sampottinger self-assigned this Nov 6, 2019
@sampottinger
Copy link
Collaborator

Hey there! The text editing area was resolved in sampottinger/processing#103 (Processing's custom text area UI was not compatible with Java 11 possibly b/c JEP 263) and should be active in your build. I wasn't able to reproduce but I'll keep digging. Which font and at what size?

@sampottinger
Copy link
Collaborator

sampottinger commented Nov 6, 2019

Hey there! Sorry... I was able to reproduce the console issue with Source Code Pro 14px. This is a bit funky because I thought Processing simply used DefaultStyledDocument default drawing in EditorConsole unlike JEditTextArea in which processing uses custom drawing behavior. I'll need to do some digging... That said, the text edit area should be correct.

@clankill3r
Copy link
Author

clankill3r commented Nov 7, 2019 via email

@sampottinger
Copy link
Collaborator

sampottinger commented Nov 7, 2019

Hey there! So... we aren't doing custom rendering for that component... It's just a standard JTextPane (see EditorConsole). I'm slightly worried this might be https://bugs.openjdk.java.net/browse/JDK-8158370 (see also https://bugs.openjdk.java.net/browse/JDK-8156217). :-/ The resolution would be wait for Java to fix upstream or override drawing behavior. I'll be back with more soon.

@sampottinger
Copy link
Collaborator

sampottinger commented Nov 7, 2019

Well... I'm not quite sure how this bug is manifesting but I traced it down to https://github.com/processing/processing4/blob/master/app/src/processing/app/ui/EditorConsole.java#L173. It appears that there's a rounding error in the text size calculation (inside Swing) but it only happens for certain gutter sizes. Using the default gutter size or switching Editor.LEFT_GUTTER to basically anything other than 44px seems to fix it. ☹️ So that's not great. I tried a bunch of different font / font sizes and this seems to resolve. I don't think I want to take over rendering behavior so I'll put this up to a PR. As with sampottinger/processing#103 this doesn't seem to happen with most fonts but it does happen with Source Code Pro. 😢

sampottinger added a commit to sampottinger/processing4 that referenced this issue Nov 7, 2019
Responding to benfry#19, there appears to be an issue with calculating the bounds of text inside JTextPane within EditorConsole for specific font family and size combinations. This may be related to https://bugs.openjdk.java.net/browse/JDK-8158370 or https://bugs.openjdk.java.net/browse/JDK-8156217 but resolves when changing Editor.LEFT_GUTTER from 45 to basically anything else.
@sampottinger
Copy link
Collaborator

@clankill3r - This will be resolved with #20. Thank you for your help!

@sampottinger
Copy link
Collaborator

sampottinger commented Nov 11, 2019

Hey @clankill3r - this is previewed in a new build. See https://github.com/sampottinger/processing4 (and https://www.datadrivenempathy.com/processing).

sampottinger added a commit that referenced this issue Jan 20, 2020
[Fork] Allow support for static imports through pdex's ImportStatement.
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants