JavaFX - Inline images in a Textfield/Textarea - user-interface

I'm looking to make a TextArea or TextField but I want the ability for custom emoitcons. There will be key words that the user can type which changes that keyword to an emoticon image in-line.
The more I started thinking about it, the more complicated it seemed. How do you treat images as text? I hope someone out there has an idea.
For example:

-->About Emoji icons
Tutorial on GuiGarage:
http://www.guigarage.com/2015/01/support-emojis/
Because the emojis are defined as unicode chars the can be part of any String or character array that supports unicode. For example in Java the String object supports unicode and therefore a String can contain emoji chars
--> Using Costume Icons
Answer from ItachiUchiha using TextFlow you can add any icon:
How to add an inline image to the end of a string in a TextArea in JavaFX?
-->Using JavaFX RichTextField
https://github.com/TomasMikula/RichTextFX
--> A chat client and Server made in javaFX
https://sourceforge.net/projects/xr3chat/

Related

Is it possible to render zero-width unicode characters as a special replacement character with a custom font?

I'm trying to figure out a way to render certain unicode characters as a custom character instead of how they are supposed to appear.
For example, I would like the character U+0E4A to render as something else rather than how it currently appears in Windows.
I tried to create a quick custom font and to replace those glyphs but it only seems to work in some programs. My font will work correctly in LibreOffice Writer but it won't display properly in WordPad. Replacing regular letters works fine, but for other unicode characters they seem to revert back to a default way of rendering and don't display correctly.
Here is a screenshot of my custom font in WordPad, as you can see I made an obvious edit to the B character but I also did the same to the U+0E4A code point and yet it renders as normal.
If there is a special font that already does this that would probably save me the time of making a custom font, but either way I can't figure out how to render these characters as a custom character.

macOS using html tags in nstextfield

Im wondering is there any ways to make this possible:
I have a nstextfield(or nstextview). And I also have one button, clicking on that should activate Bold mode for selected text, or the text that would written further.
First idea I had - is to use attributes for characters that would be written further, but this idea is not so good, as I would need to save that string in file later. I can save attributed string, but this gives me not proper format, what I would like to see is kind of or smth like that.
If I understand correctly your "First idea" is correct. Within your program you use NSAttributedString to add bold etc. your text. When you wish to save the text you can convert to HTML, or a number of other formats, and reading these formats and converting back to NSAttributed is also supported. A good place to start is Formatted Documents and Attributed Strings.

Unity3D Input Field shows "????????"

I am writing a game for Kazakhstan, but Kazakh symbols do not show in UI element InputField.
Did somebody face the problem and can help me?
An UI_InputField element is an element that allows the user to interact writing some text. InputField will set that text into a UI_Text component.
The UI_Text component supports UTF and you can set different fonts to that UI_Text component. Now in order to display correctly your Kazakh symbols the Font that is assigned to the UI_Text component should be able to support those characters.
So the first question is, what font are you using in your UI_Text component?
Here if I get some characters from Kazakh_alphabets and I put them in a TextField/Text using Arial as font.
I got this:

Convert string automatically to inline image

I'm using InDesign's data merge to generate playing cards for my game. Is it possible to convert a specific string to an inline image?
"You may roll :red_die: and add the rolled valued to this card's value"
For example the :red_die: in the text above would be automatically converted to an inline icon of a red coloured die.
No you can't this way. But you can place images with datamerge to the condition some fields of your source is set as an image one meaning having a "#" prefix. InDesign will process fields like #image as an image to place. It's up to you to add such a field in your source. However you can't nest it within another datamerge tag so it may not work eventually.
Other solution is using F/C dialog to replace :red_die: with clipboard content (your image) or to use scripting. You may also consider variable content plugin like EasyCatalog.

Implementing Emoticon in windows store chat

I am developing a Windows Store chat app.
In this apps, I am using a TextBox to receive message content from the user. I want to implement Emoticons (Smileys) such that typing a code gives a respective image inline with the text.
For example, for :), I want to have a 'smile' image.
What you'll need to do is use a RichTextBlock to display your text. This will give you access to a adding in an InlineUIContainer block where necessary.
So, your process will be:
Accept text in a regular text box
Parse the text into a series of Inlines (Run, InlineUIContainer, etc)
Create a new Paragraph for the message
Add the Inliness to the Paragraph.
Add the Paragraph to your RichTextBlock's Blocks property (a BlockCollection).
For each piece of text:
Split the text, likely using Regex, searching for the keys which trigger an Image (':)', '(heart)', etc).
For each non-image text, create a Run with the Text set to the text of the split
For each Image, create an InlineUIContainer and an Image. Set the Image source to the proper Image path, then set the Child of the InlineUIContainer to the Image.
Add the Run or InlineUIContainer the Paragraph via Paragraph.Blocks.Add(Inline).
Certain icons may be included in the Segoe UI Symbol Font Family. If this is the case, you may choose to not use an Image for that symbol, and instead use a Run with the FontFamily set to Segoe UI Symbol. You can play around with the FontSize if you want them to be more prominent.
Hope this helps and happy coding!

Resources