Recent

Author Topic: Some unicode characters do not display on Windows canvas.textout, linux is fine  (Read 311 times)

hansotten

  • Full Member
  • ***
  • Posts: 109
    • The School of Wirth
Trying to display the VT100 Graphic character set.
Having trouble with canvas.textout and unicode characters on Windows, Linux and macOS are fine. Windows shows many as squares and some OK from the same range

Some display fine, some do not. Here screenshots of an example app running on linux (all ok) and Windows (not ok).

 outstr := #$E2#$90#$89;
 Image1.Canvas.TextOut(25, 8, outstr);
 Evaluate shows the the character as expected. But textout sows a square.

What is differnt

Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
var
  outstr : string ;

begin
  Image1.Canvas.Font.Size := 18;
  Image1.Canvas.Font.name := 'Courier new';

  outstr := 'A';
  Image1.Canvas.TextOut(5, 8, outstr);
  outstr := #$E2#$90#$89;
  Image1.Canvas.TextOut(25, 8, outstr);
  outstr :=  #$C2#$B0;
  Image1.Canvas.TextOut(50, 8, outstr);
  outstr := #$E2#$94#$90;
  Image1.Canvas.TextOut(75, 8, outstr);
  outstr := #$E2#$94#$80;  { ─ U+2500 }
  Image1.Canvas.TextOut(100, 8, outstr);

end;   


http://pascal.hansotten.com/ Pascal for Small Machines. The School of Wirth, sources of old Pascal compilers,

paweld

  • Hero Member
  • *****
  • Posts: 1685
It all depends on whether the font in question contains the glyph.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormPaint(Sender: TObject);
  2. const
  3.   sarr: array [0..4] of String = ('A', #$E2#$90#$89, #$C2#$B0, #$E2#$94#$90, #$E2#$94#$80);
  4.   farr: array [0..10] of String = ('Courier', 'Courier New', 'Consolas', 'JetBrains Mono', 'Ubuntu Mono', 'DejaVu Sans Mono', 'Fira Code',
  5.     'Liberation Mono', 'Noto Sans', 'Arial', '@SimSun');
  6. var
  7.   i, j: Integer;
  8. begin
  9.   Canvas.Brush.Color := clWhite;
  10.   Canvas.FillRect(ClientRect);
  11.   for i := 0 to High(farr) do
  12.   begin
  13.     Canvas.Font.Name := farr[i];
  14.     Canvas.Font.Color := clBlack;
  15.     Canvas.Font.Size := 20;
  16.     for j := 0 to High(sarr) do
  17.       Canvas.TextOut(8 + (30 + 8) * j, 8 + (30 + 8) * i, sarr[j]);
  18.     Canvas.Font.Size := 10;
  19.     Canvas.Font.Color := clNavy;
  20.     Canvas.TextOut(8 + (30 + 8) * Length(sarr), 8 + (30 + 8) * i, farr[i]);
  21.   end;
  22. end;        
Best regards / Pozdrawiam
paweld

hansotten

  • Full Member
  • ***
  • Posts: 109
    • The School of Wirth
Thanks!

jetbrains is an improvement. Alas not all DEC Special characters in there either. I will keep on searching.
http://pascal.hansotten.com/ Pascal for Small Machines. The School of Wirth, sources of old Pascal compilers,

dsiders

  • Hero Member
  • *****
  • Posts: 1657
Thanks!

jetbrains is an improvement. Alas not all DEC Special characters in there either. I will keep on searching.

I'll bet DEC VTs knew nothing about any 3-byte UTF-8 characters...

Thaddy

  • Hero Member
  • *****
  • Posts: 19472
  • Glad to be alive.
96. But was one of the first supporting what later became ASCII. 128.
« Last Edit: May 23, 2026, 04:44:39 pm by Thaddy »
Any "programmer" that knows only one programming language is not a programmer

paweld

  • Hero Member
  • *****
  • Posts: 1685
Best regards / Pozdrawiam
paweld

hansotten

  • Full Member
  • ***
  • Posts: 109
    • The School of Wirth
@hansotten - try this font: https://www.dafont.com/dec-terminal-modern.font
Thank you, that is nice font with all I need!
http://pascal.hansotten.com/ Pascal for Small Machines. The School of Wirth, sources of old Pascal compilers,

 

TinyPortal © 2005-2018