aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-02-06 22:19:51 +0100
committerThomas White <taw@bitwiz.org.uk>2015-02-06 22:19:51 +0100
commitbeac19ff683680df00d05070f707f06764941e97 (patch)
tree9e636fdcc2c1b93c76f078446404e62470bc20ca
parent1eeb30b14b0d440eedab43f75a4812d301c9dbfc (diff)
Wrapping fixes
-rw-r--r--src/shape.c32
-rw-r--r--src/wrap.c4
2 files changed, 33 insertions, 3 deletions
diff --git a/src/shape.c b/src/shape.c
index d51186c..e517337 100644
--- a/src/shape.c
+++ b/src/shape.c
@@ -1,7 +1,7 @@
/*
* shape.c
*
- * Copyright © 2014 Thomas White <taw@bitwiz.org.uk>
+ * Copyright © 2014-2015 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of Colloquium.
*
@@ -99,6 +99,31 @@ static void add_wrap_box(gpointer vi, gpointer vb)
}
+static void add_nothing_box(struct wrap_line *line, SCBlock *scblock,
+ int editable)
+{
+ struct wrap_box *box;
+
+ if ( line->n_boxes == line->max_boxes ) {
+ line->max_boxes += 32;
+ alloc_boxes(line);
+ if ( line->n_boxes == line->max_boxes ) return;
+ }
+
+ box = &line->boxes[line->n_boxes];
+ box->type = WRAP_BOX_NOTHING;
+ box->scblock = scblock;
+ box->offs_char = 0;
+ box->space = WRAP_SPACE_EOP;
+ box->width = 0;
+ box->ascent = 0;
+ box->height = 0;
+ box->filename = NULL;
+ box->editable = editable;
+ line->n_boxes++;
+}
+
+
/* Add "text", followed by a space of type "space", to "line" */
static int add_wrap_boxes(struct wrap_line *line, const char *text,
enum wrap_box_space space, PangoContext *pc,
@@ -110,6 +135,11 @@ static int add_wrap_boxes(struct wrap_line *line, const char *text,
PangoAttribute *attr;
struct box_adding_stuff bas;
+ if ( (strlen(text) == 1) && (text[0] == '\n') ) {
+ add_nothing_box(line, bl, editable);
+ return 0;
+ }
+
attrs = pango_attr_list_new();
attr = pango_attr_font_desc_new(sc_interp_get_fontdesc(scin));
pango_attr_list_insert_before(attrs, attr);
diff --git a/src/wrap.c b/src/wrap.c
index 14702a7..316e123 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -1,9 +1,9 @@
/*
* wrap.c
*
- * Text wrapping, hyphenation, justification and shaping
+ * Text wrapping, hyphenation, justification etc
*
- * Copyright © 2013-2014 Thomas White <taw@bitwiz.org.uk>
+ * Copyright © 2013-2015 Thomas White <taw@bitwiz.org.uk>
*
* This file is part of Colloquium.
*