Skip to content

Commit

Permalink
Merging the UTF8 patch, consisting of O'ksi'd s original 1.1.6 patch …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Matthias Melcher committed Sep 10, 2008
1 parent dfb50e8 commit b6bde2e
Show file tree
Hide file tree
Showing 238 changed files with 36,562 additions and 932 deletions.
1 change: 1 addition & 0 deletions FL/Fl.H
Expand Up @@ -28,6 +28,7 @@
#ifndef Fl_H
# define Fl_H

# include "fl_utf8.H"
# include "Enumerations.H"
# ifndef Fl_Object
# define Fl_Object Fl_Widget
Expand Down
1 change: 1 addition & 0 deletions FL/Fl_Input.H
Expand Up @@ -34,6 +34,7 @@ class FL_EXPORT Fl_Input : public Fl_Input_ {
int handle_key();
int shift_position(int p);
int shift_up_down_position(int p);
void handle_mouse(int keepmark=0);
public:
void draw();
int handle(int);
Expand Down
13 changes: 12 additions & 1 deletion FL/fl_draw.H
Expand Up @@ -148,11 +148,12 @@ inline int fl_height(int, int size) {return size;}
FL_EXPORT int fl_descent();
FL_EXPORT double fl_width(const char*);
FL_EXPORT double fl_width(const char*, int n);
FL_EXPORT double fl_width(uchar);
FL_EXPORT double fl_width(Fl_Char);

// draw using current font:
FL_EXPORT void fl_draw(const char*, int x, int y);
FL_EXPORT void fl_draw(const char*, int n, int x, int y);
FL_EXPORT void fl_rtl_draw(const char*, int n, int x, int y);
FL_EXPORT void fl_measure(const char*, int& x, int& y, int draw_symbols = 1);
FL_EXPORT void fl_draw(const char*, int,int,int,int, Fl_Align, Fl_Image* img=0,
int draw_symbols = 1);
Expand Down Expand Up @@ -195,6 +196,16 @@ FL_EXPORT const char* fl_shortcut_label(int);
FL_EXPORT void fl_overlay_rect(int,int,int,int);
FL_EXPORT void fl_overlay_clear();
FL_EXPORT void fl_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
FL_EXPORT const char* fl_expand_text(const char* from, char* buf, int maxbuf,
double maxw, int& n, double &width,
int wrap, int draw_symbols = 0);

// XIM:
FL_EXPORT void fl_set_status(int X, int Y, int W, int H);
FL_EXPORT void fl_set_spot(int font, int size, int x, int y, int w, int h);
FL_EXPORT void fl_reset_spot(void);



// XForms symbols:
FL_EXPORT int fl_draw_symbol(const char* label,int x,int y,int w,int h, Fl_Color);
Expand Down
6 changes: 4 additions & 2 deletions FL/forms.H
Expand Up @@ -208,8 +208,10 @@ inline void fl_reset_focus_object(Fl_Widget* o) {Fl::focus(o);}

inline void fl_set_object_boxtype(Fl_Widget* o, Fl_Boxtype a) {o->box(a);}
inline void fl_set_object_lsize(Fl_Widget* o,int s) {o->labelsize(s);}

/* forms lib font indexes must be byte sized - extract correct byte from style word */
inline void fl_set_object_lstyle(Fl_Widget* o,int a) {
o->labelfont((Fl_Font)a); o->labeltype((Fl_Labeltype)(a>>8));}
o->labelfont((Fl_Font)(a&0xff)); o->labeltype((Fl_Labeltype)(a>>8));}
inline void fl_set_object_lcol(Fl_Widget* o, unsigned a) {o->labelcolor(a);}
#define fl_set_object_lcolor fl_set_object_lcol
inline void fl_set_object_lalign(Fl_Widget* o, Fl_Align a) {o->align(a);}
Expand Down Expand Up @@ -662,7 +664,7 @@ FL_EXPORT int fl_show_choice(
const char *b1,
const char *b2);

inline void fl_set_goodies_font(uchar a, uchar b) {fl_message_font(a,b);}
inline void fl_set_goodies_font(Fl_Font a, Fl_Fontsize b) {fl_message_font(a,b);}
#define fl_show_messages fl_message
inline int fl_show_choices(const char* c,int n,const char* b1,const char* b2,
const char* b3, int) {
Expand Down
2 changes: 1 addition & 1 deletion FL/glut.H
Expand Up @@ -407,7 +407,7 @@ FL_EXPORT GLUTproc glutGetProcAddress(const char *procName);
//inline void glutVideoPan(int x, int y, int width, int height);

// Font argument must be a void* for compatability, so...
extern FL_EXPORT struct Fl_Glut_Bitmap_Font {uchar font; int size;}
extern FL_EXPORT struct Fl_Glut_Bitmap_Font {Fl_Font font; Fl_Fontsize size;}
glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10,
glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12,
glutBitmapHelvetica18;
Expand Down
4 changes: 2 additions & 2 deletions FL/names.h
@@ -1,5 +1,5 @@
//
// "$Id:$"
// "$Id$"
//
// Event names header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -81,5 +81,5 @@ char *fl_fontnames[] =
#endif /* FL_NAMES_H */

//
// End of "$Id:$".
// End of "$Id$".
//
5 changes: 3 additions & 2 deletions FL/x.H
Expand Up @@ -50,7 +50,7 @@
# endif
# include <X11/Xatom.h>
# include "Fl_Window.H"

# include "Xutf8.h"
// Mirror X definition of Region to Fl_Region, for portability...
typedef Region Fl_Region;

Expand All @@ -68,7 +68,8 @@ extern FL_EXPORT Colormap fl_colormap;
// drawing functions:
extern FL_EXPORT GC fl_gc;
extern FL_EXPORT Window fl_window;
extern FL_EXPORT XFontStruct* fl_xfont;
//extern FL_EXPORT XFontStruct* fl_xfont;
extern FL_EXPORT XUtf8FontStruct* fl_xfont;
extern FL_EXPORT void *fl_xftfont;
FL_EXPORT ulong fl_xpixel(Fl_Color i);
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
Expand Down
95 changes: 95 additions & 0 deletions README.fltk118-utf
@@ -0,0 +1,95 @@
NOTES:
------
This is a cut down snapshot of fltk-1.1.x-r6041 merged in a somewhat
haphazard manner with the OksiD UTF-8 patch (for fltk-1.1.6)
Then some of the UTF functions from FLTK2 were back-ported into the
mix.

This code has also been modified to implement the XFT support on X
that was missing from the fltk-1.1.6 variant.

I have also introduced a number of extra test programs into the "demo"
directory - to test DnD operation, and to verify the behaviour Fl::add_fd()
on various platforms (this test also verifies some aspects of UDP multicast
operation that was causing issues on win32 with winsock-1.1.)
These two examples are accessed from the Demo program in the Events submenu.

There is also an extended font-chooser/unicode font display test, derived
from the utf8 test that OksiD had added to fltk-1.1.6-utf8.
This is accessed in the Demo program under the Other Tests/Font Tests
submenu.


This code has been tested on linux (FC7), WinXP with mingw
and OSX 10.4.11.
The OSX port MUST HAVE the QUARTZ mode enabled in configure to
work (the older fltk QD code will not work.)


Linux
-----
This code has been built with the following configure options
on the linux platform:

./configure --enable-threads --enable-xft

At present the code also works without XFT enabled (as the original OksiD
code did) but I can't count on that state of affairs being permanent!

./configure --enable-threads


WIN32
-----
On WinXP, the code was built with mingw in an Msys shell with the
following configure options:

./configure --enable-threads

Was used an a box that already has image libs installed.

./configure --enable-threads --enable-localjpeg --enable-localzlib --enable-localpng

Was used an a box that does not have image libs installed.

Both cases function as expected.

I do not have access to the MS compler tools here, so the code is untested with
their compilers. I do not think I have introduced any incompatabilities but...
Feedback welcome.

NOTE: The "standard" FLTK-1.1 build uses the (deprecated) winsock-1.1 libs.
This revised code uses the (allegedly) better winsock-2 libs instead.
This means you will probably have to change the link options in any existing
projects to incorporate this change - the libs are *NOT* reliably inter-changeable!
(fltk-utf8-config will return the correct libs for use.)


OSX
---
The OSX build was configured with:

./configure --enable-threads --enable-quartz


Issues
------
At time of writing, the code seems to "work", but there are issues:

- The build is "noisy".

- The gl font handling is not ideal under XFT (but it always was
anyway. We need a glXUseXftFont method really, but that doesn't seem
to exist...I could try and write one, but time...)

- The xim stuff is still needing work - I'm pretty sure I have broken this

- Input methods under win32? I don't know.

- Input Methods under OSX? No idea.

- The code is now badly formatted in places from all my random
cut'n'paste...

--
IMM: 24th Feb 2008

0 comments on commit b6bde2e

Please sign in to comment.