Lazarus

Programming => Operating Systems => Android => Topic started by: Alcatiz on June 18, 2025, 11:36:29 am

Title: [SOLVED] LAMW - UTF-8 character in jTextView
Post by: Alcatiz on June 18, 2025, 11:36:29 am
Hi all!

I'm trying to display a UTF-8 character in a jTextView control:
Code: Pascal  [Select][+][-]
  1. TextView1.Text := #9786;
I'm using a jTextView to display a counter, and when the counter reaches 0 a smiley is directly displayed in place of the numbers.

In any classical Windows or Linux application using TLabel it displays a smiley, but in my Android app it doesn't work, only a '?' is displayed. Any idea on who to do it?
Title: Re: LAMW - UTF-8 character in jTextView
Post by: dinglerod on June 20, 2025, 05:26:27 am
It looks like your font is missing that glyph.
Title: Re: LAMW - UTF-8 character in jTextView
Post by: Alcatiz on June 20, 2025, 05:08:51 pm
Thanks for your reply, you're certainly right. I didn't know it was possible to use a particular font, until I found some code in one of the demos.
So I could solve the problem using a web font stored in the Assets directory:
Code: Pascal  [Select][+][-]
  1. TextView1.SetFontFromAssets('materialdesignicons-webfont.ttf');
  2. TextView1.Text := Self.ParseHtmlFontAwesome('F2E7');   (* Smiley *)
TinyPortal © 2005-2018