summaryrefslogtreecommitdiff
path: root/src/Fl_Help_View.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2008-09-10 23:56:49 +0000
committerMatthias Melcher <fltk@matthiasm.com>2008-09-10 23:56:49 +0000
commitb6bde2e4569aa617c8a6af64947c688c624ed7f8 (patch)
tree010d15843eb7d4faf7cd1b0cd44d5b9c00462a83 /src/Fl_Help_View.cxx
parentdfb50e85292687561927610e689eb5ab30d0ba26 (diff)
Merging the UTF8 patch, consisting of O'ksi'd s original 1.1.6 patch and additions by Ian. PLEASE BE AWARE that the patch in its current incarnation is a regression in many aspects and further work is required before we can announce Unicode support.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6212 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Help_View.cxx')
-rw-r--r--src/Fl_Help_View.cxx43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx
index 079d9851d..088f6006a 100644
--- a/src/Fl_Help_View.cxx
+++ b/src/Fl_Help_View.cxx
@@ -61,6 +61,7 @@
#include <FL/x.H>
#include <stdio.h>
#include <stdlib.h>
+#include <FL/fl_utf8.H>
#include "flstring.h"
#include <ctype.h>
#include <errno.h>
@@ -717,13 +718,13 @@ Fl_Help_View::draw()
if (strcasecmp(buf, "LI") == 0)
{
-#ifdef __APPLE_QUARTZ__
- fl_font(FL_SYMBOL, fsize);
- hv_draw("\245", xx - fsize + x() - leftline_, yy + y());
-#else
- fl_font(FL_SYMBOL, fsize);
- hv_draw("\267", xx - fsize + x() - leftline_, yy + y());
-#endif
+// fl_font(FL_SYMBOL, fsize); // The default SYMBOL font on my XP box is not Unicode...
+ char buf[8];
+ wchar_t b[] = {0x2022, 0x0};
+// buf[fl_unicode2utf(b, 1, buf)] = 0;
+ unsigned dstlen = fl_utf8fromwc(buf, 8, b, 1);
+ buf[dstlen] = 0;
+ hv_draw(buf, xx - fsize + x() - leftline_, yy + y());
}
pushfont(font, fsize);
@@ -950,7 +951,10 @@ Fl_Help_View::draw()
if (qch < 0)
*s++ = '&';
else {
- *s++ = qch;
+ int l;
+ l = fl_utf8encode((unsigned int) qch, s);
+ if (l < 1) l = 1;
+ s += l;
ptr = strchr(ptr, ';') + 1;
}
@@ -1480,6 +1484,7 @@ Fl_Help_View::format()
popfont(font, fsize);
+ //#warning FIXME this isspace & 255 test will probably not work on a utf8 stream... And we use it everywhere!
while (isspace((*ptr)&255))
ptr ++;
@@ -1760,7 +1765,10 @@ Fl_Help_View::format()
if (qch < 0)
*s++ = '&';
else {
- *s++ = qch;
+ int l;
+ l = fl_utf8encode((unsigned int) qch, s);
+ if (l < 1) l = 1;
+ s += l;
ptr = strchr(ptr, ';') + 1;
}
@@ -2202,6 +2210,10 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
if (qch < 0)
*s++ = '&';
else {
+// int l;
+// l = fl_utf8encode((unsigned int) qch, s);
+// if (l < 1) l = 1;
+// s += l;
*s++ = qch;
ptr = strchr(ptr, ';') + 1;
}
@@ -2311,7 +2323,7 @@ Fl_Help_View::format_table(int *table_width, // O - Total table width
void
Fl_Help_View::free_data() {
- // Releae all images...
+ // Release all images...
if (value_) {
const char *ptr, // Pointer into block
*attrs; // Pointer to start of element attributes
@@ -2605,7 +2617,7 @@ Fl_Help_View::get_image(const char *name, int W, int H) {
} else if (name[0] != '/' && strchr(name, ':') == NULL) {
if (directory_[0]) snprintf(temp, sizeof(temp), "%s/%s", directory_, name);
else {
- getcwd(dir, sizeof(dir));
+ fl_getcwd(dir, sizeof(dir));
snprintf(temp, sizeof(temp), "file:%s/%s", dir, name);
}
@@ -2696,7 +2708,7 @@ void Fl_Help_View::follow_link(Fl_Help_Link *linkp)
snprintf(temp, sizeof(temp), "%s/%s", directory_, linkp->filename);
else
{
- getcwd(dir, sizeof(dir));
+ fl_getcwd(dir, sizeof(dir));
snprintf(temp, sizeof(temp), "file:%s/%s", dir, linkp->filename);
}
}
@@ -3139,7 +3151,7 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
if (strncmp(localname, "file:", 5) == 0)
localname += 5; // Adjust for local filename...
- if ((fp = fopen(localname, "rb")) != NULL)
+ if ((fp = fl_fopen(localname, "rb")) != NULL)
{
fseek(fp, 0, SEEK_END);
len = ftell(fp);
@@ -3296,11 +3308,8 @@ Fl_Help_View::value(const char *v) // I - Text to view
#ifdef ENC
# undef ENC
#endif
-#ifdef __APPLE__
-# define ENC(a, b) b
-#else
+// part b in the table seems to be mac_roman - beku
# define ENC(a, b) a
-#endif
//
// 'quote_char()' - Return the character code associated with a quoted char.