Scale panel elements (issue #656)

This commit is contained in:
o9000
2018-01-17 05:19:32 +00:00
parent 12f04e3055
commit c7b23ee94a
18 changed files with 183 additions and 133 deletions

View File

@@ -934,7 +934,8 @@ void get_text_size2(const PangoFontDescription *font,
int text_len,
PangoWrapMode wrap,
PangoEllipsizeMode ellipsis,
gboolean markup)
gboolean markup,
double scale)
{
PangoRectangle rect_ink, rect;
@@ -945,7 +946,9 @@ void get_text_size2(const PangoFontDescription *font,
cairo_image_surface_create(CAIRO_FORMAT_ARGB32, available_height, available_width);
cairo_t *c = cairo_create(cs);
PangoLayout *layout = pango_cairo_create_layout(c);
PangoContext *context = pango_cairo_create_context(c);
pango_cairo_context_set_resolution(context, 96 * scale);
PangoLayout *layout = pango_layout_new(context);
pango_layout_set_width(layout, available_width * PANGO_SCALE);
pango_layout_set_height(layout, available_height * PANGO_SCALE);
pango_layout_set_wrap(layout, wrap);
@@ -964,6 +967,7 @@ void get_text_size2(const PangoFontDescription *font,
// fprintf(stderr, "tint2: dimension : %d - %d\n", rect_ink.height, rect.height);
g_object_unref(layout);
g_object_unref(context);
cairo_destroy(c);
cairo_surface_destroy(cs);
}