Hello, Andy. Thank you for your reply.

I'm working on a project that uses two CodeAreas—one from the RichTextFX 
project and one from JFX.
I can't provide more details yet, but I promise to share a link once it's ready 
:)

However, this isn't really the main point. There are two ways to handle 
styling—via CSS and via code. CSS styling
is always more convenient and preferable since it's an established standard. 
For example, since my project
involves two CodeAreas, I need to unify their styling approach (using style 
classes).

Just imagine—for the RTFX CodeArea, a user can use classic CSS, but for the JFX 
CodeArea, they'd have to come
up with some non-standard approach that would break the whole architecture, 
relying on workarounds.

That's why I suggest to add wavy underline support to JFX CodeArea. Compare:

Web CSS: text-decoration-style: wavy;
RTFX CSS: -rtfx-underline-wave-radius: <size>;
JFX CSS: It’s not that simple

Best regards, Pavel

On 4/28/25 18:36, Andy Goryachev wrote:

An interesting question.

Currently, the shape for a wavy underline is created programmatically, see 
HighlightShape::generateSquiggly().  It is unclear how to enable CSS styling - 
for example, the model may decide to provide more than one color.  It is also 
unclear how to generate the necessary path via CSS (it is currently a Path with 
a sawtooth line segments generated from the underline shape provided by the 
text layout).

If you are satisfied with the wavy line shape itself and just want to set the 
color via CSS - that should be easy (you just identified a missing API - there 
is RichParagraph.Builder.addWavyUnderline(int start, int end, Color color), but 
not RichParagraph.Builder.addWavyUnderline(int start, int end, String ... 
styles).

And we have a similar situation with the similar method 
RichParagraph.Builder.addHighlight().

Could you describe your use case in more detail please?

-andy

*From: *openjfx-dev <openjfx-dev-r...@openjdk.org> on behalf of PavelTurk 
<pavelturk2...@gmail.com>
*Date: *Sunday, April 27, 2025 at 11:27
*To: *openjfx-dev@openjdk.org <openjfx-dev@openjdk.org>
*Subject: *RichTextArea: how to set wavy underline using CSS?

RichParagraph.Builder has public RichParagraph.Builder addWavyUnderline(int 
start, int length, Color color) method.

However, I can't find a way how to make a wavy underline via CSS. It is very 
important for me because I want to make all styling via CSS -
I don't want to make users use different mechanisms for styling (CSS,  code).

Fox example, RichTextFX contains the following rules:

     /* the color of the underline */
     -rtfx-underline-color: <paint>;

     /* the radius used to create waved underline */
     -rtfx-underline-wave-radius: <size>;

Could anyone say how to do it in JFX RichTextArea?

Best regards, Pavel

Reply via email to