#include "wx/tokenzr.h"
#include "wx/msw/private.h"
+#include "wx/tokenzr.h"
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
Init(size, family, style, weight, underlined, faceName, encoding);
}
- wxFontRefData(const wxNativeFontInfo& info)
+ wxFontRefData(const wxNativeFontInfo& info, WXHFONT hFont = 0)
{
- Init(info);
+ Init(info, hFont);
}
virtual ~wxFontRefData();
const wxString& faceName,
wxFontEncoding encoding);
- void Init(const wxNativeFontInfo& info);
+ void Init(const wxNativeFontInfo& info, WXHFONT hFont = 0);
// If TRUE, the pointer to the actual font is temporary and SHOULD NOT BE
// DELETED by destructor
m_nativeFontInfoOk = FALSE;
}
-void wxFontRefData::Init(const wxNativeFontInfo& info)
+void wxFontRefData::Init(const wxNativeFontInfo& info, WXHFONT hFont)
{
// extract family from pitch-and-family
int lfFamily = info.lf.lfPitchAndFamily;
m_fontId = 0;
m_temporary = FALSE;
- m_hFont = 0;
+ // hFont may be zero, or it be passed in case we really want to
+ // use the exact font created in the underlying system
+ // (for example where we can't guarantee conversion from HFONT
+ // to LOGFONT back to HFONT)
+ m_hFont = hFont;
m_nativeFontInfoOk = TRUE;
m_nativeFontInfo = info;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfItalic = l;
+ lf.lfItalic = (BYTE)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfUnderline = l;
+ lf.lfUnderline = (BYTE)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfStrikeOut = l;
+ lf.lfStrikeOut = (BYTE)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfCharSet = l;
+ lf.lfCharSet = (BYTE)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfOutPrecision = l;
+ lf.lfOutPrecision = (BYTE)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfClipPrecision = l;
+ lf.lfClipPrecision = (BYTE)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfQuality = l;
+ lf.lfQuality = (BYTE)l;
token = tokenizer.GetNextToken();
if ( !token.ToLong(&l) )
return FALSE;
- lf.lfPitchAndFamily = l;
+ lf.lfPitchAndFamily = (BYTE)l;
token = tokenizer.GetNextToken();
if(!token)
wxTheFontList->Append(this);
}
-bool wxFont::Create(const wxNativeFontInfo& info)
+bool wxFont::Create(const wxNativeFontInfo& info, WXHFONT hFont)
{
UnRef();
- m_refData = new wxFontRefData(info);
+ m_refData = new wxFontRefData(info, hFont);
RealizeResource();
return TRUE;
}
-bool wxFont::FreeResource(bool force)
+bool wxFont::FreeResource(bool WXUNUSED(force))
{
if ( GetResourceHandle() )
{