Obtain font style in copy handler.

This commit is contained in:
Michael Drake 2012-08-13 13:55:57 +01:00
parent 986bc5ff83
commit 68947c377e
1 changed files with 15 additions and 1 deletions

View File

@ -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;