windows fonts for console

This is a discussion on windows fonts for console within the Game Programming forums, part of the General Programming Boards category; Hi, I'm pretty sick of having to recompile everytime I need to modify a variable, so I'm implementing a console ...

  1. #1
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345

    windows fonts for console

    Hi,

    I'm pretty sick of having to recompile everytime I need to modify a variable, so I'm implementing a console right now, I have a couple of questions:
    1. I'll use one of Windows fonts along with wglUseFontBitmaps, to make my life easier, I'll use a font with fixed character width, will Courier work for me? (I'm open to suggestions)
    2. CreateFont first 2 variables are height and width according to MSDN, how to convert them into pixel width and height? (to be used for calculations to align words/lines correctly)

    thanks in advance.

  2. #2
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    Two things. The fonts are already in pixels, to my understanding. Do you mean in points (like 12 pt font, 30 pt, etc.) like in a word processor? If so, the formula is:
    Code:
    ptSize = -MulDiv(ptSize, GetDeviceCaps(someHDC, LOGPIXELSY), 72);
    // someHDC should be an HDC object
    Hope that helps.

    The other thing is, there is no way that I have found yet to re-draw fonts, bitmaps, or any other API graphics if a console font is minimized. They will simply vanish, so just be aware of that. And if you find (or have found) a way to make it stop that, I'd be much abliged if you'd tell me . Thanks.

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

  3. #3
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    When I render the console, I need to specify coords for every word / line, those coords are going to be in pixels, let's say that the screen resolution is 1024x768, I need to know how many pixels of those one letter will take.
    I didn't get your second point, what do you mean by a font being minimized? Do you mean specifying a low value for size or something?

    I'm thinking of switching to texture fonts, like the one in NeHe tutorials, I'll see if I can get wgl fonts working well, if not, I'll switch.
    Is there any difference in performance / quality between wgl and texture fonts? I only know that texture fonts are protable.
    Thanks in advance.
    Last edited by glUser3f; 10-20-2003 at 12:31 PM.

  4. #4
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    Oops, my bad lol, I meant if the console WINDOW is minimized. Sorry. As to your question...er...no idea, sorry.

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

  5. #5
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    I use OpenGL and fonts don't vanish when I minimize.
    When does this happen? Win32 API or what?

  6. #6
    Registered User harryP's Avatar
    Join Date
    Sep 2002
    Posts
    124
    Wow...ok I think I totally mis-understood you. I thought you meant you wanted use fonts in a console program, but I'm thinking that's not what you mean. Lol...oops.

    Brendan
    Draco dormiens nunquam titallandus.
    Console Graphics Library: http://www.geocities.com/steve_alberto/cgl.html

  7. #7
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    Hehe, I guess it's my fault, should have said it's OpenGL never mind
    Any one else?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux - Windows common fonts.
    By mike_g in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 01-18-2008, 04:53 PM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. dual boot Win XP, win 2000
    By Micko in forum Tech Board
    Replies: 6
    Last Post: 05-30-2005, 02:55 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. IE 6 status bar
    By DavidP in forum Tech Board
    Replies: 15
    Last Post: 10-23-2002, 05:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21