• Bold print

    From db@dieterhansbritz@gmail.com to comp.lang.fortran on Fri Jan 12 14:54:31 2024
    From Newsgroup: comp.lang.fortran

    I have a program that reads a file of birthdays and prints
    out impending ones when I activate my (Linux) console.
    It first prints a header

    print '(/" Birthdays:")'

    Is it possible to get it to print that in bold or a colour?
    If yes, how?
    --
    Dieter Britz
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lynn McGuire@lynnmcguire5@gmail.com to comp.lang.fortran on Fri Jan 12 22:14:21 2024
    From Newsgroup: comp.lang.fortran

    On 1/12/2024 7:54 AM, db wrote:
    I have a program that reads a file of birthdays and prints
    out impending ones when I activate my (Linux) console.
    It first prints a header

      print '(/" Birthdays:")'

    Is it possible to get it to print that in bold or a colour?
    If yes, how?

    Ok, I'll bite. So what is the device that you are printing to ?

    If the device is a screen then there are control codes that you must
    print also.

    If the device is a file then, no way. This is the reason that HTML was invented.

    Lynn


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Thomas Koenig@tkoenig@netcologne.de to comp.lang.fortran on Sat Jan 13 09:33:27 2024
    From Newsgroup: comp.lang.fortran

    Lynn McGuire <lynnmcguire5@gmail.com> schrieb:
    On 1/12/2024 7:54 AM, db wrote:
    I have a program that reads a file of birthdays and prints
    out impending ones when I activate my (Linux) console.
    It first prints a header

      print '(/" Birthdays:")'

    Is it possible to get it to print that in bold or a colour?
    If yes, how?

    Ok, I'll bite. So what is the device that you are printing to ?

    If the device is a screen then there are control codes that you must
    print also.

    If the device is a file then, no way. This is the reason that HTML was invented.

    Or rather, there are quite a number of ways, depending on how
    the file is interpreted afterwards.

    Writing HTML to a file and then loading it into a browser is certainly
    one way. One thing I someitmes do to write out PostScript from
    a Fortran program, where you could use setgrbcolor.

    Or you can write out Markdown and insert HTML color.

    Or you can...
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From db@dieterhansbritz@gmail.com to comp.lang.fortran on Sat Jan 13 11:50:43 2024
    From Newsgroup: comp.lang.fortran

    On 13.01.2024 05.14, Lynn McGuire wrote:
    On 1/12/2024 7:54 AM, db wrote:
    I have a program that reads a file of birthdays and prints
    out impending ones when I activate my (Linux) console.
    It first prints a header

       print '(/" Birthdays:")'

    Is it possible to get it to print that in bold or a colour?
    If yes, how?

    Ok, I'll bite.  So what is the device that you are printing to ?

    If the device is a screen then there are control codes that you must
    print also.

    If the device is a file then, no way.  This is the reason that HTML was invented.

    Lynn


    It's to the console screen.
    --
    Dieter Britz

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From yeti@yeti@tilde.institute to comp.lang.fortran on Sat Jan 13 18:36:06 2024
    From Newsgroup: comp.lang.fortran

    Maybe this way?

    bold.f90: ------------------------------------------------------------------------ program testbold
    call system('tput bold')
    print'("Hello, World!")'
    call system('tput sgr0')
    print'("Bye, World!")'
    end program testbold ------------------------------------------------------------------------

    That's my 1st hand full of Fortran lines since the early 90s, so please
    don't laugh too loud.

    Using `system` and `tput` avoids needing
    + to find a Fortran (n)curses library
    + to hardcode the terminal commands
    .

    It worked for me with Gfortran on OpenBSD. I was too lazy to install
    Gfortran on Linux while already having access to it on BSD.
    --
    I do not bite, I just want to play.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From db@dieterhansbritz@gmail.com to comp.lang.fortran on Sun Jan 14 15:11:49 2024
    From Newsgroup: comp.lang.fortran

    On 13.01.2024 18.54, yeti wrote:
    Maybe this way?

    bold.f90: ------------------------------------------------------------------------ program testbold
    call system('tput bold')
    print'("Hello, World!")'
    call system('tput sgr0')
    print'("Bye, World!")'
    end program testbold ------------------------------------------------------------------------

    That's my 1st hand full of Fortran lines since the early 90s, so please
    don't laugh too loud.

    Using `system` and `tput` avoids needing
    + to find a Fortran (n)curses library
    + to hardcode the terminal commands
    .

    It worked for me with Gfortran on OpenBSD. I was too lazy to install Gfortran on Linux while already having access to it on BSD.

    Thank you Yeti, that works! You have solved my problem.
    --
    Dieter Britz

    --- Synchronet 3.20a-Linux NewsLink 1.114