From c085d0704848aef622a714c12fdb82d0d6e08dc0 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 18 Sep 2014 17:22:23 +0800 Subject: [PATCH] fontface/fontoption: Check for CAIRO_HAS_FC_FONT This updates the fontface and fontoptions sources so that they will check for whether Cairo was built with FontConfig (in addition to FreeType) so that cairomm would still build when we have Cairo built with FreeType but without FontConfig, which for example may well be the case on Windows builds. https://bugs.freedesktop.org/show_bug.cgi?id=84033 --- cairomm/fontface.cc | 2 ++ cairomm/fontface.h | 4 ++++ cairomm/fontoptions.cc | 2 ++ cairomm/fontoptions.h | 2 ++ 4 files changed, 10 insertions(+) diff --git a/cairomm/fontface.cc b/cairomm/fontface.cc index cb1468f..8b85dce 100644 --- a/cairomm/fontface.cc +++ b/cairomm/fontface.cc @@ -390,6 +390,7 @@ FtFontFace::FtFontFace(FT_Face face, int load_flags) : check_status_and_throw_exception(cairo_font_face_status(m_cobject)); } +#ifdef CAIRO_HAS_FC_FONT RefPtr FtFontFace::create(FcPattern* pattern) { @@ -402,6 +403,7 @@ FtFontFace::FtFontFace(FcPattern* pattern) : { check_status_and_throw_exception(cairo_font_face_status(m_cobject)); } +#endif // CAIRO_HAS_FC_FONT void FtFontFace::set_synthesize(FtSynthesize synth_flags) { diff --git a/cairomm/fontface.h b/cairomm/fontface.h index 25268ca..699e7ab 100644 --- a/cairomm/fontface.h +++ b/cairomm/fontface.h @@ -438,6 +438,7 @@ public: static RefPtr create(FT_Face face, int load_flags); //TODO: Add a suitable default value for load_flags? +#ifdef CAIRO_HAS_FC_FONT /** Creates a new font face for the FreeType font backend based on a * fontconfig pattern. This font can then be used with Context::set_font_face() * or FtScaledFont::create(). @@ -467,6 +468,7 @@ public: * @since 1.8 */ static RefPtr create(FcPattern* pattern); +#endif // CAIRO_HAS_FC_FONT /** Sets synthesis options to control how FreeType renders the glyphs for a * particular font face. The given options are ORed with the currently active @@ -492,7 +494,9 @@ public: protected: FtFontFace(FT_Face face, int load_flags); +#ifdef CAIRO_HAS_FC_FONT FtFontFace(FcPattern* pattern); +#endif // CAIRO_HAS_FC_FONT }; #endif // CAIRO_HAS_FT_FONT diff --git a/cairomm/fontoptions.cc b/cairomm/fontoptions.cc index 2ba339d..abe0978 100644 --- a/cairomm/fontoptions.cc +++ b/cairomm/fontoptions.cc @@ -156,11 +156,13 @@ HintMetrics FontOptions::get_hint_metrics() const } #ifdef CAIRO_HAS_FT_FONT +#ifdef CAIRO_HAS_FC_FONT void FontOptions::substitute(FcPattern* pattern) { cairo_ft_font_options_substitute(cobj(), pattern); check_object_status_and_throw_exception(*this); } +#endif // CAIRO_HAS_FC_FONT #endif // CAIRO_HAS_FT_FONT } //namespace Cairo diff --git a/cairomm/fontoptions.h b/cairomm/fontoptions.h index a2430db..3059c69 100644 --- a/cairomm/fontoptions.h +++ b/cairomm/fontoptions.h @@ -138,6 +138,7 @@ public: HintMetrics get_hint_metrics() const; #ifdef CAIRO_HAS_FT_FONT +#ifdef CAIRO_HAS_FC_FONT /** Add options to a FcPattern based on a cairo_font_options_t font options * object. Options that are already in the pattern, are not overridden, so you * should call this function after calling FcConfigSubstitute() (the user's @@ -149,6 +150,7 @@ public: * @since 1.8 */ void substitute(FcPattern* pattern); +#endif // CAIRO_HAS_FC_FONT #endif // CAIRO_HAS_FT_FONT typedef cairo_font_options_t cobject; -- 1.8.4.msysgit.0