Andy,

I noticed another missing feature. The OS IME may also set text attributes
such as font and color.

When reporting the IME back to JavaFX it should support setting text
attributes. It looks like it was planned, but not yet implemented.

I think it would go in InputMethodTextRun.java, that is set by
GlassViewEventHandler.java.

On linux it comes from:
https://docs.gtk.org/gtk3/method.IMContext.get_preedit_string.html

This function returns the pango attributes that should be reported back to
javafx.

That would go nicely on a rich text control.

It also looks the IME event could be more explicit:

 inputMethodEventComposed(
            String text, int commitCount, int[] clauseBoundary, int[]
attrBoundary, byte[] attrValue)

Those arrays are very confusing.

-- Thiago


Em sex., 9 de jun. de 2023 às 12:49, Andy Goryachev <
andy.goryac...@oracle.com> escreveu:

> Thiago:
>
>
>
> The IME support is in the plans, so thank you for the info.  I am not
> there yet, but at least I can ask one question regarding the "surrounding"
> feature: how much text does it expect from the control?  Is one line or
> paragraph enough?
>
>
>
> Let me ask another question: is the current IME support in
> TextArea/TextField adequate?
>
>
>
> Thank you
>
> -andy
>
>
>
>
>
>
>
>
>
> *From: *Thiago Milczarek Sayão <thiago.sa...@gmail.com>
> *Date: *Friday, June 9, 2023 at 03:54
> *To: *Andy Goryachev <andy.goryac...@oracle.com>, openjfx-dev <
> openjfx-dev@openjdk.org>
> *Subject: *[External] : Text Surrounding
>
> Hi Andy,
>
>
>
> I understand you're working on a Rich Text control.
>
>
>
> While working on IME (Input Method Editor) for Linux, I noticed that there
> is a feature called "surrounding"
>
> that it supports to give the IME information about the text being
> inputted. More info here:
>
>
>
> https://docs.gtk.org/gtk3/class.IMContext.html
> <https://urldefense.com/v3/__https:/docs.gtk.org/gtk3/class.IMContext.html__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2HOZmTlw$>
>
>
>
> It works like this:
>
>
>
> When user is typing using an IME language, the underlying IME (for example
> https://github.com/tlwg/ibus-libthai
> <https://urldefense.com/v3/__https:/github.com/tlwg/ibus-libthai__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2kBsHxAM$>
> )
>
> may ask the Toolkit for the surrounding text and it should reply with:
>
>
>
> https://docs.gtk.org/gtk3/method.IMContext.set_surrounding.html
> <https://urldefense.com/v3/__https:/docs.gtk.org/gtk3/method.IMContext.set_surrounding.html__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2cQl7mM8$>
>
>
>
> That contains:
>
> - The text
>
> - The length
>
> - The cursor position within the text
>
>
>
> So this way the underlying IME can provide accurate suggestions using the
> user context.
>
>
>
> That would be a nice feature to have but it requires some work to retrieve
> it from the text-based control.
>
>
>
> Just letting you know about this, it may be out of the scope of your rich
> text work for now.
>
>
>
> -- Thiago.
>

Reply via email to