Font problems..

This is a discussion on Font problems.. within the C++ Programming forums, part of the General Programming Boards category; I am trying to make a font using the LOGFONT structure. This is my function: Code: void NFont(char* FontName, UINT ...

  1. #1
    Unregistered
    Guest

    Unhappy Font problems..

    I am trying to make a font using the LOGFONT structure. This is my function:
    Code:
    void NFont(char* FontName, UINT size, bool bold, bool italic, bool underline, bool strikethrough)
    {
    if (abs(size)>72) size = 72;
    
    LOGFONT lg = {
    	abs(size), //height
    	0,	  //width
    	0,	  //escapement
    	0,    //orientation
    	bold ? FW_BOLD : FW_NORMAL,
    	italic,
    	underline,
    	strikethrough,
    	DEFAULT_CHARSET,
    	OUT_DEFAULT_PRECIS,
    	CLIP_DEFAULT_PRECIS,
    	ANTIALIASED_QUALITY,
    	DEFAULT_PITCH,
    	*FontName //"Comic Sans MS"};
    ...
    ...
    The problem is that I always get an Arial font! For example:
    Code:
    NFont ("Comic Sans MS", true, false,false,false);
    returns an Arial font. However, if i change the *FontName (the one in the LOGFONT list) to a font name f.e "Comic Sans MS", it works. I get the right font. What might be the solution??

  2. #2
    Unregistered
    Guest
    Nevermind I got it. For those who have the same problem, you dont include the *FontName in the { } but use strcpy ( lg.lpFaceName, FontName) and it will work. Wow, so many times of checking...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectX | Drawing text
    By gavra in forum Game Programming
    Replies: 4
    Last Post: 06-08-2009, 01:23 AM
  2. problem with my font manager
    By hannibar in forum C Programming
    Replies: 1
    Last Post: 03-07-2006, 08:03 AM
  3. destroywindow() problem
    By algi in forum Windows Programming
    Replies: 6
    Last Post: 03-27-2005, 11:40 PM
  4. button in function
    By algi in forum Windows Programming
    Replies: 1
    Last Post: 03-21-2005, 11:12 PM
  5. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM

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