comp.lang.ada
 help / color / mirror / Atom feed
* Bold text (in terminal) from Ada?
@ 2022-10-11  8:06 reinert
  2022-10-11  8:43 ` Jeffrey R.Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: reinert @ 2022-10-11  8:06 UTC (permalink / raw)


Any simple way to print out bold text from an Ada program?
In case, how?

Assume linux.

reinert

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bold text (in terminal) from Ada?
  2022-10-11  8:06 Bold text (in terminal) from Ada? reinert
@ 2022-10-11  8:43 ` Jeffrey R.Carter
  2022-10-11  8:49 ` Niklas Holsti
  2022-10-12  0:11 ` Stephen Leake
  2 siblings, 0 replies; 7+ messages in thread
From: Jeffrey R.Carter @ 2022-10-11  8:43 UTC (permalink / raw)


On 2022-10-11 10:06, reinert wrote:
> Any simple way to print out bold text from an Ada program?
> In case, how?
> 
> Assume linux.

Looking at PragmARC.Ansi_Tty_Control 
(https://github.com/jrcarter/PragmARC/blob/Ada-12/pragmarc-ansi_tty_control.ads) 
we can see that sending

PragmARC.Ansi_Tty_Control.Bold_Mode

to most Linux terminal emulators initiates bold mode.

-- 
Jeff Carter
"Simplicity and elegance are unpopular because
they require hard work and discipline to
achieve and education to be appreciated."
Edsger Dijkstra
170


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bold text (in terminal) from Ada?
  2022-10-11  8:06 Bold text (in terminal) from Ada? reinert
  2022-10-11  8:43 ` Jeffrey R.Carter
@ 2022-10-11  8:49 ` Niklas Holsti
  2022-10-12  0:11 ` Stephen Leake
  2 siblings, 0 replies; 7+ messages in thread
From: Niklas Holsti @ 2022-10-11  8:49 UTC (permalink / raw)


On 2022-10-11 11:06, reinert wrote:
> Any simple way to print out bold text from an Ada program?
> In case, how?
> 
> Assume linux.
> 
> reinert


Print the corresponding ANSI control sequence to turn on bold mode 
before you print the text, then print the ANSI control sequence to turn 
off bold mode.

See https://www.linux.org/threads/ansi-codes-and-colorized-terminals.11706/.

Example:

with Ada.Characters.Latin_1;
with Ada.Text_IO;
procedure Be_Bold
is
    use Ada.Characters, Ada.Text_IO;
begin
    Put ("This is a very ");
    -- Bold mode:
    Put (Latin_1.ESC); Put ("[1m");
    Put ("bold");
    -- Normal mode:
    Put (Latin_1.ESC); Put ("[0m");
    Put_Line (" program.");
end Be_Bold;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bold text (in terminal) from Ada?
  2022-10-11  8:06 Bold text (in terminal) from Ada? reinert
  2022-10-11  8:43 ` Jeffrey R.Carter
  2022-10-11  8:49 ` Niklas Holsti
@ 2022-10-12  0:11 ` Stephen Leake
  2022-10-12  4:36   ` reinert
  2 siblings, 1 reply; 7+ messages in thread
From: Stephen Leake @ 2022-10-12  0:11 UTC (permalink / raw)


reinert <reinkor@gmail.com> writes:

> Any simple way to print out bold text from an Ada program?
> In case, how?

Totally depends on what device you are printing to.

Others have posted solutions for terminals that respect certain control
codes.

If you are printing to paper or a pdf file, you'll need to use some
typesetting program like latex or Open Office document.

> Assume linux.

Not enough information.

-- 
-- Stephe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bold text (in terminal) from Ada?
  2022-10-12  0:11 ` Stephen Leake
@ 2022-10-12  4:36   ` reinert
  2022-10-12  6:17     ` Emmanuel Briot
  0 siblings, 1 reply; 7+ messages in thread
From: reinert @ 2022-10-12  4:36 UTC (permalink / raw)


No partly general solution? 

reinert

onsdag 12. oktober 2022 kl. 02:11:25 UTC+2 skrev Stephen Leake:
> reinert <rei...@gmail.com> writes: 
> 
> > Any simple way to print out bold text from an Ada program? 
> > In case, how?
> Totally depends on what device you are printing to. 
> 
> Others have posted solutions for terminals that respect certain control 
> codes. 
> 
> If you are printing to paper or a pdf file, you'll need to use some 
> typesetting program like latex or Open Office document. 
> 
> > Assume linux. 
> 
> Not enough information. 
> 
> -- 
> -- Stephe

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bold text (in terminal) from Ada?
  2022-10-12  4:36   ` reinert
@ 2022-10-12  6:17     ` Emmanuel Briot
  2022-10-14  2:46       ` onox
  0 siblings, 1 reply; 7+ messages in thread
From: Emmanuel Briot @ 2022-10-12  6:17 UTC (permalink / raw)


Another candidate is GNATCOLL.Terminal
It supports the ANSI sequences and the Windows historical terminal (the newer Windows Terminal supports the ANSI sequences)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Bold text (in terminal) from Ada?
  2022-10-12  6:17     ` Emmanuel Briot
@ 2022-10-14  2:46       ` onox
  0 siblings, 0 replies; 7+ messages in thread
From: onox @ 2022-10-14  2:46 UTC (permalink / raw)


If you're using Alire, try Mosteo's ansiada crate. Add it to your own project with `alr with ansiada`. See https://ada-lang.io/ to get started.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-14  2:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-11  8:06 Bold text (in terminal) from Ada? reinert
2022-10-11  8:43 ` Jeffrey R.Carter
2022-10-11  8:49 ` Niklas Holsti
2022-10-12  0:11 ` Stephen Leake
2022-10-12  4:36   ` reinert
2022-10-12  6:17     ` Emmanuel Briot
2022-10-14  2:46       ` onox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox