From: Eddards on
Can someone help me with a font problem?
In the code below I am trying to set the font for the c_info text variable.
Whether I use FF_SWISS or FF_SCRIPT or any other the displayed text is
allways the same.
Changing the height, width, weight, italic... all work and do change the
displayed text.
How do I change the actual font used? Like to Courier, Times, Script, or any
other font available.


In the .h file under I have:
protected:
CFont InfoFont;

BOOL CEcolorDlg::OnInitDialog()
{
CDialog::OnInitDialog();

ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);

CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}

SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

LOGFONT lf;
lf.lfHeight = 15;
lf.lfWidth = 5;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_NORMAL;
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfOutPrecision = OUT_STROKE_PRECIS;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = PROOF_QUALITY;
// lf.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
lf.lfPitchAndFamily = VARIABLE_PITCH | FF_SCRIPT;
_tcscpy(lf.lfFaceName, _T("Arial"));
InfoFont.CreateFontIndirect(&lf);

c_info.SetFont(&InfoFont); //c_info is the static text variable
c_info.SetWindowText("System Ready");

//The rest of my initialization here

return TRUE;
}

Thanks,
Ed


From: David Lowndes on
>Can someone help me with a font problem?
>In the code below I am trying to set the font for the c_info text variable.
>Whether I use FF_SWISS or FF_SCRIPT or any other the displayed text is
>allways the same.
>Changing the height, width, weight, italic... all work and do change the
>displayed text.
>How do I change the actual font used? Like to Courier, Times, Script, or any
>other font available.

Ed,

Try using FF_DONTCARE. The font mapping algorithm may be ignoring the
face name if you specify a conflicting family type.

I wouldn't recommend specifying the width either - in fact leave
everything you don't need to specify as the default (0).

Dave
From: David Webber on


"David Lowndes" <DavidL(a)example.invalid> wrote in message
news:4e2qp55vdciv04k6fefr4sbrdt9urrrnrs(a)4ax.com...

> Try using FF_DONTCARE. The font mapping algorithm may be ignoring the
> face name if you specify a conflicting family type.

Yes - I forget the priorities if the different elements of the LOGFONT
conflict, but I do remember that they're highly counter-intuitive: for
example the most precise spec, the face name itself, doesn't IIRC get the
highest priority.

Dave

--
David Webber
Mozart Music Software
http://www.mozart.co.uk
For discussion and support see
http://www.mozart.co.uk/mozartists/mailinglist.htm

From: Joseph M. Newcomer on
The face name, which SHOULD be the most impoirtant parameter, is not, and as already
observed, the width should be set to 0.
joe

On Mon, 15 Mar 2010 00:24:29 -0000, "David Webber" <dave(a)musical-dot-demon-dot-co.uk>
wrote:

>
>
>"David Lowndes" <DavidL(a)example.invalid> wrote in message
>news:4e2qp55vdciv04k6fefr4sbrdt9urrrnrs(a)4ax.com...
>
>> Try using FF_DONTCARE. The font mapping algorithm may be ignoring the
>> face name if you specify a conflicting family type.
>
>Yes - I forget the priorities if the different elements of the LOGFONT
>conflict, but I do remember that they're highly counter-intuitive: for
>example the most precise spec, the face name itself, doesn't IIRC get the
>highest priority.
>
>Dave
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Eddards on
Thanks all, got it working.
Where can I get a list of FaceNames available?
I have searched the web and cant find a list.
I am still using VC6
Ed


"Joseph M. Newcomer" <newcomer(a)flounder.com> wrote in message
news:3vgtp596238puigdo2rjn75452cjvrffcm(a)4ax.com...
> The face name, which SHOULD be the most impoirtant parameter, is not, and
> as already
> observed, the width should be set to 0.
> joe
>
> On Mon, 15 Mar 2010 00:24:29 -0000, "David Webber"
> <dave(a)musical-dot-demon-dot-co.uk>
> wrote:
>
>>
>>
>>"David Lowndes" <DavidL(a)example.invalid> wrote in message
>>news:4e2qp55vdciv04k6fefr4sbrdt9urrrnrs(a)4ax.com...
>>
>>> Try using FF_DONTCARE. The font mapping algorithm may be ignoring the
>>> face name if you specify a conflicting family type.
>>
>>Yes - I forget the priorities if the different elements of the LOGFONT
>>conflict, but I do remember that they're highly counter-intuitive: for
>>example the most precise spec, the face name itself, doesn't IIRC get the
>>highest priority.
>>
>>Dave
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm