RSyntaxTextArea
RSyntaxTextArea copied to clipboard
WIP: Ligature support. Selections ending mid-ligature is a problem
To render ligatures, but also support our "system selection" property where selected text is a different color, we need to update the token painting for partially-selected tokens. We need to render the token twice - once for the unselected piece(s) and once for the selected piece - to ensure ligatures are properly rendered in "both" pieces. Otherwise, if a ligature is partially selected, we'll render the individual chars instead.
Current status:
- Seems to (mostly) work with the default
SyntaxScheme! - Currently testing with the demo app across all themes with the following text:
// ligatures: ## <> => ++ ~~ <= >= <=> ->>
Current issues:
Themecallsfont.deriveFont()in a few places, and I think loses the base font's attributes- Selections that start "in the middle" of a long token, such as an MLC, don't properly identify the start and end offsets of the selection when in the "Default (System selection)"
Theme
Things to consider:
- [ ]
RTextAreaBase.getDefaultFont()should support enabling ligatures - [ ]
SyntaxSchemes should propagage ligature attributes to derived fonts - [ ]
Themes should propagate ligataure attributes to derived fonts - [ ] Selections that begin or end mid-ligature should not render the individual glyphs
- [ ] For simplicity, should this be an API, e.g.
textArea.setLigaturesEnabled(boolean)?