summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2013-03-08 11:19:27 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2013-03-08 11:19:27 -0500
commita58def3677a6dc85a9da7bce25ce66b5fc8d2aea (patch)
tree3a7e0a09c2352ac7e91e3650d5d531ea88923b78
parent4574f803e8fc370e748047935bfc708478cf84ef (diff)
text size macros
-rw-r--r--pics.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/pics.c b/pics.c
index 6f9e5d4..a20ee20 100644
--- a/pics.c
+++ b/pics.c
@@ -12,6 +12,10 @@
#define SCALE_FACTOR 0.8
+#define TEXT_SIZE (1 / SCALE_FACTOR) * 14.0
+#define SUBHEADER_SIZE (1 / SCALE_FACTOR) * 16.0
+#define HEADER_SIZE (1 / SCALE_FACTOR) * 18.0
+
static cairo_t *
get_cairo (int width, int height)
{
@@ -150,7 +154,7 @@ centered_text (cairo_t *cr, double x, double y, const char *text)
CAIRO_FONT_WEIGHT_NORMAL);
cairo_new_path (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_set_font_size (cr, 14.0);
+ cairo_set_font_size (cr, TEXT_SIZE);
cairo_text_path (cr, text);
cairo_path_extents (cr, &x1, &y1, &x2, &y2);
cairo_new_path (cr);
@@ -171,7 +175,7 @@ cell_text (cairo_t *cr, double x, double y, const char *text)
cairo_set_source_rgb (cr, 0, 0, 0);
centered_text (cr,
x + CELL_WIDTH / 2.0 - 20.0,
- y + CELL_HEIGHT - 30, text);
+ y + CELL_HEIGHT - SCALE_FACTOR * 30, text);
}
static void
@@ -385,9 +389,7 @@ blend_header (cairo_t *cr, double x, double y, const char *header)
cairo_select_font_face (cr, "Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
- cairo_set_font_size (cr, 16.0);
-
- cairo_set_font_size (cr, 16.0);
+ cairo_set_font_size (cr, SUBHEADER_SIZE);
cairo_move_to (cr, XPAD - FIRSTCOL + 8, y + CELL_HEIGHT / 2 + 6);
cairo_show_text (cr, header);
cairo_restore (cr);
@@ -440,7 +442,7 @@ create_color_dodge_table (void)
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_set_font_size (cr, 18.0);
+ cairo_set_font_size (cr, HEADER_SIZE);
cairo_select_font_face (cr, "Sans",
CAIRO_FONT_SLANT_NORMAL,
@@ -455,7 +457,7 @@ create_color_dodge_table (void)
cairo_select_font_face (cr, "Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
- cairo_set_font_size (cr, 16.0);
+ cairo_set_font_size (cr, TEXT_SIZE);
cairo_move_to (cr, XPAD + FIRSTCOL + 7, YPAD / 2);
cairo_show_text (cr, "Neither");
@@ -472,7 +474,7 @@ create_color_dodge_table (void)
cairo_select_font_face (cr, "Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
- cairo_set_font_size (cr, 16.0);
+ cairo_set_font_size (cr, TEXT_SIZE);
cairo_move_to (cr, XPAD, YPAD + CELL_HEIGHT / 2 + 6);
cairo_show_text (cr, "Zero");