Simon H5285

Member since: Tuesday, 28 April 2015
Last login: 8 months ago
Profile viewed: 443 views

No Rank
Points: 0

Simon H5285 replied to the topic 'Unicode symbols in colour' in the forum. 8 months ago

I have found the anbswer to my own question

The short answer is include D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT when calling the Direct2D DrawText() or DrawTextLayout() function, which is not [yet] implemented in FireMonkey.

The long answer is......

Remy's answer is part of the jigsaw: the render has to be instructed to select the colour graphic for those Unicode code points whose variation selectors define them as Emojis.

It is routine to use a different font for Emoji colour graphics. For example Calibri font might be chosen by the user, but Segoe UI Emoji font used to render the colour Emojis.

Windows can render colour Emojis using DirectWrite, Direct2D and Win2D but not GDI. Micropsoft explain here .

To do it in Direct2D include D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT when calling DrawText() or DrawTextLayout(). I think this is all that is necessary and Windows does the font substitution automatically.

For DirectWrite the programmer has to do the Emoji detection and font substitution. So more control at the expense of more code.

Any cross-platform implementation would have to repeat the above for every platform.

As mentioned in the short answer it is not [yet] implemented in FireMonkey, but would be a cool feature for Delphi to have.

Thanks to Roger, Emailx45 and Remy for their contributions.

As for the way forward for my current requirement (if anyone is interested). I will display conventional images (not text characters) in a TImage adjacent to a TLabel containing the conventional text. Some other situations where it would be nice to display colour Emoji my clients will have to accept monochrome for the time being.


Simon H5285 replied to the topic 'Unicode symbols in colour' in the forum. 8 months ago


I have asked Remy.

The Stack Overflow thread that you refer to answers how to write a multi-byte Unicode character into a Delphi string. Although the thread starter is using an Emoji character as his example, the thread does not address my question which is how to display the Unicode graphic instead of the the Unicode glyph.


Simon H5285 replied to the topic 'Unicode symbols in colour' in the forum. 8 months ago

Thanks for replying Roger. That Unicode is a monochrome symbol system only is not strictly true. Unicode technical standard #51 ( ) says "Emoji may be represented internally as graphics or they may be represented by normal glyphs encoded in fonts like other characters." The properties of U+26D4 ( ) include "Emoji", "Emoji Presentation" and "Extended Pictographic" all set to Yes. Which of these properties is strictly relevant I am not sure, but it means that this Unicode code point can be displayed either as a normal monochrone glyphs or as a multi-colour graphics which would ignore the font colour. Browsers automatically use the graphic version, and there is HTML available to specify the glyph version should be author require it. These graphics are available on all computers. My question is how can they be displayed in a Delphi application?


Simon H5285 created a new topic ' Unicode symbols in colour' in the forum. 8 months ago

If these characters ⛔ ✔ ❓ ❌ ❗ ⚠ ℹ  are output in a browser on One note they display in colour. But if they are output in Word or Delphi FireMonkey Memo they display in monochrome. See the attached combined screenshots. I have read that font Segoe UI Emoji needs to be used, but that does not seem to make any difference.

How can unicode symbols be displayed in a Delphi app in their color representation as they do in a browser?


Simon H5285 created a new topic ' Unicode Emoji' in the forum. 8 months ago

Displaying the following string of unicode characters
⛔ ✔ ❓ ❌ ❗ ⚠ ℹ 
#$26d4 + ' ' + #$2714 + ' ' + #$2753 + ' ' + #$274C + ' ' + #$2757 + ' ' + #$26A0 + ' ' + #$2139 + ' ' + #$1F6C8

Display is colour in a browser and in One Note, but display in monochrome in Word and Delphi Firemonkey memo. In both Word and DelphiI have tried Arial, Sergoe UI Emoji and various other fonts (in Word i tried all fonts installed), but all display in monochrome. Attached is a combined screenshot of the results.

How can colour display of these symbols be achieved in Delphi?


As everyone uses this as an opportunity to raise the profile of their own needs, ours is TCanvas in Linux and Windows server apps so images can be dynamically constructed and fonts measured, please.Uninstall, reinstall Delphi then reinstall a dozen o