Sign in Join

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

Mailing lists / lazarus / 2001-05

Special characters under Window$ and XPM

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Sebastian Günther
to Luis R. Hilario: Hello boys! I initiated a new project (is not GPL) for Windows and Linux called "Klinton".
"Luis R. Hilario" wrote 9 lines
1- Special characters: ------------------------- If a string contains a special character does not appear anything. Caption := '� 2001 Luis Digital.'; //� = (C) The exit is equal to: nothing (invisible). The solution that myself went to create a unit that converts some special characters so that they can be read by GTK-Windows.

AFAIK, GTK uses UTF-8 as character encoding on Win32 (on Linux it uses whatever you configured, ISO8859-1 (=the well-known ANSI 8-bit charset) is default). Some information on this can be found here: http://www.freepascal.org/unicode/
(Note: This stuff will get obsolete in the future, when FPC has full Unicode support on its own)

I wrote a small unit which offeres UTF-8 conversion functions as well as UTF-8 versions of Length and StrLen (which count the number of characters, and not the number of bytes, as Length and StrLen would do.) You can get it at the location given above.

- Sebastian

Reply by email

Luis R. Hilario

Hello boys!

I initiated a new project (is not GPL) for Windows and Linux called "Klinton".

Under Linux all always functions well, but under Windows is just the opposite:

1- Special characters:
-------------------------
If a string contains a special character does not appear anything. Caption := '� 2001 Luis Digital.'; //� = (C)
The exit is equal to: nothing (invisible).

The solution that myself went to create a unit that converts some special characters so that they can be read by GTK-Windows.

Example:
...chr(0169): Result := Result + chr(194) + chr(169)  //�

The long one of a string that contains a special character is equal to: size + 1.

Example:
'a���';
Size = 4; special character = 3; Total = 4 + 3;
Under Windows-GTK.

2- The case XPM:
----------------

If an image is saved XPM with StarOffice and is put in a button, all well, but if is put in a window does not appear.

I placed the following code:
  writeln(FPicture[2].Width);
  writeln(FPicture[2].Height);

And the result is:
0
0...

Recommendation: to use The Gimp :)
----------------------------------
Another case xpm:
----------------------------------
Alto := 130;
Ancho := 80;
Canvas.Copyrect(Bounds(255, 6, Alto, Ancho),
FPicture[2].Canvas,

                Rect(0, 0, FPicture[2].Width, FPicture[2].Height));

If the image < "Alto" or "Ancho", the procedure "Paint" is always repeated (under Windows).

Solution:
----------
  Alto  := 130;
  Ancho := 80;
  If FPicture[2].Width < Alto then Alto := FPicture[2].Width;
  If FPicture[2].Height < Ancho then Ancho := FPicture[2].Height;
  Canvas.Copyrect(Bounds(255, 6, Alto, Ancho),
                  FPicture[2].Canvas,
                  Rect(0, 0, FPicture[2].Width, FPicture[2].Height));
|-----------------------------| | Luis R. Hilario | | http://www.luisdigital.2y.net | |-----------------------------| _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

Reply by email

Luis R. Hilario
to Luis R. Hilario
Sebastian G�nther wrote 23 lines
"Luis R. Hilario" wrote: > > 1- Special characters: > ------------------------- > If a string contains a special character does not appear anything. > Caption := '� 2001 Luis Digital.'; //� = (C) > The exit is equal to: nothing (invisible). > > The solution that myself went to create a unit that converts some > special characters so that they can be read by GTK-Windows. AFAIK, GTK uses UTF-8 as character encoding on Win32 (on Linux it uses whatever you configured, ISO8859-1 (=the well-known ANSI 8-bit charset) is default). Some information on this can be found here: http://www.freepascal.org/unicode/ (Note: This stuff will get obsolete in the future, when FPC has full Unicode support on its own) I wrote a small unit which offeres UTF-8 conversion functions as well as UTF-8 versions of Length and StrLen (which count the number of characters, and not the number of bytes, as Length and StrLen would do.) You can get it at the location given above.

Thanks, is genial!

|-----------------------------| | Luis R. Hilario | | http://www.luisdigital.2y.net | |-----------------------------| _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

Reply by email