Announcement

Collapse
No announcement yet.

console font size, again

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • console font size, again


    a perenial questions raised in PBCC is

    "How can I control the <Windows default> font for a console app from within the app?"

    UCR: "Can't be done, can't change the font of a running console."

    it's now time to get devious:

    one can set the Windows font via right-click|Properties, use for all future Windows of this name, etc.

    now, as a point of obvious fact, the information - "use this font for all windows named X" - is written to some file,
    somewhere within the Windows system, register, <whatever>.
    there is no application fairy that swoops down on every computer whenever app X is launched to "make things right"

    so, if the following points are true:

    - the pbcc .exe can determine the screen resolution of the running monitor
    - the pbcc .exe can determine the font size currently being used for the pbcc console window
    - the location of the stored info "use this font for app X" is known and can be "rewritten"
    - a pbcc .exe can shell out, launch of copy of itself, and terminate async

    it would seem possible to:

    (a) determine font in use
    (b) decide whether font in use is appropriate for the application needs based on display resolution
    (c) if (b) not true, re-write "?file?data?" as if the user had changed font to an appropriate font size/style
    (d) shell launch itself and terminate first copy.
    (e) effectively "controlling" the font of a running console window.....

    since the change to an appropriate font via "?whatever?file?data?" is "permanent" - this is probably a "run once" type scenario.
    changing font multiple times within the app would have some serious drawbacks if implemented via this scheme.
    personally, I'll settle for half-a-loaf.

    anyone tries this approach?
    too far out in left field?


    ------------------

  • #2
    http://support.microsoft.com/kb/102976

    ------------------
    Roy Cline
    Roy Cline

    Comment


    • #3
      Tom,

      Here is something you might be interested in. I am using the new
      Consolas font at the command prompt and I love it.

      Necessary criteria for fonts to be available in a command window

      Using Consolas as the Windows Console Font

      ------------------
      Greg

      [This message has been edited by Greg Lyon (edited May 07, 2007).]

      Comment


      • #4
        Greg - interesting idea on the fonts. not sure I would want to install in on all workstations that might use the app, but for one's own machine, could make things "more better"

        Roy - thanks for the pointer. I had initially "searched everything" but as I had not specified a app font different from my default, there was no entry in Current User....
        I changed the font and sure enough it's there.

        PerfectSync's CWC program does essentially the same thing, I suppose.
        the remaining question is if incorporating the register change code into the .exe itself, with a subsequent shell to itself, can "fool Windows"....
        of course, first I have to learn how to monkey with the register, and translate all the cute codes needed.

        ------------------

        Comment


        • #5
          Hello Tom,

          I use a console off pb/cc exe as initial app
          This one do some preinit work, e.g.
          set the console font, window pos for the main app
          and start the main app (console on) at the end of its short life

          I don`t know if
          "d) shell launch itself and terminate first copy."
          will work, because the console windows is activated yet.

          and I did not found any MS public paper how "Set Properties for Console" works
          so I run the non console app first.

          -Uwe




          ------------------

          Comment


          • #6
            I think this is the way to do it:

            INFO: Setting the Console Configuration.





            ------------------
            Greg

            Comment


            • #7
              Greg,
              Downloaded the Consolas font and updated the registry.
              Wow, it is so much better.
              Thank you.

              ------------------




              [This message has been edited by Mike Doty (edited May 08, 2007).]
              The world is full of apathy, but who cares?

              Comment


              • #8
                Bin praying for releif from M$? consolas, your prayers are answered!



                ------------------

                Comment


                • #9

                  Uwe -
                  Greg -

                  [as a clarification, I'm not looking to change "the default for everything" but rather the font for a specific app that will always have the same "name"]

                  it sounds like Uwe method accomplishes the task, but questionable if it can be done in a single exe.
                  Uwe - would you be willing to share the code? I can roll it into one single exe for testing the async shell.

                  thatnks

                  ------------------

                  Comment


                  • #10
                    According to the doc, you can set the size and location of console by using the STARTUPINFO structure passed to CreateProcess with the STARTF_USESIZE and/or STARTF_USECOUNTCHARS bits.

                    (No need to tinker with registry or set "for all")

                    You would need an additional EXE to to pull this off..

                    Code:
                    ' Launcher. bas
                    FUNCTION WinMain()
                    
                       Set up STARTUPINFO structure
                    
                       Success = CreateProcess ( "real program.exe" ....)
                       close open handles in PROCESS_INFO 
                    END FUNCTION
                    Doesn't handle the 'font' per se, but maybe just setting console size would do something good for you?


                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      Tom,

                      Expanding on the document above:

                      1. Determine the actual console window name for your console
                      program.

                      2. Create a new key under HKEY_CURRENT_USER\Console that is the
                      console window name, replacing backslashes with underscores
                      if needed. i.e. C:\Program Files\MyProg\MyProg.exe becomes
                      C:_Program Files_MyProg_MyProg.exe .

                      3. Create new values for the key as follows:
                      Code:
                           Name       Type       Data
                           ----       ----       ---- 
                           FontName   REG_SZ     Consolas  
                           FontFamily REG_DWORD  0x36 
                           FontSize   REG_DWORD  0x100000
                           FontWeight REG_DWORD  0x2bc

                      It only effects that single application.

                      If you change the properties for a console and select
                      'Save properties for future windows with the same title' you can
                      see this happening in the registry.

                      If you start from a shortcut the settings are retrieved from and
                      saved to the shortcut, not the registry.



                      [This message has been edited by Greg Lyon (edited May 08, 2007).]

                      Comment


                      • #12
                        (MCM) well, console size I'm fixing up via:
                        CONSOLE SET SCREEN %conrows,%conwidth
                        which seems to work veddy well; it's even nicely resizeable (to max limits) but that's not an issue/problem at the moment

                        what does happen: users have advertently, inadvertently or <something else> has set the default console font to something ugly/unuseable.
                        XP seems to come "out of the box" with console font options
                        Lucida Console, pt size(?) 5 to 72
                        Raster Fonts 4x6 thru 12x18

                        I've seen some "pre-existing default settings" that lend a new definition to "Coyote Ugly"

                        I'd like to see users at Raster 8x12, at least in 1600x1200 resolution
                        as I get deeper into what looks good at different resolutions, I'm open to new "font specs"
                        I'm restricting this app to XP; so it's unlikely I'll need to deal with EGA displays....

                        Greg -

                        I see precisely your points/"the theory"/items in the register/docos.

                        in addition to
                        FontName REG_SZ Consolas (mine are different, obviously)
                        FontFamily REG_DWORD 0x36
                        FontSize REG_DWORD 0x100000
                        FontWeight REG_DWORD 0x2bc

                        these keys show up:
                        HistoryNoDup
                        ScreenBufferSize
                        ScreenColors
                        WindowSize

                        recapping the issues:
                        (1) was "where the heck is the info stored?" - that's clear now
                        (2) how to read if a app key already exists
                        (3) if no app key(s) exists, how to create entry and specifics
                        and finally
                        (4) if a running app creates and sets the proper app name keys, can it shell async to another copy, terminate, and the second copy inherit the values written by the first copy.

                        which - if successful - leads to a marvelous "here's how to control console fonts in PBCC:"

                        now, I gotta' say, mucking about with the registry is not my forte.
                        which is an understatement; and "experimentally reprogramming" the registry could be very painful.

                        perusing search results on "registry" is scary.
                        about half of the entries end with " . . . doesn't/didn't work . . ."

                        Dave Navarro's (sp?) seemed most apt.

                        PB-basically speaking, I have no clue how to
                        - check for an entry
                        - create the entry & subskeys as needed
                        and I obviously cannot risk blowing up my main development machine on a experimental programm approach.

                        I need a whole lotta' help with the concepts in
                        reading to find a specific entry&key for "myApp" in HKEY_CURRENT_USER\Console
                        (is it really a subdir - or it that just a MS GUI "thing"?)
                        inserting the entry and keys for "MyApp"



                        ------------------

                        Comment


                        • #13
                          You could try creating a shortcut on the desktop to
                          your console app or bat file lanucher, etc.

                          By using the right mouse button I think you can change the
                          font to use.

                          You didn't ask for this solution, but for a programmable one.

                          ------------------
                          Roy Cline
                          Roy Cline

                          Comment


                          • #14
                            tom,

                            you use the windows api registry functions.

                            there are some good wrapper functions for reading and writing the
                            registry here http://www.powerbasic.com/support/pb...ad.php?t=24777 .

                            using a shortcut would be easier and simpler.



                            ------------------
                            greg

                            Comment


                            • #15
                              >at least in 1600x1200 resolution

                              You aren't asking for much, are you?

                              I have 19" flat panel screen running at 1152x864 and there is no way in hell I could read anything if I ran the resolution up to that... well, let me try real quick and we'll see ...well, max on my card is 1280x1024 and I can't read that.

                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                Michael,

                                Hey, now I can help you there...

                                You should always run your LCD monitor to its maximum native resolution.
                                That way you get the best possible graphics.
                                Go to the advanced setting of your display properties and change
                                your DPI setting for the large size ( 125% of normal )
                                Then go to the appearance tab and choose a bigger font if needed.
                                Check also that you are using Clear Type.
                                I have a pair of 20 inches LCD with 1680 by 1050 resolution and
                                that setup is very eazy on my old eyes.


                                ------------------
                                Old QB45 Programmer
                                Old QB45 Programmer

                                Comment


                                • #17
                                  ((You aren't asking for much, are you?))

                                  uhmmmm, 1600x1200 is native resolution for my notebook.....

                                  1280x1024 is native on the desktop and 8x12 is no issue there either.

                                  time for eyewear?

                                  ------------------

                                  Comment


                                  • #18
                                    Greg - thanks for the pointers - that's certainly enough to keep me busy for a while.....


                                    ------------------

                                    Comment

                                    Working...
                                    X