<div dir="ltr">Andy,<div><br></div><div>I noticed another missing feature. The OS IME may also set text attributes such as font and color.</div><div><br></div><div>When reporting the IME back to JavaFX it should support setting text attributes. It looks like it was planned, but not yet implemented.</div><div><br></div><div>I think it would go in InputMethodTextRun.java, that is set by <span style="background-color:rgb(246,248,250);color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px">GlassViewEventHandler.java.</span></div><div><span style="background-color:rgb(246,248,250);color:rgb(31,35,40);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;font-weight:600"><br></span></div><div>On linux it comes from:</div><div><a href="https://docs.gtk.org/gtk3/method.IMContext.get_preedit_string.html">https://docs.gtk.org/gtk3/method.IMContext.get_preedit_string.html</a><br></div><div><br></div><div>This function returns the pango attributes that should be reported back to javafx.</div><div><br></div><div>That would go nicely on a rich text control.</div><div><br></div><div>It also looks the IME event could be more explicit:</div><div><br></div><div> inputMethodEventComposed(<br> String text, int commitCount, int[] clauseBoundary, int[] attrBoundary, byte[] attrValue)<br></div><div><br></div><div>Those arrays are very confusing.</div><div><br></div><div>-- Thiago</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em sex., 9 de jun. de 2023 às 12:49, Andy Goryachev <<a href="mailto:andy.goryachev@oracle.com">andy.goryachev@oracle.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-6792468816908579743">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_-2071613008098081184WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New"">Thiago:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New"">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?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New"">Let me ask another question: is the current IME support in TextArea/TextField adequate?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New"">Thank you<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New"">-andy<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Courier New""><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black">Thiago Milczarek Sayão <<a href="mailto:thiago.sayao@gmail.com" target="_blank">thiago.sayao@gmail.com</a>><br>
<b>Date: </b>Friday, June 9, 2023 at 03:54<br>
<b>To: </b>Andy Goryachev <<a href="mailto:andy.goryachev@oracle.com" target="_blank">andy.goryachev@oracle.com</a>>, openjfx-dev <<a href="mailto:openjfx-dev@openjdk.org" target="_blank">openjfx-dev@openjdk.org</a>><br>
<b>Subject: </b>[External] : Text Surrounding<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Hi Andy,<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I understand you're working on a Rich Text control.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">While working on IME (Input Method Editor) for Linux, I noticed that there is a feature called "surrounding"<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">that it supports to give the IME information about the text being inputted. More info here:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><a href="https://urldefense.com/v3/__https:/docs.gtk.org/gtk3/class.IMContext.html__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2HOZmTlw$" target="_blank">https://docs.gtk.org/gtk3/class.IMContext.html</a><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">It works like this:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">When user is typing using an IME language, the underlying IME (for example <a href="https://urldefense.com/v3/__https:/github.com/tlwg/ibus-libthai__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2kBsHxAM$" target="_blank">https://github.com/tlwg/ibus-libthai</a>)<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">may ask the Toolkit for the surrounding text and it should reply with:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><a href="https://urldefense.com/v3/__https:/docs.gtk.org/gtk3/method.IMContext.set_surrounding.html__;!!ACWV5N9M2RV99hQ!IZFccRhWV8XWX4vpnBQktz-QE8YML3x-k5Spp9j9U2eFPTiD1MD3AeFXgMNL-MbNntUDEwa_uaQwdVzf0Sc2cQl7mM8$" target="_blank">https://docs.gtk.org/gtk3/method.IMContext.set_surrounding.html</a><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">That contains:<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">- The text<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">- The length<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">- The cursor position within the text<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">So this way the underlying IME can provide accurate suggestions using the user context.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">That would be a nice feature to have but it requires some work to retrieve it from the text-based control.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Just letting you know about this, it may be out of the scope of your rich text work for now.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-- Thiago.<u></u><u></u></span></p>
</div>
</div>
</div>
</div>
</div></blockquote></div>