summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android/jni/Android.mk1
-rw-r--r--FL/Fl_Window.H1
-rw-r--r--src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_font.cxx48
-rw-r--r--src/drivers/Pico/Fl_Pico_Graphics_Driver.cxx57
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx6
-rw-r--r--src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx4
-rw-r--r--test/fonts.cxx190
7 files changed, 258 insertions, 49 deletions
diff --git a/Android/jni/Android.mk b/Android/jni/Android.mk
index dd01f0d5d..abe6c0daa 100644
--- a/Android/jni/Android.mk
+++ b/Android/jni/Android.mk
@@ -135,7 +135,6 @@ LOCAL_SRC_FILES := \
src/Fl_lock.cxx \
src/Fl_own_colormap.cxx \
src/Fl_visual.cxx \
- src/Fl_x.cxx \
src/filename_absolute.cxx \
src/filename_expand.cxx \
src/filename_ext.cxx \
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
index 317c66247..7735a5ed1 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -69,6 +69,7 @@ class FL_EXPORT Fl_Window : public Fl_Group {
friend int Fl::arg(int argc, char **argv, int &i);
friend class Fl_X;
friend class Fl_Window_Driver;
+ friend class Fl_PicoAndroid_Window_Driver;
Fl_X *i; // points at the system-specific stuff, but exists only after the window is mapped
Fl_Window_Driver *pWindowDriver; // points at the system-specific stuff at window creatino time
diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_font.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_font.cxx
index 97507fc2d..a664128bd 100644
--- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_font.cxx
+++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_font.cxx
@@ -58,24 +58,42 @@
static const char *font_data[128] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- /* */0, /*!*/"\31\34\100\35\36", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, /*B*/"\43\54\45\15\11\41\52\43\13", 0, 0, /*E*/"\51\11\15\55\100\13\43", 0, 0,
- /*H*/"\11\15\100\61\65\100\13\63", 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, /*T*/"\11\71\100\41\45", 0, 0, /*W*/"\01\15\33\55\61",
- /*X*/"\15\51\100\11\55", 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, /*d*/"\64\55\55\25\14\13\22\52\63\100\61\65", /*e*/"\55\25\14\13\22\52\63\64\14", 0, 0,
- 0, /*i*/"\31\32\100\23\33\35\100\25\45", 0, 0, /*l*/"\31\34\45", 0, /*n*/"\15\12\100\13\22\42\53\55", /*o*/"\55\25\14\13\22\52\63\64\55",
- /*p*/"\17\12\42\53\54\45\15", 0, /*r*/"\25\22\100\23\32\52", /*s*/"\62\22\13\64\55\15", /*t*/"\41\44\55\65\100\22\62", 0, 0, 0,
- /*x*/"\15\52\100\12\55", 0, 0, 0, 0, 0, 0, 0,
+ /*00*/0, /*01*/0, /*02*/0, /*03*/0,
+ /*04*/0, /*05*/0, /*06*/0, /*07*/0,
+ /*08*/0, /*09*/0, /*0A*/0, /*0B*/0,
+ /*0C*/0, /*0D*/0, /*0E*/0, /*0F*/0,
+ /*10*/0, /*11*/0, /*12*/0, /*13*/0,
+ /*14*/0, /*15*/0, /*16*/0, /*17*/0,
+ /*18*/0, /*19*/0, /*1A*/0, /*1B*/0,
+ /*1C*/0, /*1D*/0, /*1E*/0, /*1F*/0,
+ /* */0, /*!*/"\31\34\100\35\36", /*"*/"\31\22\100\51\42", /*#*/"\31\15\100\61\45\100\12\72\100\04\64",
+ /*$*/"\62\51\11\02\13\53\64\55\15\04\100\30\36", /*%*/"\21\11\02\13\23\32\21\100\15\51\100\34\43\53\64\55\45\34", /*&*/"\63\45\15\04\13\52\41\21\12\65", /*'*/"\31\22",
+ /*(*/"\51\32\23\24\35\56", /*)*/"\21\42\53\54\45\26", /***/"\31\33\15\100\33\55\100\02\33\62", /*+*/"\35\31\100\03\63",
+ /*,*/"\35\45\36", /*-*/"\13\53", /*.*/"\35\36", /*/*/"\51\15",
+ /*0*/"\21\12\14\25\55\64\62\51\21\100\24\52", /*1*/"\22\41\45", /*2*/"\12\21\51\62\53\24\15\65", /*3*/"\12\21\51\62\53\64\55\25\14\100\53\33",
+ /*4*/"\55\51\04\64", /*5*/"\14\25\55\64\53\13\21\61", /*6*/"\62\51\21\12\14\25\55\64\53\13", /*7*/"\11\61\33\25",
+ /*8*/"\12\21\51\62\53\64\55\25\14\23\12\100\23\53", /*9*/"\14\25\55\64\62\51\21\12\23\63", /*:*/"\32\33\100\35\36", /*;*/"\32\33\100\25\35\26",
+ /*<*/"\62\13\64", /*=*/"\12\62\100\14\64", /*>*/"\12\63\14", /*?*/"\12\21\51\62\43\34\35\100\36\37",
+ /*@*/"\56\16\05\02\11\51\62\64\55\35\24\23\32\52\63", /*A*/"\05\31\65\100\14\54", /*B*/"\11\51\62\53\64\55\15\11\100\13\53", /*C*/"\62\51\11\02\04\15\55\64",
+ /*D*/"\11\51\62\64\55\15\11", /*E*/"\61\11\15\65\100\13\53", /*F*/"\61\11\15\100\13\53", /*G*/"\62\51\11\02\04\15\55\64\63\33",
+ /*H*/"\11\15\100\61\65\100\13\63", /*I*/"\21\41\100\25\45\100\35\31", /*J*/"\51\54\45\15\04", /*K*/"\11\15\100\14\61\100\65\33",
+ /*L*/"\11\15\65", /*M*/"\05\01\35\61\65", /*N*/"\05\01\65\61", /*O*/"\02\11\51\62\64\55\15\04\02",
+ /*P*/"\15\11\51\62\53\13", /*Q*/"\02\11\51\62\64\55\15\04\02\100\65\34", /*R*/"\15\11\51\62\53\13\100\33\65", /*S*/"\62\51\11\02\13\53\64\55\15\04",
+ /*T*/"\01\61\100\31\35", /*U*/"\61\64\55\15\04\01", /*V*/"\01\35\61", /*W*/"\01\15\31\55\61",
+ /*X*/"\01\65\100\05\61", /*Y*/"\01\33\35\100\33\61", /*Z*/"\01\61\05\65", /*[*/"\51\31\36\56",
+ /*\*/"\21\55", /*]*/"\21\41\46\26", /*^*/"\13\31\53", /*_*/"\06\76",
+ /*`*/"\31\42", /*a*/"\22\52\63\65\100\63\23\14\25\55\64", /*b*/"\11\15\100\14\25\55\64\63\52\22\13", /*c*/"\63\52\22\13\14\25\55\64",
+ /*d*/"\61\65\100\64\55\25\14\13\22\52\63", /*e*/"\64\63\52\22\13\14\25\55\100\64\14", /*f*/"\35\32\41\51\100\22\52", /*g*/"\62\65\56\26\100\63\52\22\13\14\25\55\64",
+ /*h*/"\11\15\100\65\63\52\22\13", /*i*/"\31\32\100\33\100\23\33\35\100\25\45", /*j*/"\31\32\100\33\35\26\16", /*k*/"\11\15\100\14\62\100\33\65",
+ /*l*/"\31\34\45\55", /*m*/"\05\02\100\03\12\22\33\35\100\33\42\52\63\65", /*n*/"\12\15\100\13\22\52\63\65", /*o*/"\22\13\14\25\55\64\63\52\22",
+ /*p*/"\16\12\100\13\22\52\63\64\55\25\14", /*q*/"\62\66\100\63\52\22\13\14\25\55\64", /*r*/"\22\25\100\23\32\42\53", /*s*/"\63\52\22\13\64\55\25\14",
+ /*t*/"\31\34\45\55\100\22\42", /*u*/"\12\14\25\55\64\62\100\64\65", /*v*/"\62\35\02", /*w*/"\02\15\32\55\62",
+ /*x*/"\62\15\100\65\12", /*y*/"\12\45\62\100\45\36\16", /*z*/"\12\62\15\65", /*{*/"\51\41\32\33\24\35\36\47\57\100\14\24",
+ /*|*/"\31\37", /*}*/"\21\31\42\43\54\64\100\54\45\46\37\27", /*~*/"\12\21\31\42\52\61", /*7F*/0
};
+
double Fl_OpenGL_Graphics_Driver::width(const char *str, int n) {
return size_*n*0.5;
}
diff --git a/src/drivers/Pico/Fl_Pico_Graphics_Driver.cxx b/src/drivers/Pico/Fl_Pico_Graphics_Driver.cxx
index 3968ea756..a7109062c 100644
--- a/src/drivers/Pico/Fl_Pico_Graphics_Driver.cxx
+++ b/src/drivers/Pico/Fl_Pico_Graphics_Driver.cxx
@@ -227,31 +227,38 @@ void Fl_Pico_Graphics_Driver::delete_bitmask(Fl_Bitmask bm)
static const char *font_data[128] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- /* */0, /*!*/"\31\34\100\35\36", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- /*0*/"\62\51\21\12\14\25\55\64\62\100\52\61",
- /*1*/"\22\31\35\100\25\45",
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 0,
- /*A*/"\15\31\55\100\23\43",
- /*B*/"\43\54\45\15\11\41\52\43\13",
- /*C*/"\62\51\21\12\14\25\55\64",
- /*D*/"\11\51\62\64\55\15\11",
- /*E*/"\61\11\15\65\100\13\43",
- /*F*/"\61\11\15\100\13\43",
- /*G*/"\62\51\21\12\14\25\55\64\100\65\63\33",
- /*H*/"\11\15\100\61\65\100\13\63",
- /*I*/"\21\41\100\31\35\100\25\45", 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, /*T*/"\11\71\100\41\45", 0, 0, /*W*/"\01\15\33\55\61",
- /*X*/"\15\51\100\11\55", 0, 0, 0, 0, 0, 0, 0,
-
- 0, 0, 0, 0, /*d*/"\64\55\55\25\14\13\22\52\63\100\61\65", /*e*/"\55\25\14\13\22\52\63\64\14", 0, 0,
- 0, /*i*/"\31\32\100\23\33\35\100\25\45", 0, 0, /*l*/"\31\34\45", 0, /*n*/"\15\12\100\13\22\42\53\55", /*o*/"\55\25\14\13\22\52\63\64\55",
- /*p*/"\17\12\42\53\54\45\15", 0, /*r*/"\25\22\100\23\32\52", /*s*/"\62\22\13\64\55\15", /*t*/"\41\44\55\65\100\22\62", 0, 0, 0,
- /*x*/"\15\52\100\12\55", 0, 0, 0, 0, 0, 0, 0,
+ /*00*/0, /*01*/0, /*02*/0, /*03*/0,
+ /*04*/0, /*05*/0, /*06*/0, /*07*/0,
+ /*08*/0, /*09*/0, /*0A*/0, /*0B*/0,
+ /*0C*/0, /*0D*/0, /*0E*/0, /*0F*/0,
+ /*10*/0, /*11*/0, /*12*/0, /*13*/0,
+ /*14*/0, /*15*/0, /*16*/0, /*17*/0,
+ /*18*/0, /*19*/0, /*1A*/0, /*1B*/0,
+ /*1C*/0, /*1D*/0, /*1E*/0, /*1F*/0,
+ /* */0, /*!*/"\31\34\100\35\36", /*"*/"\31\22\100\51\42", /*#*/"\31\15\100\61\45\100\12\72\100\04\64",
+ /*$*/"\62\51\11\02\13\53\64\55\15\04\100\30\36", /*%*/"\21\11\02\13\23\32\21\100\15\51\100\34\43\53\64\55\45\34", /*&*/"\63\45\15\04\13\52\41\21\12\65", /*'*/"\31\22",
+ /*(*/"\51\32\23\24\35\56", /*)*/"\21\42\53\54\45\26", /***/"\31\33\15\100\33\55\100\02\33\62", /*+*/"\35\31\100\03\63",
+ /*,*/"\35\45\36", /*-*/"\13\53", /*.*/"\35\36", /*/*/"\51\15",
+ /*0*/"\21\12\14\25\55\64\62\51\21\100\24\52", /*1*/"\22\41\45", /*2*/"\12\21\51\62\53\24\15\65", /*3*/"\12\21\51\62\53\64\55\25\14\100\53\33",
+ /*4*/"\55\51\04\64", /*5*/"\14\25\55\64\53\13\21\61", /*6*/"\62\51\21\12\14\25\55\64\53\13", /*7*/"\11\61\33\25",
+ /*8*/"\12\21\51\62\53\64\55\25\14\23\12\100\23\53", /*9*/"\14\25\55\64\62\51\21\12\23\63", /*:*/"\32\33\100\35\36", /*;*/"\32\33\100\25\35\26",
+ /*<*/"\62\13\64", /*=*/"\12\62\100\14\64", /*>*/"\12\63\14", /*?*/"\12\21\51\62\43\34\35\100\36\37",
+ /*@*/"\56\16\05\02\11\51\62\64\55\35\24\23\32\52\63", /*A*/"\05\31\65\100\14\54", /*B*/"\11\51\62\53\64\55\15\11\100\13\53", /*C*/"\62\51\11\02\04\15\55\64",
+ /*D*/"\11\51\62\64\55\15\11", /*E*/"\61\11\15\65\100\13\53", /*F*/"\61\11\15\100\13\53", /*G*/"\62\51\11\02\04\15\55\64\63\33",
+ /*H*/"\11\15\100\61\65\100\13\63", /*I*/"\21\41\100\25\45\100\35\31", /*J*/"\51\54\45\15\04", /*K*/"\11\15\100\14\61\100\65\33",
+ /*L*/"\11\15\65", /*M*/"\05\01\35\61\65", /*N*/"\05\01\65\61", /*O*/"\02\11\51\62\64\55\15\04\02",
+ /*P*/"\15\11\51\62\53\13", /*Q*/"\02\11\51\62\64\55\15\04\02\100\65\34", /*R*/"\15\11\51\62\53\13\100\33\65", /*S*/"\62\51\11\02\13\53\64\55\15\04",
+ /*T*/"\01\61\100\31\35", /*U*/"\61\64\55\15\04\01", /*V*/"\01\35\61", /*W*/"\01\15\31\55\61",
+ /*X*/"\01\65\100\05\61", /*Y*/"\01\33\35\100\33\61", /*Z*/"\01\61\05\65", /*[*/"\51\31\36\56",
+ /*\*/"\21\55", /*]*/"\21\41\46\26", /*^*/"\13\31\53", /*_*/"\06\76",
+ /*`*/"\31\42", /*a*/"\22\52\63\65\100\63\23\14\25\55\64", /*b*/"\11\15\100\14\25\55\64\63\52\22\13", /*c*/"\63\52\22\13\14\25\55\64",
+ /*d*/"\61\65\100\64\55\25\14\13\22\52\63", /*e*/"\64\63\52\22\13\14\25\55\100\64\14", /*f*/"\35\32\41\51\100\22\52", /*g*/"\62\65\56\26\100\63\52\22\13\14\25\55\64",
+ /*h*/"\11\15\100\65\63\52\22\13", /*i*/"\31\32\100\33\100\23\33\35\100\25\45", /*j*/"\31\32\100\33\35\26\16", /*k*/"\11\15\100\14\62\100\33\65",
+ /*l*/"\31\34\45\55", /*m*/"\05\02\100\03\12\22\33\35\100\33\42\52\63\65", /*n*/"\12\15\100\13\22\52\63\65", /*o*/"\22\13\14\25\55\64\63\52\22",
+ /*p*/"\16\12\100\13\22\52\63\64\55\25\14", /*q*/"\62\66\100\63\52\22\13\14\25\55\64", /*r*/"\22\25\100\23\32\42\53", /*s*/"\63\52\22\13\64\55\25\14",
+ /*t*/"\31\34\45\55\100\22\42", /*u*/"\12\14\25\55\64\62\100\64\65", /*v*/"\62\35\02", /*w*/"\02\15\32\55\62",
+ /*x*/"\62\15\100\65\12", /*y*/"\12\45\62\100\45\36\16", /*z*/"\12\62\15\65", /*{*/"\51\41\32\33\24\35\36\47\57\100\14\24",
+ /*|*/"\31\37", /*}*/"\21\31\42\43\54\64\100\54\45\46\37\27", /*~*/"\12\21\31\42\52\61", /*7F*/0
};
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx
index 5cc0142a7..d457bf98a 100644
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx
+++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx
@@ -476,8 +476,8 @@ int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; }
void Fl_X::set_default_icons(Fl_RGB_Image const**, int) { }
void Fl_X::set_icons() { }
-void Fl_Window::size_range_() { }
-void Fl_Window::fullscreen_x() { }
+//void Fl_Window::size_range_() { }
+//void Fl_Window::fullscreen_x() { }
void Fl_Window::make_current()
{
@@ -485,7 +485,7 @@ void Fl_Window::make_current()
current_ = this;
}
-void Fl_Window::fullscreen_off_x(int, int, int, int) { }
+//void Fl_Window::fullscreen_off_x(int, int, int, int) { }
Window fl_xid(const Fl_Window* w)
{
diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx
index c8983fc41..67b5159a8 100644
--- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx
+++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Window_Driver.cxx
@@ -63,7 +63,7 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow()
return 0L;
}
Window parent;
- if (parent()) {
+ if (pWindow->parent()) {
parent = fl_xid(pWindow->window());
} else {
parent = 0;
@@ -131,4 +131,4 @@ void Fl_PicoAndroid_Window_Driver::flush()
//
// End of "$Id: Fl_PicoSDL_Window_Driver.cxx 11253 2016-03-01 00:54:21Z matt $".
-// \ No newline at end of file
+//
diff --git a/test/fonts.cxx b/test/fonts.cxx
index a935fdd07..32050a0ae 100644
--- a/test/fonts.cxx
+++ b/test/fonts.cxx
@@ -22,12 +22,16 @@
#include <FL/Fl_Hold_Browser.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Box.H>
+#include <FL/Fl_Button.H>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <FL/fl_ask.H>
+#include <FL/Fl_File_Chooser.H>
Fl_Double_Window *form;
Fl_Tile *tile;
+Fl_Window *vector_font_editor = 0;
class FontDisplay : public Fl_Widget {
void draw();
@@ -97,6 +101,188 @@ void size_cb(Fl_Widget *, long) {
char label[0x1000];
+unsigned char current_char = 'A';
+unsigned char vec[255][128] = {
+ { 0 }
+};
+
+class LetterBox : public Fl_Group
+{
+public:
+ LetterBox(int x, int y, int w, int h, const char *l)
+ : Fl_Group(x, y, w, h, l) { }
+ void draw() {
+ draw_box();
+ fl_push_clip(x(), y(), w(), h());
+ draw_label(x(), y()-5, w(), h()-16, FL_ALIGN_CENTER);
+
+ fl_color(FL_BLUE);
+ fl_line_style(FL_SOLID|FL_CAP_ROUND|FL_JOIN_ROUND, 10);
+ bool rendering = false;
+ unsigned char *fd = vec[current_char];
+ double px, py;
+ for (;;) {
+ unsigned char cmd = *fd++;
+ if (cmd==0) {
+ if (rendering) {
+ fl_end_line();
+ rendering = false;
+ }
+ break;
+ } else if (cmd>63) {
+ if (cmd=='\100' && rendering) {
+ fl_end_line();
+ rendering = false;
+ }
+ } else {
+ if (!rendering) { fl_begin_line(); rendering = true; }
+ int vx = (cmd & '\70')>>3;
+ int vy = (cmd & '\07');
+ px = (vx*16+8+10);
+ py = (vy*32+16+10);
+ fl_vertex(px, py);
+ }
+ }
+ fl_line_style(FL_SOLID, 1);
+
+ draw_children();
+ fl_pop_clip();
+ }
+};
+
+void add_point_cb(Fl_Widget *w, void *d)
+{
+ unsigned char *fd = vec[current_char];
+ while (*fd) fd++;
+ *fd = (fl_intptr_t)(d);
+ w->parent()->redraw();
+}
+
+void add_gap_cb(Fl_Widget *w, void *d)
+{
+ unsigned char *fd = vec[current_char];
+ while (*fd) fd++;
+ *fd = '\100';
+ w->parent()->redraw();
+}
+
+void clear_cb(Fl_Widget *w, void *d)
+{
+ unsigned char *fd = vec[current_char];
+ memset(fd, 0, 128);
+ w->parent()->redraw();
+}
+
+void prev_cb(Fl_Widget *w, void *d)
+{
+ current_char--;
+ char b[2] = { current_char, 0 };
+ w->parent()->child(0)->copy_label(b);
+ w->parent()->child(0)->redraw();
+}
+
+void next_cb(Fl_Widget *w, void *d)
+{
+ current_char++;
+ char b[2] = { current_char, 0 };
+ w->parent()->child(0)->copy_label(b);
+ w->parent()->child(0)->redraw();
+}
+
+void back_cb(Fl_Widget *w, void *d)
+{
+ unsigned char *fd = vec[current_char];
+ if (*fd==0) return;
+ while (*fd) fd++;
+ *(--fd) = 0;
+ w->parent()->child(0)->redraw();
+}
+
+void save_cb(Fl_Widget *w, void *d)
+{
+ const char *filename = fl_file_chooser("Save font as:", 0, 0);
+ if (!filename) return;
+ FILE *f = fopen(filename, "wb");
+ if (!f) {
+ fl_alert("can't open file for writing");
+ return;
+ }
+ fprintf(f, "\nstatic const char *font_data[128] = {\n ");
+ for (int i=0; i<128; i++) {
+ unsigned char *fd = vec[i];
+ if (i>=32 && i<127) fprintf(f, "/*%c*/", i); else fprintf(f, "/*%02X*/", i);
+ if (*fd==0) {
+ fprintf(f, "0");
+ } else {
+ fprintf(f, "\"");
+ for (;;) {
+ unsigned char c = *fd++;
+ if (c==0) break;
+ fprintf(f, "\\%02o", c);
+ }
+ fprintf(f, "\"");
+ }
+ if (i<127) fprintf(f, ", ");
+ if ((i&3)==3)fprintf(f, "\n ");
+ }
+ fprintf(f, "};\n\n");
+ fclose(f);
+}
+
+Fl_Window *create_editor()
+{
+ Fl_Window *win = new Fl_Double_Window(400,400);
+ LetterBox *c = new LetterBox(10, 10, 128, 256, "A");
+ //c->labelfont(FL_COURIER);
+ c->align(FL_ALIGN_CENTER);
+ c->labelsize(200);
+ c->labelcolor(FL_DARK3);
+ c->box(FL_DOWN_BOX);
+ Fl_Button *b;
+ int i, j;
+ for (i=0; i<8; i++) {
+ for (j=0; j<8; j++) {
+ b = new Fl_Button(i*16+8-5+10, j*32+16-5+10, 10, 10);
+ b->box(FL_OVAL_BOX);
+ b->callback(add_point_cb, (void*)(fl_intptr_t)(i*8+j));
+ }
+ }
+ c->end();
+
+ b = new Fl_Button(10, 290, 70, 20, "Gap");
+ b->callback(add_gap_cb);
+ b = new Fl_Button(90, 290, 70, 20, "Clear");
+ b->callback(clear_cb);
+ b = new Fl_Button(10, 315, 70, 20, "<-");
+ b->callback(prev_cb);
+ b->shortcut(FL_Left);
+ b = new Fl_Button(90, 315, 70, 20, "->");
+ b->callback(next_cb);
+ b->shortcut(FL_Right);
+ b = new Fl_Button(10, 340, 70, 20, "Back");
+ b->callback(back_cb);
+ b = new Fl_Button(90, 340, 70, 20, "Save");
+ b->callback(save_cb);
+ b->shortcut(FL_COMMAND+'s');
+ return win;
+}
+
+class MainWindow : public Fl_Double_Window
+{
+public:
+ MainWindow(int w, int h, const char *l=0)
+ : Fl_Double_Window(w, h, l) { }
+ int handle(int event) {
+ if (event==FL_KEYBOARD && Fl::event_key()==FL_F+1) {
+ if (!vector_font_editor) vector_font_editor = create_editor();
+ vector_font_editor->show();
+ return 1;
+ } else {
+ return Fl_Double_Window::handle(event);
+ }
+ }
+};
+
void create_the_forms() {
// create the sample string
int n = 0;
@@ -116,7 +302,7 @@ void create_the_forms() {
label[i] = 0;
// create the basic layout
- form = new Fl_Double_Window(550,370);
+ form = new MainWindow(550,370);
tile = new Fl_Tile(0, 0, 550, 370);
@@ -147,8 +333,6 @@ void create_the_forms() {
form->end();
}
-#include <FL/fl_ask.H>
-
int main(int argc, char **argv) {
Fl::scheme(NULL);
Fl::args(argc, argv);