-
Notifications
You must be signed in to change notification settings - Fork 260
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
Issue457: Fractional Scaling on Windows #524
Issue457: Fractional Scaling on Windows #524
Conversation
- Add SwingUtils with methods for leveraging the FPAPI - Modify DefaultTokenPainter and VisibleWhitespaceTokenPainter to call SwingUtils
- set tabsize 4 in DemoRootPane (to match text sample) - fix bug in SwingUtils.charWidth(...) - modify SyntaxView to use floats for calculating tab stops: - SyntaxView.tabSize is now float - SyntaxView.calculateLongestLine() now calls SwingUtils.charWidth() - SyntaxView.nextTabStop() adapted for float tabSize
…hts and positions. Modify concerned classes and methods to use Rectangle2D and float variables instead of Rectangle and integers: - DefaultTokenPainter.paintBackground() - RSyntaxUtilities.getLineWidthUpTo() - SyntaxView: tabBase, clipStart, clipEnd, lineToRect(), damageLineRange(), modelToView(), paint() - Token.listOffsetToView() - TokenImpl.getWidthUpTo() now calls SwingUtils.charsWidth() - TokenImpl.listOffsetToView() - WrappedSyntaxView.modelToView()
… as the preceding character ends
…rily to avoid double lines on thick vertical line style NOTE: ConfigurableCaret.damage() still runs on integers as a result of superclass implementation. No negative effects have been observed.
…instead of float)
…ics when graphic properties change
…() to use FPAPI Refactor: move code from ConfigurableCaret.paint() to SwingUtils.drawLine()
…D and float/double variables
…corresponding elements for Java 9 or later Rectangles and bounds: - add SwingUtils.getBounds() to wrap calls to modelToView2D(pos).getBounds() in a null-safe way - replace calls to JTextComponent.modelToView(int pos) with calls to SwingUtils.getBounds(JTextComponent c, int pos) - replace calls to JTextComponent.viewToModel(Point p) with calls to JTextComponent.viewToModel2D(Point2D p) Events: - replace calls to InputEvent.getModifiers() with calls to MouseEvent.getModifiersEx() - replace calls to Toolkit.getMenuShortcutKeyMask() Toolkit.getMenuShortcutKeyMaskEx() - replace references to Event.META_MASK with InputEvent.META_DOWN_MASK - replace references to Event.CTRL_MASK with InputEvent.CTRL_DOWN_MASK - replace references to MouseEvent.BUTTON1_MASK with MouseEvent.BUTTON1_DOWN_MASK Not modified: - SyntaxScheme calls deprecated XMLReaderFactory.createXMLReader() which should be replaced with SaxParserFactory
…l-scaling-Windows
…xUtilities.isMonospaced(Font).
…inspired by SwingUtilities2)
- Add SwingUtils with methods for leveraging the FPAPI - Modify DefaultTokenPainter and VisibleWhitespaceTokenPainter to call SwingUtils
- set tabsize 4 in DemoRootPane (to match text sample) - fix bug in SwingUtils.charWidth(...) - modify SyntaxView to use floats for calculating tab stops: - SyntaxView.tabSize is now float - SyntaxView.calculateLongestLine() now calls SwingUtils.charWidth() - SyntaxView.nextTabStop() adapted for float tabSize
…D and float/double variables
…corresponding elements for Java 9 or later Rectangles and bounds: - add SwingUtils.getBounds() to wrap calls to modelToView2D(pos).getBounds() in a null-safe way - replace calls to JTextComponent.modelToView(int pos) with calls to SwingUtils.getBounds(JTextComponent c, int pos) - replace calls to JTextComponent.viewToModel(Point p) with calls to JTextComponent.viewToModel2D(Point2D p) Events: - replace calls to InputEvent.getModifiers() with calls to MouseEvent.getModifiersEx() - replace calls to Toolkit.getMenuShortcutKeyMask() Toolkit.getMenuShortcutKeyMaskEx() - replace references to Event.META_MASK with InputEvent.META_DOWN_MASK - replace references to Event.CTRL_MASK with InputEvent.CTRL_DOWN_MASK - replace references to MouseEvent.BUTTON1_MASK with MouseEvent.BUTTON1_DOWN_MASK Not modified: - SyntaxScheme calls deprecated XMLReaderFactory.createXMLReader() which should be replaced with SaxParserFactory
…xUtilities.isMonospaced(Font).
…inspired by SwingUtilities2)
…hts and positions. Modify concerned classes and methods to use Rectangle2D and float variables instead of Rectangle and integers: - DefaultTokenPainter.paintBackground() - RSyntaxUtilities.getLineWidthUpTo() - SyntaxView: tabBase, clipStart, clipEnd, lineToRect(), damageLineRange(), modelToView(), paint() - Token.listOffsetToView() - TokenImpl.getWidthUpTo() now calls SwingUtils.charsWidth() - TokenImpl.listOffsetToView() - WrappedSyntaxView.modelToView()
…rily to avoid double lines on thick vertical line style NOTE: ConfigurableCaret.damage() still runs on integers as a result of superclass implementation. No negative effects have been observed.
…ics when graphic properties change
…D and float/double variables
…dows' into issue-457-fractional-scaling-Windows # Conflicts: # RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/ParserManager.java # RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/VisibleWhitespaceTokenPainter.java # RSyntaxTextArea/src/main/java/org/fife/ui/rsyntaxtextarea/WrappedSyntaxView.java # RSyntaxTextArea/src/main/java/org/fife/ui/rtextarea/ConfigurableCaret.java # RSyntaxTextArea/src/main/java/org/fife/util/SwingUtils.java # RSyntaxTextAreaDemo/src/main/java/org/fife/ui/rsyntaxtextarea/demo/DemoRootPane.java # RSyntaxTextAreaDemo/src/main/resources/org/fife/ui/rsyntaxtextarea/demo/TextAlignmentExample.txt
Hi
Just rebased from the Java 11 branch to the best of my ability. There
were quite a few merge conflicts to handle manually, and since I haven’t
run this other than trying to start the demo app on macOS without any
fractional scaling, I cannot guarantee that there are no errors.
Also, there are a few warnings about deprecated methods that I haven’t
addressed.
Still, I hope this helps and that we can expect to update to version 4
soon!
Regards
Peer Törngren
…------ Original Message ------
From "bobbylight" ***@***.***>
To "bobbylight/RSyntaxTextArea" ***@***.***>
Cc "Peer Törngren" ***@***.***>; "Mention"
***@***.***>
Date 2024-11-19 13:57:17
Subject Re: [bobbylight/RSyntaxTextArea] Issue457: Fractional Scaling on
Windows (PR #524)
@ptorngren <https://github.com/ptorngren> - I'm finally looking at
this, thank you! I started down this path myself but it's a very large
task and I'm duplicating effort here.
Can you rebase this PR against the java-11 branch? All it does so far
is update the build to use Java 11. After that, if things look good,
can we squash and merge?
My plan is then to release a 4.0.0-SNAPSHOT release to Sonatype while I
do a bit more code modernization for Java 11, bump checkstyle, etc.
—
Reply to this email directly, view it on GitHub
<#524 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJDCYSZPHGUGM4RWMOLAHO32BMYS3AVCNFSM6AAAAABSCBSNKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBVGY2DKOBQGQ>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thanks for the PR! |
BTW, this is still on the Folks interested in trying this out can use the repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
} Note that |
Add support for FPAPI: Add new class SwingUtils with methods for leveraging the FPAPI
Modify concerned classes and methods to call SwingUtils and use Rectangle2D and float/double variables instead of Rectangle and integers:
Layout/painter changes:
Adapt to Java 11: Replace calls to deprecated elements with corresponding elements for Java 9 or later
Rectangles and bounds:
Events:
Also modified the Demo Root Pane: