From 059e30d4cb95e1a2f4bc602e45ac35a822399fe4 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 3 Jun 2017 10:08:21 +0200 Subject: [PATCH 1/5] PangoFontInfo: Remove unused method is_fraktur That restores commit 25e0c1accb02b085d4de046d1c141d77a300cc93 and partially revert commit 4907a23feafc0a036ea6477393cf7d7c7e5c36f5 which added the now unused Shlwapi library. Signed-off-by: Stefan Weil --- cppan.yml | 6 ------ training/CMakeLists.txt | 3 --- training/pango_font_info.cpp | 14 -------------- training/pango_font_info.h | 2 -- 4 files changed, 25 deletions(-) diff --git a/cppan.yml b/cppan.yml index 977bb7e87b..5833008723 100644 --- a/cppan.yml +++ b/cppan.yml @@ -224,12 +224,6 @@ projects: dependencies: - common_training - pvt.cppan.demo.unicode.icu.i18n - options: - any: - link_libraries: - win32: - private: - - Shlwapi lstmeval: files: training/lstmeval.cpp diff --git a/training/CMakeLists.txt b/training/CMakeLists.txt index 27cb469f84..d0128c1a53 100644 --- a/training/CMakeLists.txt +++ b/training/CMakeLists.txt @@ -196,9 +196,6 @@ target_link_libraries (unicharset_training common_training ${ICU_LIBRARIES else() target_link_libraries (unicharset_training common_training pvt.cppan.demo.unicode.icu.i18n) endif() -if (WIN32) -target_link_libraries (unicharset_training Shlwapi) -endif() project_group (unicharset_training "Training Tools") diff --git a/training/pango_font_info.cpp b/training/pango_font_info.cpp index 48e4d77dac..3e56218a87 100644 --- a/training/pango_font_info.cpp +++ b/training/pango_font_info.cpp @@ -46,16 +46,6 @@ #include "pango/pangocairo.h" #include "pango/pangofc-font.h" -#ifdef _MSC_VER -#ifndef strcasecmp -#define strcasecmp stricmp -#endif -#include -#ifndef strcasestr -#define strcasestr StrStrIA -#endif -#endif - STRING_PARAM_FLAG(fontconfig_tmpdir, "/tmp", "Overrides fontconfig default temporary dir"); @@ -232,10 +222,6 @@ bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) { == PANGO_VARIANT_SMALL_CAPS); is_bold_ = (pango_font_description_get_weight(desc) >= PANGO_WEIGHT_BOLD); - // We don't have a way to detect whether a font is of type Fraktur. The fonts - // we currently use all have "Fraktur" in their family name, so we do a - // fragile but functional check for that here. - is_fraktur_ = (strcasestr(family, "Fraktur") != nullptr); return true; } diff --git a/training/pango_font_info.h b/training/pango_font_info.h index af6ee98512..aef68459dc 100644 --- a/training/pango_font_info.h +++ b/training/pango_font_info.h @@ -109,7 +109,6 @@ class PangoFontInfo { bool is_italic() const { return is_italic_; } bool is_smallcaps() const { return is_smallcaps_; } bool is_monospace() const { return is_monospace_; } - bool is_fraktur() const { return is_fraktur_; } FontTypeEnum font_type() const { return font_type_; } int resolution() const { return resolution_; } @@ -132,7 +131,6 @@ class PangoFontInfo { bool is_italic_; bool is_smallcaps_; bool is_monospace_; - bool is_fraktur_; FontTypeEnum font_type_; // The Pango description that was used to initialize the instance. PangoFontDescription* desc_; From 500f913b51980c2387cd671e91c1e2c38d7fa839 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 3 Jun 2017 10:24:06 +0200 Subject: [PATCH 2/5] PangoFontInfo: Remove unused method is_monospace Remove also some macros which are no longer needed. Signed-off-by: Stefan Weil --- training/pango_font_info.cpp | 25 ------------------------- training/pango_font_info.h | 2 -- 2 files changed, 27 deletions(-) diff --git a/training/pango_font_info.cpp b/training/pango_font_info.cpp index 3e56218a87..fe0ef7fa5d 100644 --- a/training/pango_font_info.cpp +++ b/training/pango_font_info.cpp @@ -91,7 +91,6 @@ void PangoFontInfo::Clear() { is_bold_ = false; is_italic_ = false; is_smallcaps_ = false; - is_monospace_ = false; family_name_.clear(); font_type_ = UNKNOWN; if (desc_) { @@ -172,29 +171,6 @@ static void ListFontFamilies(PangoFontFamily*** families, pango_font_map_list_families(font_map, families, n_families); } -// Inspects whether a given font family is monospace. If the font is not -// available, it cannot make a decision and returns false by default. -static bool IsMonospaceFontFamily(const char* family_name) { - PangoFontFamily** families = 0; - int n_families = 0; - bool is_monospace = false; - ListFontFamilies(&families, &n_families); - ASSERT_HOST(n_families > 0); - bool found = false; - for (int i = 0; i < n_families; ++i) { - if (!strcasecmp(family_name, pango_font_family_get_name(families[i]))) { - is_monospace = pango_font_family_is_monospace(families[i]); - found = true; - break; - } - } - if (!found) { - tlog(1, "Could not find monospace property of family %s\n", family_name); - } - g_free(families); - return is_monospace; -} - bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) { Clear(); const char* family = pango_font_description_get_family(desc); @@ -207,7 +183,6 @@ bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) { } family_name_ = string(family); desc_ = pango_font_description_copy(desc); - is_monospace_ = IsMonospaceFontFamily(family); // Set font size in points font_size_ = pango_font_description_get_size(desc); diff --git a/training/pango_font_info.h b/training/pango_font_info.h index aef68459dc..819d879f1c 100644 --- a/training/pango_font_info.h +++ b/training/pango_font_info.h @@ -108,7 +108,6 @@ class PangoFontInfo { bool is_bold() const { return is_bold_; } bool is_italic() const { return is_italic_; } bool is_smallcaps() const { return is_smallcaps_; } - bool is_monospace() const { return is_monospace_; } FontTypeEnum font_type() const { return font_type_; } int resolution() const { return resolution_; } @@ -130,7 +129,6 @@ class PangoFontInfo { bool is_bold_; bool is_italic_; bool is_smallcaps_; - bool is_monospace_; FontTypeEnum font_type_; // The Pango description that was used to initialize the instance. PangoFontDescription* desc_; From fbfbf67cf922ad8f46f82b851ed5ee24b9e91d43 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 3 Jun 2017 10:51:44 +0200 Subject: [PATCH 3/5] PangoFontInfo: Remove unused method is_smallcaps Signed-off-by: Stefan Weil --- training/pango_font_info.cpp | 3 --- training/pango_font_info.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/training/pango_font_info.cpp b/training/pango_font_info.cpp index fe0ef7fa5d..2abff5318c 100644 --- a/training/pango_font_info.cpp +++ b/training/pango_font_info.cpp @@ -90,7 +90,6 @@ void PangoFontInfo::Clear() { font_size_ = 0; is_bold_ = false; is_italic_ = false; - is_smallcaps_ = false; family_name_.clear(); font_type_ = UNKNOWN; if (desc_) { @@ -193,8 +192,6 @@ bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) { PangoStyle style = pango_font_description_get_style(desc); is_italic_ = (PANGO_STYLE_ITALIC == style || PANGO_STYLE_OBLIQUE == style); - is_smallcaps_ = (pango_font_description_get_variant(desc) - == PANGO_VARIANT_SMALL_CAPS); is_bold_ = (pango_font_description_get_weight(desc) >= PANGO_WEIGHT_BOLD); return true; diff --git a/training/pango_font_info.h b/training/pango_font_info.h index 819d879f1c..89587e873c 100644 --- a/training/pango_font_info.h +++ b/training/pango_font_info.h @@ -107,7 +107,6 @@ class PangoFontInfo { int font_size() const { return font_size_; } bool is_bold() const { return is_bold_; } bool is_italic() const { return is_italic_; } - bool is_smallcaps() const { return is_smallcaps_; } FontTypeEnum font_type() const { return font_type_; } int resolution() const { return resolution_; } @@ -128,7 +127,6 @@ class PangoFontInfo { int font_size_; bool is_bold_; bool is_italic_; - bool is_smallcaps_; FontTypeEnum font_type_; // The Pango description that was used to initialize the instance. PangoFontDescription* desc_; From 0cd71c67c989afc7d1bf1bd983205e665558ca7e Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 3 Jun 2017 10:53:24 +0200 Subject: [PATCH 4/5] PangoFontInfo: Remove unused method is_bold Signed-off-by: Stefan Weil --- training/pango_font_info.cpp | 2 -- training/pango_font_info.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/training/pango_font_info.cpp b/training/pango_font_info.cpp index 2abff5318c..6af1f758cb 100644 --- a/training/pango_font_info.cpp +++ b/training/pango_font_info.cpp @@ -88,7 +88,6 @@ PangoFontInfo::PangoFontInfo(const string& desc) void PangoFontInfo::Clear() { font_size_ = 0; - is_bold_ = false; is_italic_ = false; family_name_.clear(); font_type_ = UNKNOWN; @@ -193,7 +192,6 @@ bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) { is_italic_ = (PANGO_STYLE_ITALIC == style || PANGO_STYLE_OBLIQUE == style); - is_bold_ = (pango_font_description_get_weight(desc) >= PANGO_WEIGHT_BOLD); return true; } diff --git a/training/pango_font_info.h b/training/pango_font_info.h index 89587e873c..32e5610487 100644 --- a/training/pango_font_info.h +++ b/training/pango_font_info.h @@ -105,7 +105,6 @@ class PangoFontInfo { const string& family_name() const { return family_name_; } // Size in points (1/72"), rounded to the nearest integer. int font_size() const { return font_size_; } - bool is_bold() const { return is_bold_; } bool is_italic() const { return is_italic_; } FontTypeEnum font_type() const { return font_type_; } @@ -125,7 +124,6 @@ class PangoFontInfo { // Font properties set automatically from parsing the font description name. string family_name_; int font_size_; - bool is_bold_; bool is_italic_; FontTypeEnum font_type_; // The Pango description that was used to initialize the instance. From 5a7b7ed7e12aefe61a9065ee3f7891ccb3bd0867 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 3 Jun 2017 10:55:03 +0200 Subject: [PATCH 5/5] PangoFontInfo: Remove unused method is_italic Signed-off-by: Stefan Weil --- training/pango_font_info.cpp | 5 ----- training/pango_font_info.h | 2 -- 2 files changed, 7 deletions(-) diff --git a/training/pango_font_info.cpp b/training/pango_font_info.cpp index 6af1f758cb..b0474575ad 100644 --- a/training/pango_font_info.cpp +++ b/training/pango_font_info.cpp @@ -88,7 +88,6 @@ PangoFontInfo::PangoFontInfo(const string& desc) void PangoFontInfo::Clear() { font_size_ = 0; - is_italic_ = false; family_name_.clear(); font_type_ = UNKNOWN; if (desc_) { @@ -188,10 +187,6 @@ bool PangoFontInfo::ParseFontDescription(const PangoFontDescription *desc) { font_size_ /= PANGO_SCALE; } - PangoStyle style = pango_font_description_get_style(desc); - is_italic_ = (PANGO_STYLE_ITALIC == style || - PANGO_STYLE_OBLIQUE == style); - return true; } diff --git a/training/pango_font_info.h b/training/pango_font_info.h index 32e5610487..f435d04af0 100644 --- a/training/pango_font_info.h +++ b/training/pango_font_info.h @@ -105,7 +105,6 @@ class PangoFontInfo { const string& family_name() const { return family_name_; } // Size in points (1/72"), rounded to the nearest integer. int font_size() const { return font_size_; } - bool is_italic() const { return is_italic_; } FontTypeEnum font_type() const { return font_type_; } int resolution() const { return resolution_; } @@ -124,7 +123,6 @@ class PangoFontInfo { // Font properties set automatically from parsing the font description name. string family_name_; int font_size_; - bool is_italic_; FontTypeEnum font_type_; // The Pango description that was used to initialize the instance. PangoFontDescription* desc_;