[PATCH] increase the font size while printing profiles and dive information

Lubomir I. Ivanov neolit123 at gmail.com
Wed Aug 22 10:24:30 PDT 2012


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

added the function set_profile_font_scale() in profile.c,
which allows to specify scale of the font before performing a plot().

increased the font size (FONT_NORMAL) in print.c to 30

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 display.h | 1 +
 print.c   | 4 +++-
 profile.c | 8 +++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/display.h b/display.h
index 341b161..307766e 100644
--- a/display.h
+++ b/display.h
@@ -23,6 +23,7 @@ struct graphics_context {
 };
 
 extern void plot(struct graphics_context *gc, cairo_rectangle_int_t *drawing_area, struct dive *dive);
+extern void set_profile_font_scale(int scale);
 extern void init_profile_background(struct graphics_context *gc);
 extern void attach_tooltip(int x, int y, int w, int h, const char *text);
 
diff --git a/print.c b/print.c
index 0bd3110..4b508a6 100644
--- a/print.c
+++ b/print.c
@@ -7,7 +7,7 @@
 #include "display.h"
 #include "display-gtk.h"
 
-#define FONT_NORMAL (12)
+#define FONT_NORMAL (30)
 #define FONT_SMALL (FONT_NORMAL / 1.2)
 #define FONT_LARGE (FONT_NORMAL * 1.2)
 
@@ -133,7 +133,9 @@ static void show_dive_profile(struct dive *dive, cairo_t *cr, double w, double h
 		.cr = cr
 	};
 	cairo_save(cr);
+	set_profile_font_scale(3);
 	plot(&gc, &drawing_area, dive);
+	set_profile_font_scale(1);
 	cairo_restore(cr);
 }
 
diff --git a/profile.c b/profile.c
index 9618c46..2843e65 100644
--- a/profile.c
+++ b/profile.c
@@ -14,6 +14,7 @@
 #include "color.h"
 
 int selected_dive = 0;
+int font_scale = 1;
 
 typedef enum { STABLE, SLOW, MODERATE, FAST, CRAZY } velocity_t;
 
@@ -226,7 +227,7 @@ static void plot_text(struct graphics_context *gc, const text_render_options_t *
 	vsnprintf(buffer, sizeof(buffer), fmt, args);
 	va_end(args);
 
-	cairo_set_font_size(cr, tro->size);
+	cairo_set_font_size(cr, tro->size * font_scale);
 	cairo_font_extents(cr, &fe);
 	cairo_text_extents(cr, buffer, &extents);
 	dx = tro->hpos * extents.width + extents.x_bearing;
@@ -1348,6 +1349,11 @@ static struct plot_info *create_plot_info(struct dive *dive, int nr_samples, str
 	return analyze_plot_info(pi);
 }
 
+void set_profile_font_scale(int scale)
+{
+	font_scale = scale;
+}
+
 void plot(struct graphics_context *gc, cairo_rectangle_int_t *drawing_area, struct dive *dive)
 {
 	struct plot_info *pi;
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list