Q: missing APIs needed for implementation of a rich text control

Philip Race philip.race at oracle.com
Thu Jan 26 20:45:04 UTC 2023


Many of the items below (meaning excluding the caret features and app 
control of line spacing) are on my list of
things to work on.

phil

On 1/26/23 12:33 PM, Scott Palmer wrote:
> [dupe of private message, now including the mailing list]
>
> I've been using RichTextFX to make my own code editor/IDE.  I see that 
> you have asked that project specifically on GitHub, excellent.
> One thing that I wanted to do was to use a font like Fira Code that 
> combines characters such as != or >= into a single glyph, but there 
> are no APIs to request that JavaFX render those optional ligatures. 
> Swing APIs automatically do. In fact just implementing some basic font 
> selection has been tedious.  Getting the font family from a Font 
> object and trying to use it in CSS to specify -fx-font-family simply 
> doesn't work sometimes.  Trying to filter the list of available fonts 
> to show only those that are fixed-width is tedious.  I tried to hack 
> something by measuring a couple different characters from the font 
> that would normally be different widths, but this is an unreliable 
> hack. Allowing the user to choose a preferred font and then 
> configuring components to use it via a CSS stylesheet is simply more 
> difficult than it should be.
> A few years ago I contributed the changes to make the tab-width 
> configurable, which helped with my project a little bit.  Other APIs 
> are needed to better control line spacing and measure font baseline 
> offsets and that sort of thing.  I see there is an issue for 
> caretBlinkRate, what about changing the caret shape? E.g. block, 
> underscore, vertical bar, etc.   Should the block be solid or an 
> outline? Why is caretShape read-only? Why does it return an array of 
> PathElements instead of simply a Shape which by default would be a 
> Path?  More control of kerning and general spacing might be nice. I've 
> wanted that in the past, not for a rich text control, but for doing 
> video titles.  I can see how the two needs overlap though.  I recently 
> asked here about rendering emojis.  That's currently very unreliable 
> and broken.  Getting something to work consistently cross-platform is 
> not easy.  Sometimes emojis are rendered in color, other times not.  
> Mac renders color emojis in gray and at the wrong size (since  the 
> sub-pixel rendering was turned off to match macOS).  On Windows the 
> emojis are never in color.
>
> Regards,
>
> Scott
>
> On Wed, Jan 25, 2023 at 10:41 PM Scott Palmer <swpalmer at gmail.com> wrote:
>
>     I've been using RichTextFX to make my own code editor/IDE.  I see
>     that you have asked that project specifically on GitHub, excellent.
>     One thing that I wanted to do was to use a font like Fira Code
>     that combines characters such as != or >= into a single glyph, but
>     there are no APIs to request that JavaFX render those optional
>     ligatures. Swing APIs automatically do.  In fact just implementing
>     some basic font selection has been tedious.  Getting the font
>     family from a Font object and trying to use it in CSS to specify
>     -fx-font-family simply doesn't work sometimes.  Trying to filter
>     the list of available fonts to show only those that are
>     fixed-width is tedious.  I tried to hack something by measuring a
>     couple different characters from the font that would normally be
>     different widths, but this is an unreliable hack. Allowing the
>     user to choose a preferred font and then configuring components to
>     use it via a CSS stylesheet is simply more difficult than it
>     should be.
>     A few years ago I contributed the changes to make the tab-width
>     configurable, which helped with my project a little bit.  Other
>     APIs are needed to better control line spacing and measure font
>     baseline offsets and that sort of thing.  I see there is an issue
>     for caretBlinkRate, what about changing the caret shape? E.g.
>     block, underscore, vertical bar, etc.   Should the block be solid
>     or an outline? Why is caretShape read-only? Why does it return an
>     array of PathElements instead of simply a Shape which by
>     default would be a Path?  More control of kerning and general
>     spacing might be nice. I've wanted that in the past, not for a
>     rich text control, but for doing video title.  I can see how the
>     two needs overlap though.  I recently asked here about rendering
>     emojis.  That's currently very unreliable and broken.  Getting
>     something to work consistently cross-platform is not easy. 
>     Sometimes emojis are rendered in color, other times not.  Mac
>     renders color emojis in gray and at the wrong size (since  the
>     sub-pixel rendering was turned off to match macOS).  On Windows
>     the emojis are never in color.
>
>     Regards,
>
>     Scott
>
>     On Wed, Jan 25, 2023 at 5:38 PM Andy Goryachev
>     <andy.goryachev at oracle.com> wrote:
>
>         Dear colleagues:
>
>         I am trying to identify missing public APIs needed to support
>         a rich text control.  There is a number of tickets created
>         already against various parts of JavaFX, collected in
>         https://bugs.openjdk.org/browse/JDK-8300569 , though I suspect
>         this list may not be complete.
>
>         If anyone has any suggestions or requests related to the new
>         APIs, I would be very interested to learn the context, the
>         reason these APIs are needed, and whether a workaround exists.
>
>         Thank you in advance.
>
>         Cheers,
>
>         -andy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230126/08389827/attachment.htm>


More information about the openjfx-dev mailing list