-3

I have a text file with this:

  _____ _           ___     _    _ 
 |_   _| |_  ___   / __|_ _(_)__| |
   | | | ' \/ -_) | (_ | '_| / _` |
   |_| |_||_\___|  \___|_| |_\__,_|

When I load the file into a TMemo, it looks like this:

image of result

How can I fix this? Why is it doing this?

I'm using Delphi 10.2.

procedure TFrmMain.FormCreate(Sender: TObject);
begin
  Memo2.Lines.LoadFromFile('C:\Users\user1\Desktop\demo\thegrid.txt');
end;
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Glen M
  • 3
  • 4

1 Answers1

3

You're using a variable-width font to display it, and ASCII art like that only looks right when it's displayed with a fixed-width font.

  • if i change the font , it would also change the look. Is there anyway to to use this font and make it look correct ? – Glen M Mar 08 '19 at 21:49
  • Not without remaking all of the ASCII art to work with that font. – Joseph Sible-Reinstate Monica Mar 08 '19 at 21:50
  • No, there is no way to use a variable width font and make it fixed width, unless you "manually" draw each character at the right spot. But much easier is using a sans-serif fixed width font (like e.g. Consolas, Menlo, Monaco, Lucida Console -- which is what the CSS for the display above uses) to make it look good. – Rudy Velthuis Mar 09 '19 at 18:48