aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-03-14 21:40:55 +0100
committerThomas White <taw@bitwiz.org.uk>2013-03-14 21:40:55 +0100
commit63292700eb6dd877a803c0af1adb4691cfcc97d5 (patch)
treedef76b11663ec5ebcc645e7c1b22e2c0524320b8
parentc26551b102c1eabf79c2aed591a7f58129002ccd (diff)
Wrapping fixes
-rw-r--r--src/render.c16
-rw-r--r--src/wrap.c9
-rw-r--r--tests/render_test.c8
3 files changed, 21 insertions, 12 deletions
diff --git a/src/render.c b/src/render.c
index 42898d8..684f160 100644
--- a/src/render.c
+++ b/src/render.c
@@ -124,8 +124,8 @@ static void render_lines(struct frame *fr, cairo_t *cr)
render_boxes(&fr->lines[i], cr);
if ( fr->lines[i].overfull ) {
- cairo_move_to(cr, fr->w, 0.0);
- cairo_line_to(cr, fr->w,
+ cairo_move_to(cr, fr->w - fr->lop.pad_l - fr->lop.pad_r, 0.0);
+ cairo_line_to(cr, fr->w - fr->lop.pad_l - fr->lop.pad_r,
pango_units_to_double(fr->lines[i].height));
cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
cairo_set_line_width(cr, 4.0);
@@ -240,6 +240,7 @@ static int render_frame(struct frame *fr, cairo_t *cr)
mtot = ch->lop.margin_l + ch->lop.margin_r;
+ mtot += fr->lop.pad_l + fr->lop.pad_r;
switch ( ch->lop.w_units ) {
case UNITS_SLIDE :
@@ -253,6 +254,7 @@ static int render_frame(struct frame *fr, cairo_t *cr)
}
mtot = ch->lop.margin_t + ch->lop.margin_b;
+ mtot += fr->lop.pad_t + fr->lop.pad_b;
switch ( ch->lop.h_units ) {
case UNITS_SLIDE :
@@ -264,11 +266,11 @@ static int render_frame(struct frame *fr, cairo_t *cr)
break;
}
-
+
render_frame(ch, cr);
- ch->x = ch->lop.x + ch->lop.margin_l;
- ch->y = ch->lop.y + ch->lop.margin_t;
+ ch->x = ch->lop.x + fr->lop.pad_l + ch->lop.margin_l;
+ ch->y = ch->lop.y + fr->lop.pad_t + ch->lop.margin_t;
}
@@ -395,6 +397,10 @@ cairo_surface_t *render_slide(struct slide *s, int w, int h)
cairo_set_line_width(cr, 1.0);
cairo_stroke(cr);
+ if ( s->top->style != NULL ) {
+ memcpy(&s->top->lop, &s->top->style->lop,
+ sizeof(struct layout_parameters));
+ }
s->top->lop.x = 0.0;
s->top->lop.y = 0.0;
s->top->lop.w = w;
diff --git a/src/wrap.c b/src/wrap.c
index aeb98e7..657f3fd 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -344,7 +344,7 @@ static double sp_x(enum wrap_box_space s)
switch ( s ) {
case WRAP_SPACE_INTERWORD :
- return 20.0*PANGO_SCALE;
+ return 10.0*PANGO_SCALE;
case WRAP_SPACE_EOP :
default:
@@ -363,7 +363,7 @@ static double sp_y(enum wrap_box_space s)
switch ( s ) {
case WRAP_SPACE_INTERWORD :
- return 10.0*PANGO_SCALE;
+ return 30.0*PANGO_SCALE;
case WRAP_SPACE_EOP :
default:
@@ -707,6 +707,7 @@ int wrap_contents(struct frame *fr, PangoContext *pc)
{
struct wrap_line *boxes;
int i;
+ const double wrap_w = fr->w - fr->lop.pad_l - fr->lop.pad_r;
/* Turn the StoryCode into wrap boxes, all on one line */
boxes = sc_to_wrap_boxes(fr->sc, pc);
@@ -715,10 +716,10 @@ int wrap_contents(struct frame *fr, PangoContext *pc)
return 1;
}
- knuth_suboptimal_fit(boxes, fr->w - fr->lop.pad_l - fr->lop.pad_r, fr);
+ knuth_suboptimal_fit(boxes, wrap_w, fr);
for ( i=0; i<fr->n_lines; i++ ) {
- distribute_spaces(&fr->lines[i], fr->w);
+ distribute_spaces(&fr->lines[i], wrap_w);
calc_line_geometry(&fr->lines[i]);
}
diff --git a/tests/render_test.c b/tests/render_test.c
index a42e2e7..709926a 100644
--- a/tests/render_test.c
+++ b/tests/render_test.c
@@ -1,11 +1,13 @@
/*
* render_test.c
*
- * Colloquium - A tiny presentation program
+ * Rendering test
*
- * Copyright (c) 2012 Thomas White <taw@bitwiz.org.uk>
+ * Copyright © 2012-2013 Thomas White <taw@bitwiz.org.uk>
*
- * This program is free software: you can redistribute it and/or modify
+ * This file is part of Colloquium.
+ *
+ * Colloquium is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.