From 5b3d1e2e437423d9f144caf5121a6d48bd14bef8 Mon Sep 17 00:00:00 2001 From: jcid Date: Sun, 21 Sep 2008 19:50:16 +0200 Subject: - Some i18n in view source and tab labels. --- src/ui.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/ui.cc') diff --git a/src/ui.cc b/src/ui.cc index 063540d9..0529f13f 100644 --- a/src/ui.cc +++ b/src/ui.cc @@ -19,6 +19,7 @@ #include #include #include // for mouse buttons and keys +#include // UI label font for tabs #include #include #include @@ -607,6 +608,10 @@ UI::UI(int x, int y, int ww, int wh, const char* label, const UI *cur_ui) : { int s_h = 20; + Font *f = font(prefs.vw_fontname, 0); + if (f) + this->labelfont(f); + Tabs = NULL; TabTooltip = NULL; TopGroup = new PackedGroup(0, 0, ww, wh); @@ -1081,10 +1086,17 @@ void UI::set_page_title(const char *label) this->window()->redraw_label(); if (tabs() && *label) { - const size_t tab_chars = 18; + size_t tab_chars = 18; snprintf(title, tab_chars + 1, "%s", label); - if (strlen(label) > tab_chars) + if (strlen(label) > tab_chars) { + while (label[tab_chars] & 0x80 && !(label[tab_chars] & 0x40) && + tab_chars < 23) { + // In the middle of a multibyte UTF-8 character. + title[tab_chars] = label[tab_chars]; + tab_chars++; + } snprintf(title + tab_chars, 4, "..."); + } this->copy_label(title); this->redraw_label(); -- cgit v1.2.3