aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-04-14 23:20:03 +0200
committerThomas White <taw@bitwiz.org.uk>2013-04-14 23:20:03 +0200
commitbbec75db90f4601ff922c0493376a6eeff3f5254 (patch)
tree058b190e7a0a3269e210acef14edd2aa8db6ab36 /src
parent35e0e705272dd89f0a06d96b4767ce1e6f6e4dfe (diff)
Run the prologue
Diffstat (limited to 'src')
-rw-r--r--src/stylesheet.c11
-rw-r--r--src/wrap.c16
2 files changed, 22 insertions, 5 deletions
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 39513c9..c886ba1 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -83,6 +83,7 @@ void free_stylesheet(StyleSheet *ss)
for ( i=0; i<ss->n_styles; i++ ) {
free(ss->styles[i]->name);
+ free(ss->styles[i]->sc_prologue);
free(ss->styles[i]);
}
@@ -117,6 +118,7 @@ void default_stylesheet(StyleSheet *ss)
sty->lop.h_units = UNITS_SLIDE;
sty->lop.x = 0.0;
sty->lop.y = 300.0;
+ sty->sc_prologue = strdup("\\font[Sans 40]");
add_to_template(titlepage, sty);
sty = new_style(ss, "Slide title");
@@ -134,7 +136,8 @@ void default_stylesheet(StyleSheet *ss)
sty->lop.h_units = UNITS_SLIDE;
sty->lop.x = 0.0;
sty->lop.y = 0.0;
- sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}");
+ sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}"
+ "\\font[Sans 40]");
add_to_template(slide, sty);
sty = new_style(ss, "Slide title");
@@ -151,7 +154,8 @@ void default_stylesheet(StyleSheet *ss)
sty->lop.h_units = UNITS_SLIDE;
sty->lop.x = 0.0;
sty->lop.y = 0.0;
- sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}");
+ sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}"
+ "\\font[Sans 40]Acknowledgements");
add_to_template(acknowledgements, sty);
sty = new_style(ss, "Content");
@@ -169,7 +173,8 @@ void default_stylesheet(StyleSheet *ss)
sty->lop.h_units = UNITS_FRAC;
sty->lop.x = 0.0;
sty->lop.y = 0.0;
- sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}Acknowledgements");
+ sty->sc_prologue = strdup("\\bgcol{#00a6eb}\\fgcol{#ffffff}"
+ "\\font[Sans 24]");
add_to_template(acknowledgements, sty);
}
diff --git a/src/wrap.c b/src/wrap.c
index 414b56a..b3a1a1d 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -36,6 +36,7 @@
#include "storycode.h"
#include "wrap.h"
#include "frame.h"
+#include "stylesheet.h"
static void alloc_lines(struct frame *fr)
@@ -505,7 +506,8 @@ static void run_sc(const char *sc, struct sc_font *fonts, int *n_fonts,
}
-static struct wrap_line *sc_to_wrap_boxes(const char *sc, PangoContext *pc)
+static struct wrap_line *sc_to_wrap_boxes(const char *sc, const char *prefix,
+ PangoContext *pc)
{
struct wrap_line *boxes;
PangoLanguage *lang;
@@ -530,6 +532,9 @@ static struct wrap_line *sc_to_wrap_boxes(const char *sc, PangoContext *pc)
/* The "ultimate" default font */
fonts = push_font(fonts, "Sans 12", &n_fonts, &max_fonts, pc);
+ if ( prefix != NULL ) {
+ run_sc(prefix, fonts, &n_fonts, &max_fonts, pc, boxes, lang);
+ }
run_sc(sc, fonts, &n_fonts, &max_fonts, pc, boxes, lang);
for ( i=0; i<n_fonts; i++ ) {
@@ -1004,9 +1009,16 @@ int wrap_contents(struct frame *fr, PangoContext *pc)
int i;
const double rho = 2.0;
const double wrap_w = fr->w - fr->lop.pad_l - fr->lop.pad_r;
+ char *prologue;
+
+ if ( fr->style != NULL ) {
+ prologue = fr->style->sc_prologue;
+ } else {
+ prologue = NULL;
+ }
/* Turn the StoryCode into wrap boxes, all on one line */
- boxes = sc_to_wrap_boxes(fr->sc, pc);
+ boxes = sc_to_wrap_boxes(fr->sc, prologue, pc);
if ( boxes == NULL ) {
fprintf(stderr, "Failed to create wrap boxes.\n");
return 1;