Font mapping of unicode characters greater than 0xFFFF into the 16bit range of EmWi fonts

155 views
asked Sep 4, 2018 in Embedded Wizard Studio by jwi
Dear EmWi-Support,

I have the requirement to include emoticons within the fonts used inside my gui. For this I am using the NotoEmoji-Regular.ttf font with its emoticons lying at the range of 0x1F600-0x1F64F. Currently I have to manually edit the true type font. Is their any possibility to extend the font ranges to allow mapping from characters greater 16bit into the 16bit range?

1 Answer

0 votes
answered Sep 4, 2018 by Paul Banach
 
Best answer

Hello,

addressing font glyphs beyond 16-bit (code point 65535) is actually not possible. I would suggest following two approaches:

Aproach 1: Create your own font

By using a font editor you can copy the desired glyphs and store them in a new font file (TTF file) at code points below 65535. Then you can use this font in Embedded Wizard. To address the glyphs you have to use the code points as defined in the new font.

Approach 2: Store the Emojis in a multi-frame bitmap.

- By using a graphic editor (e.g. Photoshop) create a PNG containing all your desired emojis as small black/white (inverted with white as foreground) images arranged in equally sized rows and/or columns. Ensure that all emojis has the same size (the cells are equal).

- Store the bitmap in the format PNG and add it as a new bitmap resource to your Embedded Wizard project.

- Ensure the bitmap resourse is configured as an ALPHA8 bitmap. See also the attribute AlphaName.

- Configure the affected bitmap resource to be multi-frame with the frame size corresponding to the size of a single cell containing a single emoji.

Then you can display the emojis by using an Image view. To select the right emoji you specify in the Image view its corresponding frame number as it is stored in the bitmap. Since the bitmap is configured as ALPHA8 you can determine the color to colorize the emoji dynamically at the runtime.

With this approach if you want the emojis to be displayed with normal text, use the Attributed Text view instead of the Image view. With the Attributed Text you can specify the text and combine it with bitmap resources. See also Display a bitmap within the text.

I hope it helps you further

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...