X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3314fbcb44e8840cd3353a7f8e22207bf26c03d..b5a7b0005781f24ab97ed3322530423b6d89fb67:/src/msw/fontutil.cpp diff --git a/src/msw/fontutil.cpp b/src/msw/fontutil.cpp index 5fddec59b8..6d80870a22 100644 --- a/src/msw/fontutil.cpp +++ b/src/msw/fontutil.cpp @@ -50,12 +50,18 @@ // ---------------------------------------------------------------------------- // convert to/from the string representation: format is -// facename[;charset] +// encodingid;facename[;charset] bool wxNativeEncodingInfo::FromString(const wxString& s) { wxStringTokenizer tokenizer(s, _T(";")); + wxString encid = tokenizer.GetNextToken(); + long enc; + if ( !encid.ToLong(&enc) ) + return FALSE; + encoding = (wxFontEncoding)enc; + facename = tokenizer.GetNextToken(); if ( !facename ) return FALSE; @@ -81,10 +87,12 @@ bool wxNativeEncodingInfo::FromString(const wxString& s) wxString wxNativeEncodingInfo::ToString() const { - wxString s(facename); + wxString s; + + s << (long)encoding << _T(';') << facename; if ( charset != ANSI_CHARSET ) { - s << _T(';') << charset; + s << _T(';') << charset; } return s; @@ -158,6 +166,8 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding, return FALSE; } + info->encoding = encoding; + return TRUE; } @@ -168,7 +178,7 @@ bool wxTestFontEncoding(const wxNativeEncodingInfo& info) wxZeroMemory(lf); // all default values lf.lfCharSet = info.charset; - strncpy(lf.lfFaceName, info.facename, sizeof(lf.lfFaceName)); + wxStrncpy(lf.lfFaceName, info.facename, sizeof(lf.lfFaceName)); HFONT hfont = ::CreateFontIndirect(&lf); if ( !hfont )