summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-11-05 18:54:11 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2012-11-05 18:54:11 +0000
commit5621bca77233fd1906ac0487bf02a91f607e2b74 (patch)
tree8896ca3fe06819dde13834729ee29739c56698d9 /render
parentd0cb1d4e66662b31c3354e20f9ac290153f9bd39 (diff)
downloadnetsurf-5621bca77233fd1906ac0487bf02a91f607e2b74.tar.gz
netsurf-5621bca77233fd1906ac0487bf02a91f607e2b74.tar.bz2
Center broken object indicator.
Diffstat (limited to 'render')
-rw-r--r--render/html_redraw.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 77142c631..2b85f6c86 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -674,18 +674,25 @@ bool html_redraw_box(const html_content *html, struct box *box,
if (!content_redraw(box->object, &obj_data, &r, ctx)) {
/* Show image fail */
+ /* Unicode (U+FFFC) 'OBJECT REPLACEMENT CHARACTER' */
+ const char *obj = "\xef\xbf\xbc";
+ int obj_width;
+ int obj_x = x + padding_left;
if (!plot->rectangle(x + padding_left,
y + padding_top,
x + padding_left + width - 1,
y + padding_top + height - 1,
plot_style_broken_object))
return false;
- /* Show Unicode (U+FFFC) 'OBJECT REPLACEMENT CHARACTER'
- */
- if (!plot->text(x + padding_left,
- y + padding_top + (int)
+ if (!nsfont.font_width(plot_fstyle_broken_object, obj,
+ sizeof(obj) - 1, &obj_width))
+ obj_x += 1;
+ else
+ obj_x += width / 2 - obj_width / 2;
+
+ if (!plot->text(obj_x, y + padding_top + (int)
(height * 0.75 * scale),
- "\xef\xbf\xbc", 3,
+ obj, sizeof(obj) - 1,
plot_fstyle_broken_object))
return false;
}