Why CreateFont()


Hi,

What is the difference between CreateFont() and CreateFontIndirect()? I noticed that CreateFontIndirect has less lines of code. So, why use CreateFont()?

Thanks for your help.
Jikko

Comments

  • :
    : Hi,
    :
    : What is the difference between CreateFont() and CreateFontIndirect()? I noticed that CreateFontIndirect has less lines of code. So, why use CreateFont()?
    :
    : Thanks for your help.
    : Jikko
    :
    [blue]No difference. Indirect creation uses LOGFONT structure and this structure is easy to save to a file (one WriteFile), so it may be restored later - when the program needs font settings.[/blue]
  • : :
    : : Hi,
    : :
    : : What is the difference between CreateFont() and CreateFontIndirect()? I noticed that CreateFontIndirect has less lines of code. So, why use CreateFont()?
    : :
    : : Thanks for your help.
    : : Jikko
    : :
    : [blue]No difference. Indirect creation uses LOGFONT structure and this structure is easy to save to a file (one WriteFile), so it may be restored later - when the program needs font settings.[/blue]
    :
    : :
    : very true asmguru62, but the mental satisfaction one gets out of using createfont() is not matched by createfontindirect(). It is a piece of cake compared to the former. we are using the inbuilt font dialogbox in indirect whereas creating our own for nearly all the 18 parameters of the former is mindblowing.
  • [blue]Which dialog box?
    Below I created a font in 4 lines (and I can save/restore it to disk!):
    [/blue]
    [code]
    LOGFONT lf = {0};

    strcpy (lf.lfFaceName, "Verdana");
    lf.lfHeight = -22;
    lf.lfWeight = FW_NORMAL;
    HFONT hFont = CreateFontIndirect (&lf);
    [/code]

  • : [blue]Which dialog box?
    : Below I created a font in 4 lines (and I can save/restore it to disk!):
    : [/blue]
    : [code]
    : LOGFONT lf = {0};
    :
    : strcpy (lf.lfFaceName, "Verdana");
    : lf.lfHeight = -22;
    : lf.lfWeight = FW_NORMAL;
    : HFONT hFont = CreateFontIndirect (&lf);
    : [/code]
    :
    : asmguru62, apparently i blundered rather badly in understanding the indirect function. i was reffering to the common font dialogbox. regrets and thanks for pulling me up. it sure helps.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories