summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2017-04-19 12:04:00 +0200
committerMurray Cumming <murrayc@murrayc.com>2017-04-19 12:36:12 +0200
commit2c2e56715a6ff971c60f3adaab027b06870a5179 (patch)
treefbf54163c297d8ec1dd65aa6533d32c1b9fc0764
parent2adabd4e5712f2574b0e2396504114961bbf3a17 (diff)
Change Cairo::HintStyle enum to Cairo::FontOptions::HintStyle.
And change this from an old-style enum to a C++11 enum class.
-rw-r--r--cairomm/enums.h40
-rw-r--r--cairomm/fontoptions.cc2
-rw-r--r--cairomm/fontoptions.h39
-rw-r--r--examples/text/text-rotate.cc2
4 files changed, 41 insertions, 42 deletions
diff --git a/cairomm/enums.h b/cairomm/enums.h
index 821fd56..2ac1245 100644
--- a/cairomm/enums.h
+++ b/cairomm/enums.h
@@ -157,46 +157,6 @@ typedef enum
/**
- * Specifies the type of hinting to do on font outlines. Hinting is the process
- * of fitting outlines to the pixel grid in order to improve the appearance of
- * the result. Since hinting outlines involves distorting them, it also reduces
- * the faithfulness to the original outline shapes. Not all of the outline
- * hinting styles are supported by all font backends.
- *
- * New entries may be added in future versions.
- **/
-typedef enum
-{
- /**
- * Use the default hint style for font backend and target device
- */
- HINT_STYLE_DEFAULT = CAIRO_HINT_STYLE_DEFAULT,
-
- /**
- * Do not hint outlines
- */
- HINT_STYLE_NONE = CAIRO_HINT_STYLE_NONE,
-
- /**
- * Hint outlines slightly to improve contrast while retaining food fidelity
- * to the original shapes
- */
- HINT_STYLE_SLIGHT = CAIRO_HINT_STYLE_SLIGHT,
-
- /**
- * Hint outlines with medium strength giving a compromise between fidelity
- * to the original shapes and contrast
- */
- HINT_STYLE_MEDIUM = CAIRO_HINT_STYLE_MEDIUM,
-
- /**
- * Hint outlines to maximize contrast
- */
- HINT_STYLE_FULL = CAIRO_HINT_STYLE_FULL
-} HintStyle;
-
-
-/**
* Specifies whether to hint font metrics; hinting font metrics means quantizing
* them so that they are integer values in device space. Doing this improves the
* consistency of letter and line spacing, however it also means that text will
diff --git a/cairomm/fontoptions.cc b/cairomm/fontoptions.cc
index 71198cb..2d7f2e4 100644
--- a/cairomm/fontoptions.cc
+++ b/cairomm/fontoptions.cc
@@ -133,7 +133,7 @@ void FontOptions::set_hint_style(HintStyle hint_style)
check_object_status_and_throw_exception(*this);
}
-HintStyle FontOptions::get_hint_style() const
+FontOptions::HintStyle FontOptions::get_hint_style() const
{
const auto result = static_cast<HintStyle>(cairo_font_options_get_hint_style(m_cobject));
check_object_status_and_throw_exception(*this);
diff --git a/cairomm/fontoptions.h b/cairomm/fontoptions.h
index 3059c69..74bfb5a 100644
--- a/cairomm/fontoptions.h
+++ b/cairomm/fontoptions.h
@@ -38,6 +38,45 @@ namespace Cairo
class FontOptions
{
public:
+ /**
+ * Specifies the type of hinting to do on font outlines. Hinting is the process
+ * of fitting outlines to the pixel grid in order to improve the appearance of
+ * the result. Since hinting outlines involves distorting them, it also reduces
+ * the faithfulness to the original outline shapes. Not all of the outline
+ * hinting styles are supported by all font backends.
+ *
+ * New entries may be added in future versions.
+ **/
+ enum class HintStyle
+ {
+ /**
+ * Use the default hint style for font backend and target device
+ */
+ DEFAULT = CAIRO_HINT_STYLE_DEFAULT,
+
+ /**
+ * Do not hint outlines
+ */
+ NONE = CAIRO_HINT_STYLE_NONE,
+
+ /**
+ * Hint outlines slightly to improve contrast while retaining food fidelity
+ * to the original shapes
+ */
+ SLIGHT = CAIRO_HINT_STYLE_SLIGHT,
+
+ /**
+ * Hint outlines with medium strength giving a compromise between fidelity
+ * to the original shapes and contrast
+ */
+ MEDIUM = CAIRO_HINT_STYLE_MEDIUM,
+
+ /**
+ * Hint outlines to maximize contrast
+ */
+ FULL = CAIRO_HINT_STYLE_FULL
+ };
+
FontOptions();
explicit FontOptions(cairo_font_options_t* cobject, bool take_ownership = false);
FontOptions(const FontOptions& src);
diff --git a/examples/text/text-rotate.cc b/examples/text/text-rotate.cc
index bf7c24f..ce57338 100644
--- a/examples/text/text-rotate.cc
+++ b/examples/text/text-rotate.cc
@@ -50,7 +50,7 @@ void draw(Cairo::RefPtr<Cairo::Context> cr, int width, int height)
Cairo::FontOptions font_options;
- font_options.set_hint_style(Cairo::HINT_STYLE_NONE);
+ font_options.set_hint_style(Cairo::FontOptions::HintStyle::NONE);
font_options.set_hint_metrics(Cairo::HINT_METRICS_OFF);
font_options.set_antialias(Cairo::ANTIALIAS_GRAY);