Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
FV/Textmode IDE
(Moderators:
FPK
,
Tomas Hajny
) »
Draw ANSI/ASCII art in terminal support and suggestions wanted.
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Struggling with Orthello/...
by
Dzandaa
[
Today
at 11:48:43 am]
fpsockets error: 10047
by
senglit
[
Today
at 11:27:07 am]
Avoid system units debugg...
by
Martin_fr
[
Today
at 11:19:37 am]
[SOLVED] progress dialog ...
by
Phoenix
[
Today
at 11:14:23 am]
Hello everyone!
by
MarsvinEvini
[
Today
at 10:22:00 am]
Notetask 1.1.0 - Free cro...
by
AlexanderT
[
Today
at 10:05:28 am]
I cannot save an unit on ...
by
Zvoni
[
Today
at 09:06:05 am]
Mapping Images Like Odome...
by
circular
[
Today
at 08:58:33 am]
Matching video to form
by
paweld
[
Today
at 08:44:46 am]
Introducing PasBuild 1.0....
by
Thaddy
[
Today
at 08:16:53 am]
Form adjusting to screen ...
by
RickSpink
[
Today
at 08:11:59 am]
Amigo programming languag...
by
paxscript
[
Today
at 04:06:34 am]
Feature better than a new...
by
TBMan
[
Today
at 03:56:13 am]
Any way to exclude terms ...
by
n7800
[
Today
at 12:59:05 am]
Just Curious: When has an...
by
n7800
[
Today
at 12:15:00 am]
Detect orphaned procedure...
by
Martin_fr
[December 09, 2025, 11:37:51 pm]
modern main menu
by
n7800
[December 09, 2025, 10:23:04 pm]
Is FPGUI still active?
by
Fred vS
[December 09, 2025, 09:29:08 pm]
Lazarus Bugfix Release 4...
by
Martin_fr
[December 09, 2025, 08:35:41 pm]
Hints in TTrayIcon
by
avra
[December 09, 2025, 07:01:02 pm]
Problem with TSQLQuery
by
sch61
[December 09, 2025, 05:15:38 pm]
What are some good modern...
by
sanric
[December 09, 2025, 04:46:09 pm]
First PythonForLazarus De...
by
fozkan
[December 09, 2025, 04:20:56 pm]
problem with zquery
by
Gebo
[December 09, 2025, 02:59:47 pm]
مشكلة في تنفيذ كودsql مع ...
by
Gebo
[December 09, 2025, 02:01:19 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Draw ANSI/ASCII art in terminal support and suggestions wanted. (Read 3905 times)
d-_-b
New Member
Posts: 48
Draw ANSI/ASCII art in terminal support and suggestions wanted.
«
on:
April 18, 2020, 09:06:33 pm »
Hi,
I hope someone can point me to some general pascal libraries to draw ascii art border like in this examples i found on the forum?
I also tested the Unicode support on windows 10 using dos, ubuntu wsl console, and mobaxterm.
Unfortunately only mobaxterm is rendering correctly.
Code: Pascal
[Select]
[+]
[-]
program
project1
;
{$mode objfpc}{$H+}
{$APPTYPE CONSOLE}
uses
{$IFDEF WINDOWS}
Windows
,
{for setconsoleoutputcp}
{$ENDIF}
Classes
;
const
// ANSI table drawing chars
tdTopLeft
=
#27
'(0l'
#27
'(B'
;
// ┌
tdTopCenter
=
#27
'(0w'
#27
'(B'
;
// ┬
tdTopRight
=
#27
'(0k'
#27
'(B'
;
// ┐
tdMidLeft
=
#27
'(0t'
#27
'(B'
;
// ├
tdMidCenter
=
#27
'(0n'
#27
'(B'
;
// ┼
tdMidRight
=
#27
'(0u'
#27
'(B'
;
// ┤
tdBottomLeft
=
#27
'(0m'
#27
'(B'
;
// └
tdBottomCenter
=
#27
'(0v'
#27
'(B'
;
// ┴
tdBottomRight
=
#27
'(0j'
#27
'(B'
;
// ┘
tdHorzLine
=
#27
'(0q'
#27
'(B'
;
// ─
tdVertLine
=
#27
'(0x'
#27
'(B'
;
// │
var
i
:
byte
;
s
:
string
;
ch
:
Char
;
begin
{$IFDEF WINDOWS}
SetConsoleOutputCP
(
CP_UTF8
)
;
{$ENDIF}
// thanks wp, https://f...content-available-to-author-only...l.org/index.php/topic,36945.msg246843.html#msg246843
WriteLn
(
'┌──────────────────────┐'
)
;
WriteLn
(
'│ Text in a box │'
)
;
WriteLn
(
'╘══════════════════════╛'
)
;
WriteLn
;
i
:
=
0
;
for
ch
:
=
#32
to
#255
do
begin
Write
(
ch
,
' '
)
;
inc
(
i
)
;
if
i
mod
16
=
0
then
WriteLn
;
end
;
WriteLn
;
WriteLn
(
' 1 '
)
;
WriteLn
(
' ⌠ '
)
;
WriteLn
(
' │ 2 x dx = 1'
)
;
WriteLn
(
' ⌡ '
)
;
WriteLn
(
' 0 '
)
;
WriteLn
;
WriteLn
(
' __'
)
;
WriteLn
(
'√ 2 = '
,
sqrt
(
2
)
)
;
WriteLn
;
// thanks wp, https://f...content-available-to-author-only...l.org/index.php/topic,38910.msg265726.html#msg265726
// Use Unicode range "Box Drawing" in Lazarus' character map
WriteLn
(
'┏━━┓ ┏━━┓'
)
;
WriteLn
(
'┛ ┗━━┛ ┗'
)
;
WriteLn
;
// Thanks Mr Bee aka @pak_lebah, from ansicrt.pas unit
for
i
:
=
1
to
10
do
s
:
=
s
+
tdHorzLine
;
WriteLn
(
tdTopLeft
+
s
+
tdTopRight
)
;
ReadLn
;
end
.
~
Code In Online Pascal Compiler
Logged
Code: Pascal
[Select]
[+]
[-]
mov ax
,
0013h
int 10h
Denthor thanks for the vga programming tutorials
|
Download all tutorials
marcov
Administrator
Hero Member
Posts: 12566
FPC developer.
Re: Draw ANSI/ASCII art in terminal support and suggestions wanted.
«
Reply #1 on:
April 18, 2020, 09:47:23 pm »
Ansi escape sequences are not very portable, nor universal. Sometimes they need addtional drivers or configuration for emulation purposes.
Here on windows everything but the last for loop seems to be ok.
Logged
winni
Hero Member
Posts: 3197
Re: Draw ANSI/ASCII art in terminal support and suggestions wanted.
«
Reply #2 on:
April 18, 2020, 10:17:04 pm »
Hi!
You are playing around with code from the 80s.
Nearly all terminals use Unicode and not the IBM 8 Bit with the semi graphik frames - like Turbo Pascal did.
For example:
╔
is UTF8 Codepoint U2554
The codeblock in the UTF table is called
Box Drawing
and is from
U2500 .. U257F
Have a look at the UTF8 table:
https://www.utf8-chartable.de/unicode-utf8-table.pl
Winni
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
FV/Textmode IDE
(Moderators:
FPK
,
Tomas Hajny
) »
Draw ANSI/ASCII art in terminal support and suggestions wanted.
TinyPortal
© 2005-2018