From 8625a59d4c5c0adeb96a460d881e63d2fed3d49d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 3 Aug 2023 18:28:37 +0200 Subject: [PATCH] Fix a display issue in wxStyledTextCtrl widgets in dialogs (Windows specific). It happens when a text is using some esoteric unicode chars. Fixes #15314 https://gitlab.com/kicad/code/kicad/-/issues/15314 --- eeschema/dialogs/dialog_field_properties.cpp | 8 ++++++++ eeschema/dialogs/dialog_lib_textbox_properties.cpp | 7 +++++++ eeschema/dialogs/dialog_text_properties.cpp | 7 +++++++ pagelayout_editor/dialogs/properties_frame.cpp | 8 ++++++++ pcbnew/dialogs/dialog_text_properties.cpp | 7 +++++++ pcbnew/dialogs/dialog_textbox_properties.cpp | 7 +++++++ 6 files changed, 44 insertions(+) diff --git a/eeschema/dialogs/dialog_field_properties.cpp b/eeschema/dialogs/dialog_field_properties.cpp index 5ec7358ede..e15d90669f 100644 --- a/eeschema/dialogs/dialog_field_properties.cpp +++ b/eeschema/dialogs/dialog_field_properties.cpp @@ -73,8 +73,16 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const { wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) ); } ); + m_StyledTextCtrl->SetEOLMode( wxSTC_EOL_LF ); // Normalize EOL across platforms +#ifdef _WIN32 + // Without this setting, on Windows, some esoteric unicode chars create display issue + // in a wxStyledTextCtrl. + // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY + m_StyledTextCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE); +#endif + m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED ); m_textColorSwatch->SetSwatchBackground( schematicBackground ); diff --git a/eeschema/dialogs/dialog_lib_textbox_properties.cpp b/eeschema/dialogs/dialog_lib_textbox_properties.cpp index 512ccaf584..65001c848a 100644 --- a/eeschema/dialogs/dialog_lib_textbox_properties.cpp +++ b/eeschema/dialogs/dialog_lib_textbox_properties.cpp @@ -64,6 +64,13 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* m_textCtrl->SetEOLMode( wxSTC_EOL_LF ); +#ifdef _WIN32 + // Without this setting, on Windows, some esoteric unicode chars create display issue + // in a wxStyledTextCtrl. + // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY + m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE); +#endif + m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false, [this]() { diff --git a/eeschema/dialogs/dialog_text_properties.cpp b/eeschema/dialogs/dialog_text_properties.cpp index 2a332e79d7..50d016bf6c 100644 --- a/eeschema/dialogs/dialog_text_properties.cpp +++ b/eeschema/dialogs/dialog_text_properties.cpp @@ -102,6 +102,13 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE m_textCtrl->SetEOLMode( wxSTC_EOL_LF ); +#ifdef _WIN32 + // Without this setting, on Windows, some esoteric unicode chars create display issue + // in a wxStyledTextCtrl. + // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY + m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE); +#endif + m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false, [this]() { diff --git a/pagelayout_editor/dialogs/properties_frame.cpp b/pagelayout_editor/dialogs/properties_frame.cpp index 7e62f5be8a..36b5a52b46 100644 --- a/pagelayout_editor/dialogs/properties_frame.cpp +++ b/pagelayout_editor/dialogs/properties_frame.cpp @@ -83,6 +83,14 @@ PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) : m_stcText->SetUseVerticalScrollBar( false ); m_stcText->SetUseHorizontalScrollBar( false ); m_stcText->SetEOLMode( wxSTC_EOL_LF ); // Always use LF as eol char, regardless the platform + +#ifdef _WIN32 + // Without this setting, on Windows, some esoteric unicode chars create display issue + // in a wxStyledTextCtrl. + // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY + m_stcText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE); +#endif + m_scintillaTricks = new SCINTILLA_TRICKS( m_stcText, wxT( "{}" ), false ); m_staticTextSizeInfo->SetFont( KIUI::GetInfoFont( this ).Italic() ); diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 01f764fadf..16f664f11a 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -61,6 +61,13 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO m_MultiLineText->SetEOLMode( wxSTC_EOL_LF ); +#ifdef _WIN32 + // Without this setting, on Windows, some esoteric unicode chars create display issue + // in a wxStyledTextCtrl. + // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY + m_MultiLineText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE); +#endif + m_scintillaTricks = new SCINTILLA_TRICKS( m_MultiLineText, wxT( "{}" ), false, [this]() { diff --git a/pcbnew/dialogs/dialog_textbox_properties.cpp b/pcbnew/dialogs/dialog_textbox_properties.cpp index d598954cb6..fa4f1b9336 100644 --- a/pcbnew/dialogs/dialog_textbox_properties.cpp +++ b/pcbnew/dialogs/dialog_textbox_properties.cpp @@ -54,6 +54,13 @@ DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aPare { m_MultiLineText->SetEOLMode( wxSTC_EOL_LF ); +#ifdef _WIN32 + // Without this setting, on Windows, some esoteric unicode chars create display issue + // in a wxStyledTextCtrl. + // for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY + m_MultiLineText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE); +#endif + m_scintillaTricks = new SCINTILLA_TRICKS( m_MultiLineText, wxT( "{}" ), false, [this]() {