From 68947c377ed358db310b32ee241db375e0b51de4 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 13 Aug 2012 13:55:57 +0100 Subject: Obtain font style in copy handler. --- desktop/selection.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/desktop/selection.c b/desktop/selection.c index 6679be6bc..436117a89 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -747,7 +747,8 @@ static bool selection_copy_handler(const char *text, size_t length, struct box *box, void *handle, const char *whitespace_text, size_t whitespace_length) { - bool add_space = box != NULL ? box->space != 0 : false; + bool add_space = false; + plot_font_style_t style = *plot_style_font; /* add any whitespace which precedes the text from this box */ if (whitespace_text != NULL && whitespace_length > 0) { @@ -757,6 +758,19 @@ static bool selection_copy_handler(const char *text, size_t length, } } + if (box != NULL) { + /* HTML */ + add_space = (box->space != 0); + + if (box->style != NULL) { + /* Override default font style */ + font_plot_style_from_css(box->style, &style); + } else { + /* If there's no style, there must be no text */ + assert(box->text == NULL); + } + } + /* add the text from this box */ if (!gui_add_to_clipboard(text, length, add_space)) return false; -- cgit v1.2.3