From 6196f2bdf0e188e610624e7f8ddb0330078d6bb6 Mon Sep 17 00:00:00 2001 From: Ola Rinta-Koski Date: Mon, 7 Mar 2022 14:01:37 +0000 Subject: [PATCH] Version info: report all font libraries --- common/build_version.cpp | 2 ++ common/font/fontconfig.cpp | 6 ++++++ common/font/outline_font.cpp | 21 ++++++++++++++++++++- include/font/fontconfig.h | 2 ++ include/font/outline_font.h | 7 ++++++- 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/common/build_version.cpp b/common/build_version.cpp index ace9250149..a68d4ee971 100644 --- a/common/build_version.cpp +++ b/common/build_version.cpp @@ -136,6 +136,8 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief ) aMsg << indent4 << wxGetLibraryVersionInfo().GetVersionString() << eol; aMsg << indent4 << "FreeType " << KIFONT::OUTLINE_FONT::FreeTypeVersion() << eol; + aMsg << indent4 << "HarfBuzz " << KIFONT::OUTLINE_FONT::HarfBuzzVersion() << eol; + aMsg << indent4 << "FontConfig " << KIFONT::OUTLINE_FONT::FontConfigVersion() << eol; if( !aBrief ) aMsg << indent4 << GetKicadCurlVersion() << eol; diff --git a/common/font/fontconfig.cpp b/common/font/fontconfig.cpp index 3cb15c232b..7a8a5e2f98 100644 --- a/common/font/fontconfig.cpp +++ b/common/font/fontconfig.cpp @@ -37,6 +37,12 @@ inline static FcChar8* wxStringToFcChar8( const wxString& str ) } +wxString FONTCONFIG::Version() +{ + return wxString::Format( "%d.%d.%d", FC_MAJOR, FC_MINOR, FC_REVISION ); +} + + FONTCONFIG::FONTCONFIG() { (void) FcInitLoadConfigAndFonts(); diff --git a/common/font/outline_font.cpp b/common/font/outline_font.cpp index d74e7f1667..9379b6367c 100644 --- a/common/font/outline_font.cpp +++ b/common/font/outline_font.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -61,7 +62,25 @@ wxString OUTLINE_FONT::FreeTypeVersion() FT_Library_Version( m_freeType, &major, &minor, &patch ); return wxString::Format( "%d.%d.%d", major, minor, patch ); - } +} + + +wxString OUTLINE_FONT::HarfBuzzVersion() +{ + return wxString::FromUTF8( HB_VERSION_STRING ); +} + + +wxString OUTLINE_FONT::FontConfigVersion() +{ + return fontconfig::FONTCONFIG::Version(); +} + + +wxString OUTLINE_FONT::FontLibraryVersion() +{ + return wxString::Format( "FreeType %s HarfBuzz %s", FreeTypeVersion(), HarfBuzzVersion() ); +} OUTLINE_FONT* OUTLINE_FONT::LoadFont( const wxString& aFontName, bool aBold, bool aItalic ) diff --git a/include/font/fontconfig.h b/include/font/fontconfig.h index a751092db5..26954155be 100644 --- a/include/font/fontconfig.h +++ b/include/font/fontconfig.h @@ -34,6 +34,8 @@ class FONTCONFIG public: FONTCONFIG(); + static wxString Version(); + /** * Given a fully-qualified font name ("Times:Bold:Italic") find the closest matching font * and return its filepath in \a aFontFile. diff --git a/include/font/outline_font.h b/include/font/outline_font.h index 66da10cf6e..5a4414e5e9 100644 --- a/include/font/outline_font.h +++ b/include/font/outline_font.h @@ -37,7 +37,6 @@ #include FT_FREETYPE_H #include FT_OUTLINE_H //#include -#include #include #include #include @@ -52,8 +51,14 @@ class OUTLINE_FONT : public FONT public: OUTLINE_FONT(); + static wxString FontConfigVersion(); + static wxString FreeTypeVersion(); + static wxString HarfBuzzVersion(); + + static wxString FontLibraryVersion(); + bool IsOutline() const override { return true; } bool IsBold() const override