• Bold text (in terminal) from Ada?

    From reinert@21:1/5 to All on Tue Oct 11 01:06:42 2022
    Any simple way to print out bold text from an Ada program?
    In case, how?

    Assume linux.

    reinert

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Niklas Holsti@21:1/5 to reinert on Tue Oct 11 11:49:09 2022
    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;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey R.Carter@21:1/5 to reinert on Tue Oct 11 10:43:31 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stephen Leake@21:1/5 to reinert on Tue Oct 11 17:11:21 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From reinert@21:1/5 to All on Tue Oct 11 21:36:41 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emmanuel Briot@21:1/5 to All on Tue Oct 11 23:17:26 2022
    Another candidate is GNATCOLL.Terminal
    It supports the ANSI sequences and the Windows historical terminal (the newer Windows Terminal supports the ANSI sequences)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From onox@21:1/5 to All on Thu Oct 13 19:46:08 2022
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)