• Change console font

    From dlzc@21:1/5 to Marco Boschi on Thu Mar 18 07:03:58 2021
    Dear Marco Boschi:

    On Thursday, March 18, 2021 at 5:59:25 AM UTC-7, Marco Boschi wrote:
    At the beginning of my console app I lauunch this setmode(35,90) IN this
    way I modify layout of my cmd. Is it possible to change also the font to
    use? By coding?

    Will end up using WIN32 API, if you can only do it from your program, and not from a calling .cmd file:
    https://docs.microsoft.com/en-us/windows/console/setcurrentconsolefontex

    I find this command referenced in this thread here: https://groups.google.com/g/comp.lang.xharbour/c/aWyY6dcFgx4/m/zOUOcnDyOeUJ

    If you can use this reference, it might be of some help: https://answers.microsoft.com/en-us/windows/forum/windows_10-start-winpc/how-to-customize-consoles-fonts-in-windows-10/f257d215-66db-4186-86cc-2e0b5056b50c

    David A. Smith

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jayadev U@21:1/5 to Marco Boschi on Fri Mar 19 17:47:06 2021
    On 18-03-2021 06:29 pm, Marco Boschi wrote:
    At the beginning of my console app I lauunch this setmode(35,90) IN this way I modify layout of my cmd. Is it possible to change also the font to use? By coding?
    Many thanks
    marco

    Hi,

    Try the following:

    include "hbgtinfo.ch"

    Function Main

    hb_gtinfo( HB_GTI_FONTWIDTH, Int( hb_gtinfo( HB_GTI_DESKTOPWIDTH ) /
    80 ) )
    hb_gtinfo( HB_GTI_FONTSIZE, Int( ( hb_gtinfo( HB_GTI_DESKTOPHEIGHT )
    - 64 ) / 25 ) )

    your code goes here.... (remove the setmode command)

    Return NIL


    The program will automatically resize to maximum desktop width and you
    will be using the biggest font size possible.

    The program will also automatically adjust to different monitor sizes as
    well.
    I have tested with Harbour should work with xHarbour also.



    HTH,

    Jayadev

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jayadev U@21:1/5 to Marco Boschi on Fri Mar 19 17:49:26 2021
    On 18-03-2021 06:29 pm, Marco Boschi wrote:
    At the beginning of my console app I lauunch this setmode(35,90) IN this way I modify layout of my cmd. Is it possible to change also the font to use? By coding?
    Many thanks
    marco

    Hi,

    Try the following:

    include "hbgtinfo.ch"

    Function Main

    hb_gtinfo( HB_GTI_FONTWIDTH, Int( hb_gtinfo( HB_GTI_DESKTOPWIDTH ) /
    80 ) )
    hb_gtinfo( HB_GTI_FONTSIZE, Int( ( hb_gtinfo( HB_GTI_DESKTOPHEIGHT )
    - 64 ) / 25 ) )

    your code goes here.... (remove the setmode command)

    Return NIL


    The program will automatically resize to maximum desktop width and you
    will be using the biggest font size possible.

    The program will also automatically adjust to different monitor sizes as
    well.
    I have tested with Harbour should work with xHarbour also.



    HTH,

    Jayadev

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