When I was experimenting with a program to generate titles for videos the ability to control the spacing between letters (not kerning, but tracking) would have been helpful. E.g. animating something like this: Title T i t l e T i t l e T i t l e I don't recall everything I encountered in that project, but I believe all the basic font metrics about baseline and ascenders/descenders would help.
A FontChooser would be useful. Applications can always code their own, but the same can be said for ColorPicker. It doesn't look like there is one available even from 3rd-party libraries like ControlsFX. Going from a Font object to CSS -fx-font-size, -fx-font-family, -fx- font-weight, -fx-font-style doesn't always work as I've already mentioned. The Font object doesn't have a method to get the font weight and there is no -fx-font-name style. Setting -fx-font-family doesn't always result in CSS that successfully selects the desired font if used in combination with -fx-font-style and/or -fx-font-weight. Sometimes adding CSS for weight or style will cause a completely different family to be used which can look quite drastic when a variable width font is substituted for a fixed-width font just because you tried to make something bold. Also FontPosture only has ITALIC and NORMAL, but CSS -fx-font-style has 'normal', 'italic' and 'oblique' - There is no way to ask for 'oblique' from code and the FontStyleConverter will convert "oblique" to REGULAR, even though "oblique" works in CSS to get a slanted font. Asking about caretBlinkRate, I'm not sure. I imagine only one caret should ever be visible, with the exception of a rich text control that supports multiple simultaneous insertion points, like many code editors. In that case there would still only be one rate at a time even though there are multiple carets. My point being there should never be a need for multiple rates to be active at the same time, so maybe you could get away with a global rate. I can't think of a need for multiple rates, but maybe someone else can. Regards, Scott On Fri, Jan 27, 2023 at 12:31 PM Andy Goryachev <[email protected]> wrote: > > More control of kerning and general spacing might be nice. > > > > What properties, besides kerning, are you referring to? > > > > Also, a question for the wider audience: is there a need to have > caretBlinkRate property for each control, or a single global one would > suffice? In other words, are there use cases when two or more controls > might need a different blink rate? > > > > Thank you. > > > > -andy > > > > > > *From: *openjfx-dev <[email protected]> on behalf of Scott > Palmer <[email protected]> > *Date: *Thursday, January 26, 2023 at 12:33 > *To: *openjfx-dev <[email protected]> > *Subject: *Re: Q: missing APIs needed for implementation of a rich text > control > > [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 <[email protected]> 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 <[email protected]> > 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 > > > >
