RTF Text on TRichEdit - Delphi 2010 - delphi

Good morning all.
I have a question about handle of TRichEdit.
In a TRichEdit I have a text with several riched formats (Bold, Italic, Underline) like this:
Can I have the possibility of know the style of each character in the Edit, for instance, the first 's' has no format, the first 'r' has a bold format, the second 'a' has italic format, and the fourth 'a' has underline format?
The purpose of this question is for convert this text to HTML tags. I tried many functions on Internet and no one works for me.
I appreciate your help so much.

Related

CTRunGetAdvances doesn't return zero for Arabic diacritics

I'm trying to draw Arabic glyphs manually on iOS, and I've stumbled upon a specific problem regarding Arabic diacritics. When trying to get the advance of the glyph with CTRunGetAdvances, I expect to get a width of value 0, but I get a value like with any other character. Is there something I'm missing?
When I say Arabic diacritics, I mean characters on this list with hexadecimal values ranging from FE70 to FE7F (inclusive). One example is ﹰ Arabic Fathatan Isolated Form.
I should mention that I do not know Arabic well and may be overseeing something that is obvious to a native Arab. Any suggestions are welcome.

FMX: How to deal with strings containing right to left languages?

I have a unicode string that could contain characters from a right to left language such as Arabic or Hebrew, but could also contain text from left to right languages. I need to be able to know at which end is the start and in which direction to step when stepping through the string from beginning to end depending on which language is in the string. Is there a standard way of dealing with this?
TMemo appears to handle this in the way I want. I paste some hebrew text into a TMemo and the direction that the caret moves is the reverse of the arrow keys I use. I can even have a mixture of english and hebrew text in the same memo and the direction the caret moves will depend on whether it's within an english or hebrew section of text. I'd like to replicate this behaviour. I attempted to look into the Delphi code including FMX.Memo and FMX.Text, but couldn't find the code responsible. I have a feeling that the code for handling this may be hidden in a dll. I could write code myself that contains a list of all possible right to left unicode characters to test if a character is RTL or LTR, but I'd like to make use of code that already exists if possible. Can anyone point me in the right direction?
I do know about the unicode RLM mark, which is an invisible character used to mark a section of RTL text, but I don't think this is being used by TMemo. The hebrew text I'm pasting into the TMemo doesn't contain this or any other invisible character.

How to underline words after spell check using Delphi

I'm trying to develop a text editor with spell checker capability. I can detect erroneous words successfully.
Many text editors underline (red color) the erroneous words like this.
How can I underline any word this way? Any TMemo, TRichEdit or TSynEdit solution is acceptable.

How to apply bold + italic rich text formatting in XLIFF

I see that XLIFF specification allows applying rich text formatting, and it even provides examples using xlf:b (bold) and xlf:i (italic). So that it can be used like this:
<source>A line of text in<pc type="fmt" subType="xlf:b">paragraph</pc>.</source>
What I can't find is how to correctly apply both bold and italic at the same time?
Any help greatly appeciated.

How to display Greek symbols in a TMenuOption

In Delphi 2010, I want to display the Greek symbols (alpha, beta, etc.) in TMenuOption and other types of VCL controls.
Assigning
TEdit.Text or TMenuItem.Caption := 'Hydrogen ' + chr(945) + ' More Text'
seems to work fine.
I'm worried that this might won't work on all machines. TEdit has a font property, TMenuItem doesn't, so I'm guessing it uses some default system font.
Should chr(945) always show as the Greek alpha character regardless of font? If not, is there some way for me to assure that the chr(945) always appears on the screen as the alpha character other than hard-wiring the font (which would be tough to do for the system font...)
TIA
You can also use constants. The source files are unicode too so you can add any kind of constant. Just remember to save the source as unicode.
const
alpha = 'α';
beta = 'β';
gamma = 'γ';
Since Delphi 2010 is unicode, chr(945) always point to the same character, in this case Greek Alpha. This character will display correctly if the font that is used to draw the menu item contains that character. There is no risk of another character being drawn, except maybe for the question mark, which is usually used by Windows if a font doesn't contain a specific character.
Most Windows fonts do contain common unicode characters (including Greek). The user might however be able to select a different font that doesn't. You can draw the menu yourself using a different font that is installed on the system, but this might be an awful lot of work for something that will normally work out of the box.

Resources