Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-12

TMemo question

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

tim launchbury

Hello all

I need to display information in a TMemo, using a custom ttf font. However, the characters I need to display are from 0x20 to 0xff, but it appears that TMemo will only display characters up to 0x7F ( or thereabouts ). Are there any properties I can set to make the extended characters display correctly, or should I use a different widget, and if so which one?

The font I am using is a specialised one for railway applications.

I am using lazarus revision 28797 from svn for i386 in Mandriva linux 2010.1 with gtk2.

Reply by email

tim launchbury

Thanks for the reply Felipe.

I am still puzzled though, because when I was using fpgui, all I needed to do was convert the ansistring to display with the fpgmemo was convert it with ansitoutf8. This does not appear to work with the Lazarus TMemo.

SHould the lcl utf8 conversions work on an ansistring, or will I need to write my own routine?

Regards

Tim

Reply by email

Felipe Monteiro de Carvalho
to tim launchbury

Hello,

You changed the subject of the thread and now gmail shows your last message as the first one in a new thread, so I don't know what you are talking about exactly. Ok, now I remembered it is about the special font issue, but please don't change the subject field.

tim launchbury wrote
I am still puzzled though, because when I was using fpgui, all I needed to do was convert the ansistring to display with the fpgmemo was convert it with ansitoutf8. This does not appear to work with the Lazarus TMemo.

Converting from ansi to utf8 is completely wrong in this case. Do you know that the definition of ansi changes from computer to computer resulting in a different end result if you do the conversion in a russian, chinese, or european computer? Your code simply won't work everywhere in the world.

Maybe, by coincidence, the ISO Latin 1 to UTF-8 conversion could be used. You could try that. There is a conversion function ISO85591ToUTF8 or something similar located in lconvencoding.pas in the LCL.

In general, take a look in the Unicode characters table:

http://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF

I am not 100% sure if the 80 to FF characters correspond to Latin 1. If you are converting from Latin 1 to UTF-8 then the conversion will only work if they do correspond.

SHould the lcl utf8 conversions work on an ansistring, or will I need to write my own routine?

Try converting from Latin 1 to UTF-8 and if it doesn't work write your own routine.

Felipe Monteiro de Carvalho

Reply by email