<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Since we’re talking about code styling, I would highlight the
    following as the main properties:<br>
    - foreground color (+)<br>
    - background color (-)<br>
    - font (weight, italic, size, name) (+)<br>
    - underline (e.g. for links) (?)<br>
    - wavy underline (e.g. for spelling) (-)<br>
    <br>
    I think these properties cover 99% of all the necessary properties
    for CodeArea.<br>
    I used + and - to show what has already been implemented.<br>
    <br>
    Best regards, Pavel<br>
    <br>
    <div class="moz-cite-prefix">On 5/8/25 22:21, Andy Goryachev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:BYAPR10MB3013CE9068415AD930E9825FE58BA@BYAPR10MB3013.namprd10.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="Generator"
        content="Microsoft Word 15 (filtered medium)">
      <style>@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}@font-face
        {font-family:Aptos;
        panose-1:2 11 0 4 2 2 2 2 2 4;}@font-face
        {font-family:"Iosevka Fixed SS16";
        panose-1:2 0 5 9 3 0 0 0 0 4;}@font-face
        {font-family:"Times New Roman \(Body CS\)";
        panose-1:2 11 6 4 2 2 2 2 2 4;}@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:10.0pt;
        font-family:"Aptos",sans-serif;}a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Iosevka Fixed SS16";
        color:windowtext;}.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}div.WordSection1
        {page:WordSection1;}</style>
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Oh,
            I finally get it what you want.  Thanks!<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">What
            you asking is effectively to add support for some additional
            properties to the class that renders the text segment
            (currently, Text).  My first question is - what are the
            additional properties, beside the background-color?  If it's
            only the background color, it's probably easy to add.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Anything
            beyond that, such as equivalent of full
            -fx-region-background or -fx-region-border, would be
            extremely unlikely.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""><o:p> </o:p></span></p>
        <div id="mail-editor-reference-message-container">
          <div>
            <div>
              <div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
                <p class="MsoNormal" style="margin-bottom:12.0pt"><b><span
                      style="font-size:12.0pt;color:black">From:
                    </span></b><span
                    style="font-size:12.0pt;color:black">openjfx-dev
                    <a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev-retn@openjdk.org"><openjfx-dev-retn@openjdk.org></a> on behalf of
                    PavelTurk <a class="moz-txt-link-rfc2396E" href="mailto:pavelturk2000@gmail.com"><pavelturk2000@gmail.com></a><br>
                    <b>Date: </b>Thursday, May 8, 2025 at 11:44<br>
                    <b>To: </b><a class="moz-txt-link-abbreviated" href="mailto:openjfx-dev@openjdk.org">openjfx-dev@openjdk.org</a>
                    <a class="moz-txt-link-rfc2396E" href="mailto:openjfx-dev@openjdk.org"><openjfx-dev@openjdk.org></a><br>
                    <b>Subject: </b>Re: RFR: 8355774: RichTextArea:
                    provide mechanism for CSS styling of highlights<o:p></o:p></span></p>
              </div>
              <p class="MsoNormal" style="margin-bottom:12.0pt"><span
                  style="font-size:12.0pt">Andy, thank you for your
                  reply.
                  <br>
                  <br>
                  I have already provided some examples, but I’ll give
                  one more very simple example that clearly illustrates
                  the problem.<br>
                  <br>
                  I have a library that uses JFX CodeArea. Naturally,
                  all styles are stored in a CSS file. Users of this
                  library can customize
                  <br>
                  how the code is displayed by modifying the styles in
                  the CSS file. Let’s take the search feature as an
                  example. In the
                  <br>
                  CSS file, there is a class:<br>
                  <br>
                  .search-match {<br>
                      -fx-background-color: orange;<br>
                  }<br>
                  <br>
                  But the user wants to change not the background color,
                  but the foreground color and font weight. So they
                  write:<br>
                  <br>
                  .search-match {<br>
                      -fx-fill: orange;<br>
                      -fx-font-weight: bold;<br>
                  }<br>
                  <br>
                  And this should work. If it doesn’t, then it’s no
                  longer CSS-based styling.<br>
                  <br>
                  If, for some reason, the -fx-background-color property
                  cannot be used, an alternative property can be
                  introduced,
                  <br>
                  such as -fx-highlight-color. However, everything else
                  in the example should work as described.<br>
                  <br>
                  Best regards, Pavel<o:p></o:p></span></p>
              <div>
                <p class="MsoNormal"><span style="font-size:12.0pt">On
                    5/8/25 21:25, Andy Goryachev wrote:<o:p></o:p></span></p>
              </div>
              <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
                <div>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Pavel:</span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">I
                      think your comments in the ticket are still
                      invisible to me, so I can't comment.</span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">About
                      your recent comment in the PR - I have difficulty
                      understanding what you mean.  We are not adding
                      methods to "style individual properties".  We are
                      adding methods that allow the application to use
                      CSS to style parts of the visual representation of
                      the given RichParagraph.</span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">Perhaps
                      if you describe what kind of visual representation
                      you have in mind, we can show how to achieve that
                      in the code.</span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16"">-andy</span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
                  <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Iosevka Fixed SS16""> </span><o:p></o:p></p>
                  <div id="mail-editor-reference-message-container">
                    <div>
                      <div>
                        <div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
                          <p class="MsoNormal"
                            style="margin-bottom:12.0pt"><b><span
                                style="font-size:12.0pt;color:black">From:
                              </span></b><span
                              style="font-size:12.0pt;color:black">openjfx-dev
                              <a
href="mailto:openjfx-dev-retn@openjdk.org" moz-do-not-send="true">
                                <openjfx-dev-retn@openjdk.org></a>
                              on behalf of PavelTurk <a
                                href="mailto:pavelturk2000@gmail.com"
                                moz-do-not-send="true">
                                <pavelturk2000@gmail.com></a><br>
                              <b>Date: </b>Thursday, May 8, 2025 at
                              11:04<br>
                              <b>To: </b><a
                                href="mailto:openjfx-dev@openjdk.org"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">openjfx-dev@openjdk.org</a>
                              <a href="mailto:openjfx-dev@openjdk.org"
                                moz-do-not-send="true">
                                <openjfx-dev@openjdk.org></a><br>
                              <b>Subject: </b>Re: RFR: 8355774:
                              RichTextArea: provide mechanism for CSS
                              styling of highlights</span><o:p></o:p></p>
                        </div>
                        <div>
                          <p class="MsoNormal"
                            style="margin-bottom:12.0pt"><span
                              style="font-size:11.0pt">I am not a member
                              of the JavaFX team, but if I may, I’d like
                              to express my opinion. I believe that
                              creating separate<br>
                              methods for styling individual properties
                              is a very problematic and dangerous
                              decision.<br>
                              <br>
                              First, the usefulness of such methods is
                              minimal because when styling is done via
                              CSS, the assumption is that<br>
                              adjusting the CSS file should be
                              sufficient—something that won’t work in
                              this case. For example one user for search<br>
                              result wants to set background color for
                              matches but another one wants to set
                              foreground color + weight.<br>
                              Second, it violates fundamental CSS
                              principles. Third, if these methods are
                              added to the API, they cannot later<br>
                              be removed without breaking backward
                              compatibility.<br>
                              <br>
                              I wrote about this in detail in the
                              additional information for JDK-8356436,
                              but my comment has not yet been approved<br>
                              by a moderator.<br>
                              <br>
                              When in doubt, it’s very helpful to see
                              how others are doing it. In RichTextFX,
                              special CSS properties were introduced,<br>
                              which resulted in a consistent standard
                              for applying CSS styles to all
                              properties—fully aligned with established
                              CSS norms.<br>
                              <br>
                              This is my personal opinion, which, of
                              course, can be wrong.<br>
                              <br>
                              Best regards, Pavel<br>
                              <br>
                              On 5/8/25 20:46, Andy Goryachev wrote:<br>
                              > Adding missing APIs related to
                              styling the highlights with CSS:<br>
                              ><br>
                              > ![Screenshot 2025-05-07 at 15 08 53](<a
href="https://github.com/user-attachments/assets/e37062b4-9804-40a7-872d-830fe0f584c1"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">https://github.com/user-attachments/assets/e37062b4-9804-40a7-872d-830fe0f584c1</a>)<br>
                              ><br>
                              ><br>
                              ><br>
                              > Adds methods to the
                              `RichParagraph.Builder`:<br>
                              ><br>
                              ><br>
                              >          /**<br>
                              >           * Adds a wavy underline
                              (typically used as a spell checker
                              indicator) with the specified style
                              name(s).<br>
                              >           * <p><br>
                              >           * The corresponding styles
                              should define CSS properties applicable to
                              {@link javafx.scene.shape.Path}.<br>
                              >           *<br>
                              >           * @param start the start
                              offset<br>
                              >           * @param length the end
                              offset<br>
                              >           * @param css the style
                              name(s)<br>
                              >           * @return this {@code
                              Builder} instance<br>
                              >           * @since 25<br>
                              >           */<br>
                              >          public Builder
                              addWavyUnderline(int start, int length,
                              String ... css) {<br>
                              ><br>
                              ><br>
                              ><br>
                              >          /**<br>
                              >           * Adds a highlight with the
                              specified style name(s).<br>
                              >           * Use translucent colors to
                              enable multiple highlights in the same
                              region of text.<br>
                              >           * <p><br>
                              >           * The corresponding styles
                              should define CSS properties applicable to
                              {@link javafx.scene.shape.Path}.<br>
                              >           *<br>
                              >           * @param start the start
                              offset<br>
                              >           * @param length the end
                              offset<br>
                              >           * @param css the style
                              name(s)<br>
                              >           * @return this {@code
                              Builder} instance<br>
                              >           * @since 25<br>
                              >           */<br>
                              >          public Builder
                              addHighlight(int start, int length, String
                              ... css) {<br>
                              ><br>
                              ><br>
                              ><br>
                              > Also adding similar methods to the
                              `SimpleViewOnlyStyledModel` class:<br>
                              ><br>
                              ><br>
                              >      /**<br>
                              >       * Adds a highlight of the given
                              color to the specified range within the
                              last paragraph,<br>
                              >       * with the specified style
                              name(s).<br>
                              >       *<br>
                              >       * @param start the start offset<br>
                              >       * @param length the length of
                              the highlight<br>
                              >       * @param css the highlight
                              style name(s)<br>
                              >       * @return this model instance<br>
                              >       * @since 25<br>
                              >       */<br>
                              >      public SimpleViewOnlyStyledModel
                              highlight(int start, int length, String
                              ... css) {<br>
                              ><br>
                              ><br>
                              >      /**<br>
                              >       * Adds a wavy underline
                              (typically used as a spell checker
                              indicator)<br>
                              >       * to the specified range within
                              the last paragraph, with the specified
                              style name(s).<br>
                              >       *<br>
                              >       * @param start the start offset<br>
                              >       * @param length the length of
                              the highlight<br>
                              >       * @param css the highlight
                              style name(s)<br>
                              >       * @return this model instance<br>
                              >       * @since 25<br>
                              >       */<br>
                              >      public SimpleViewOnlyStyledModel
                              addWavyUnderline(int start, int length,
                              String ... css) {<br>
                              ><br>
                              > -------------<br>
                              ><br>
                              > Commit messages:<br>
                              >   - tab<br>
                              >   - css<br>
                              ><br>
                              > Changes: <a
href="https://git.openjdk.org/jfx/pull/1802/files"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">https://git.openjdk.org/jfx/pull/1802/files</a><br>
                              >    Webrev: <a
href="https://webrevs.openjdk.org/?repo=jfx&pr=1802&range=00"
                                moz-do-not-send="true">https://webrevs.openjdk.org/?repo=jfx&pr=1802&range=00</a><br>
                              >    Issue: <a
href="https://bugs.openjdk.org/browse/JDK-8355774"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">https://bugs.openjdk.org/browse/JDK-8355774</a><br>
                              >    Stats: 128 lines in 4 files
                              changed: 110 ins; 8 del; 10 mod<br>
                              >    Patch: <a
href="https://git.openjdk.org/jfx/pull/1802.diff" moz-do-not-send="true"
                                class="moz-txt-link-freetext">https://git.openjdk.org/jfx/pull/1802.diff</a><br>
                              >    Fetch: git fetch <a
                                href="https://git.openjdk.org/jfx.git"
                                moz-do-not-send="true"
                                class="moz-txt-link-freetext">https://git.openjdk.org/jfx.git</a>
                              pull/1802/head:pull/1802<br>
                              ><br>
                              > PR: <a
href="https://git.openjdk.org/jfx/pull/1802" moz-do-not-send="true"
                                class="moz-txt-link-freetext">https://git.openjdk.org/jfx/pull/1802</a></span><o:p></o:p></p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </blockquote>
              <p class="MsoNormal"><span style="font-size:12.0pt"><o:p> </o:p></span></p>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>