On Thu, 12 Nov 2026 22:08:39 GMT, Andy Goryachev <[email protected]> wrote:

> Fixes exporting of the `CodeArea` font to RTF and HTML.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

The fix and test look good, although I left a couple questions about the export 
itself, and one minor comment about a public field vs getter.

modules/jfx.incubator.richtext/src/main/java/com/sun/jfx/incubator/scene/control/richtext/HtmlStyledOutput.java
 line 369:

> 367:         wr.write("<head>\n");
> 368:         wr.write("<meta charset=\"utf-8\">\n");
> 369:         if (font != null) {

I see that this unconditionally writes the font information to the HTML header, 
even when `inlineStyles` is true. Is this intentional? Would it be better to 
move this underneath the `if (!inlineStyles)` check? If you did that, you'd 
need to emit the font information with each inline style.

modules/jfx.incubator.richtext/src/main/java/com/sun/jfx/incubator/scene/control/richtext/HtmlStyledOutput.java
 line 371:

> 369:         if (font != null) {
> 370:             wr.write("<style>\nbody {\n");
> 371:             wr.write("  font-family: \"");

You save the font family and size, but not the bold or italic attributes. Was 
this intentional?

modules/jfx.incubator.richtext/src/main/java/com/sun/jfx/incubator/scene/control/richtext/RtfStyledOutput.java
 line 74:

> 72:         this.font = RichUtils.codeAreaFont(r);
> 73:         if (font != null) {
> 74:             fontTable.add(font.getFamily());

As with the HTML export, you save the font family and size, but not the bold or 
italic attributes.

modules/jfx.incubator.richtext/src/main/java/com/sun/jfx/incubator/scene/control/richtext/VFlow.java
 line 101:

> 99: public class VFlow extends Pane implements StyleResolver, 
> StyledTextModel.Listener {
> 100:     private final RichTextAreaSkin skin;
> 101:     public final RichTextArea control;

Minor: A getter seems cleaner than making this field public.

-------------

PR Review: https://git.openjdk.org/jfx/pull/2369#pullrequestreview-5894006228
PR Review Comment: https://git.openjdk.org/jfx/pull/2369#discussion_r4565961538
PR Review Comment: https://git.openjdk.org/jfx/pull/2369#discussion_r4565681781
PR Review Comment: https://git.openjdk.org/jfx/pull/2369#discussion_r4565688932
PR Review Comment: https://git.openjdk.org/jfx/pull/2369#discussion_r4565461060

Reply via email to