~thalexander/unity/update-fsf-address

« back to all changes in this revision

Viewing changes to unity-shared/IconLoader.cpp

  • Committer: Marco Trevisan (Treviño)
  • Date: 2016-02-09 18:16:51 UTC
  • mto: This revision was merged to the branch mainline in revision 4082.
  • Revision ID: mail@3v1n0.net-20160209181651-vsoo81ztf3dpzvaf
Unity: use theme::Settings' font around

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <UnityCore/GLibWrapper.h>
36
36
 
37
37
#include "unity-shared/Timer.h"
 
38
#include "unity-shared/ThemeSettings.h"
38
39
#include "unity-shared/UnitySettings.h"
39
40
 
40
41
namespace unity
313
314
        glib::Object<PangoLayout> layout;
314
315
        PangoContext* pango_context = NULL;
315
316
        GdkScreen* screen = gdk_screen_get_default(); // not ref'ed
316
 
        glib::String font;
 
317
        auto const& font = theme::Settings::Get()->font();
317
318
 
318
 
        g_object_get(gtk_settings_get_default(), "gtk-font-name", &font, NULL);
319
319
        cairo_set_font_options(cr, gdk_screen_get_font_options(screen));
320
320
        layout = pango_cairo_create_layout(cr);
321
 
        std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font), pango_font_description_free);
 
321
        std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font.c_str()), pango_font_description_free);
322
322
        pango_font_description_set_weight(desc.get(), PANGO_WEIGHT_BOLD);
323
323
        int font_size = FONT_SIZE;
324
324
        pango_font_description_set_size (desc.get(), font_size * PANGO_SCALE);
914
914
{
915
915
  // FIXME: what about CJK?
916
916
  const char* const SAMPLE_MAX_TEXT = "Chromium Web Browser";
917
 
  GtkSettings* settings = gtk_settings_get_default();
918
917
 
919
918
  nux::CairoGraphics util_cg(CAIRO_FORMAT_ARGB32, 1, 1);
920
919
  cairo_t* cr = util_cg.GetInternalContext();
921
920
 
922
 
  glib::String font;
923
 
  g_object_get(settings, "gtk-font-name", &font, nullptr);
924
 
  std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font), pango_font_description_free);
 
921
  auto const& font = theme::Settings::Get()->font();
 
922
  std::shared_ptr<PangoFontDescription> desc(pango_font_description_from_string(font.c_str()), pango_font_description_free);
925
923
  pango_font_description_set_weight(desc.get(), PANGO_WEIGHT_BOLD);
926
924
  pango_font_description_set_size(desc.get(), FONT_SIZE * PANGO_SCALE);
927
925