From aaa13cf520e759d202c3d4f7ce98234aed01cc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sat, 3 Nov 2018 17:03:14 +0100 Subject: [PATCH] Fix font description for non-. decimal separators Fix wxNativeFontInfo::ToString and FromString to work correctly under locales that don't use '.' for decimal separator. The code incorrectly parsed descriptions using ToCDouble and this '.', but wrote them out using locale's native separator. Fixed by using FromCDouble for output too. --- src/common/fontcmn.cpp | 4 ++-- src/msw/font.cpp | 4 ++-- src/osx/carbon/font.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/fontcmn.cpp b/src/common/fontcmn.cpp index f5c47bd001..74f105e2a2 100644 --- a/src/common/fontcmn.cpp +++ b/src/common/fontcmn.cpp @@ -812,9 +812,9 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(wxT("%d;%f;%d;%d;%d;%d;%d;%s;%d"), + s.Printf(wxT("%d;%s;%d;%d;%d;%d;%d;%s;%d"), 1, // version - GetFractionalPointSize(), + wxString::FromCDouble(GetFractionalPointSize()), family, (int)style, weight, diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 76a2cc3c35..ed9840e0e6 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -739,9 +739,9 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(wxS("%d;%f;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"), + s.Printf(wxS("%d;%s;%ld;%ld;%ld;%ld;%ld;%d;%d;%d;%d;%d;%d;%d;%d;%s"), 1, // version - pointSize, + wxString::FromCDouble(pointSize), lf.lfHeight, lf.lfWidth, lf.lfEscapement, diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 53775b16b3..73f22a35fb 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -971,9 +971,9 @@ wxString wxNativeFontInfo::ToString() const { wxString s; - s.Printf(wxT("%d;%f;%d;%d;%d;%d;%d;%s;%d"), + s.Printf(wxT("%d;%s;%d;%d;%d;%d;%d;%s;%d"), 1, // version - GetFractionalPointSize(), + wxString::FromCDouble(GetFractionalPointSize()), GetFamily(), (int)GetStyle(), GetNumericWeight(),