summaryrefslogtreecommitdiff
path: root/fontforge
diff options
context:
space:
mode:
authorpfaedit <pfaedit>2010-02-12 01:00:26 +0000
committerpfaedit <pfaedit>2010-02-12 01:00:26 +0000
commit15c54c224e274ab7dcd701bf05d67d4c8ff93600 (patch)
tree24993683103e42b32524191b9a1cb762367572a3 /fontforge
parent4f415b00705c26cfb752d2dd071feff7e0c36998 (diff)
Grab many patches from the mingw build.
I did not grab the winmmap files because I'm not sure what the license is for that.
Diffstat (limited to 'fontforge')
-rw-r--r--fontforge/autosave.c30
-rw-r--r--fontforge/autotrace.c111
-rw-r--r--fontforge/bdfinfo.c5
-rw-r--r--fontforge/charview.c61
-rw-r--r--fontforge/cvdebug.c13
-rw-r--r--fontforge/cvdgloss.c13
-rw-r--r--fontforge/cvexport.c1
-rw-r--r--fontforge/cvexportdlg.c1
-rw-r--r--fontforge/cvpalettes.c4
-rw-r--r--fontforge/displayfonts.c2
-rw-r--r--fontforge/dumppfa.c13
-rw-r--r--fontforge/fffreetype.h33
-rw-r--r--fontforge/fontinfo.c7
-rw-r--r--fontforge/freetypeui.c6
-rw-r--r--fontforge/http.c20
-rw-r--r--fontforge/libffstamp.h6
-rw-r--r--fontforge/noprefs.c21
-rw-r--r--fontforge/oflib.c14
-rw-r--r--fontforge/prefs.c17
-rw-r--r--fontforge/print.c4
-rw-r--r--fontforge/scripting.c8
-rw-r--r--fontforge/sfd.c11
-rw-r--r--fontforge/splinefont.c2
-rw-r--r--fontforge/stamp.c6
-rw-r--r--fontforge/startnoui.c29
-rw-r--r--fontforge/startui.c69
-rw-r--r--fontforge/ttfinstrsui.c1
-rw-r--r--fontforge/ufo.c4
-rw-r--r--fontforge/uiutil.c53
-rw-r--r--fontforge/views.h5
-rw-r--r--fontforge/windowmenu.c6
31 files changed, 493 insertions, 83 deletions
diff --git a/fontforge/autosave.c b/fontforge/autosave.c
index a46d9b8d..5b3918a6 100644
--- a/fontforge/autosave.c
+++ b/fontforge/autosave.c
@@ -34,30 +34,12 @@
#include <stdlib.h>
#include <dirent.h>
#include <ustring.h>
+#include "gfile.h"
+#if !defined(__MINGW32__)
# include <pwd.h>
+#endif
-static char *gethomedir(void) {
- static char *dir;
- int uid;
- struct passwd *pw;
-
- dir = getenv("HOME");
- if ( dir!=NULL )
-return( copy(dir) );
-
- uid = getuid();
- while ( (pw=getpwent())!=NULL ) {
- if ( pw->pw_uid==uid ) {
- dir = copy(pw->pw_dir);
- endpwent();
-return( dir );
- }
- }
- endpwent();
-
-return( NULL );
-}
char *getPfaEditDir(char *buffer) {
static char *editdir = NULL;
@@ -67,7 +49,7 @@ char *getPfaEditDir(char *buffer) {
if ( editdir!=NULL )
return( editdir );
- dir=gethomedir();
+ dir = GFileGetHomeDir();
if ( dir==NULL )
return( NULL );
#ifdef __VMS
@@ -89,7 +71,7 @@ return( NULL );
free(dir);
/* If we still can't find it, create it */
if ( access(buffer,F_OK)==-1 )
- if ( mkdir(buffer,0700)==-1 )
+ if ( GFileMkDir(buffer)==-1 )
return( NULL );
editdir = copy(buffer);
return( editdir );
@@ -102,7 +84,7 @@ static char *getAutoDirName(char *buffer) {
return( NULL );
sprintf(buffer,"%s/autosave", dir);
if ( access(buffer,F_OK)==-1 )
- if ( mkdir(buffer,0700)==-1 )
+ if ( GFileMkDir(buffer)==-1 )
return( NULL );
dir = copy(buffer);
return( dir );
diff --git a/fontforge/autotrace.c b/fontforge/autotrace.c
index 885d7ed7..c433f9cc 100644
--- a/fontforge/autotrace.c
+++ b/fontforge/autotrace.c
@@ -29,9 +29,12 @@
#include <ustring.h>
#include <utype.h>
#include "sd.h"
+#include "gfile.h"
#include <sys/types.h> /* for waitpid */
+#if !defined(__MINGW32__)
#include <sys/wait.h> /* for waitpid */
+#endif
#include <unistd.h> /* for access, unlink, fork, execvp, getcwd */
#include <sys/stat.h> /* for open */
#include <fcntl.h> /* for open */
@@ -175,6 +178,7 @@ static SplinePointList *localSplinesFromEntities(Entity *ent, Color bgcol, int i
return( head );
}
+#if !defined(__MINGW32__)
/* I think this is total paranoia. but it's annoying to have linker complaints... */
static int mytempnam(char *buffer) {
char *dir;
@@ -225,7 +229,109 @@ return( NULL );
return( NULL );
}
}
+#endif
+
+#if defined(__MINGW32__)
+static char* add_arg(char* buffer, char* s)
+{
+ while( *s ) *buffer++ = *s++;
+ *buffer = '\0';
+ return buffer;
+}
+void _SCAutoTrace(SplineChar *sc, int layer, char **args) {
+ ImageList *images;
+ SplineSet *new, *last;
+ struct _GImage *ib;
+ Color bgcol;
+ int ispotrace;
+ real transform[6];
+ char tempname_in[1025];
+ char tempname_out[1025];
+ char *prog, *command, *cmd;
+ FILE *ps;
+ int i, changed = false;
+
+ if ( sc->layers[ly_back].images==NULL )
+ return;
+ prog = FindAutoTraceName();
+ if ( prog==NULL )
+ return;
+ ispotrace = (strstrmatch(prog,"potrace")!=NULL );
+ for ( images = sc->layers[ly_back].images; images!=NULL; images=images->next ) {
+ ib = images->image->list_len==0 ? images->image->u.image : images->image->u.images[0];
+ if ( ib->width==0 || ib->height==0 ) {
+ continue;
+ }
+
+ strcpy(tempname_in, _tempnam(NULL, "FontForge_in_"));
+ strcpy(tempname_out, _tempnam(NULL, "FontForge_out_"));
+ GImageWriteBmp(images->image, tempname_in);
+
+ if ( ib->trans==-1 )
+ bgcol = 0xffffff; /* reasonable guess */
+ else if ( ib->image_type==it_true )
+ bgcol = ib->trans;
+ else if ( ib->clut!=NULL )
+ bgcol = ib->clut->clut[ib->trans];
+ else
+ bgcol = 0xffffff;
+
+ command = galloc(32768);
+ cmd = add_arg(command, prog);
+ cmd = add_arg(cmd, " ");
+ if(args){
+ for(i=0; args[i]; i++){
+ cmd = add_arg(cmd, args[i]);
+ cmd = add_arg(cmd, " ");
+ }
+ }
+ if ( ispotrace )
+ cmd = add_arg(cmd, "-c --eps -r 72 --output=\"");
+ else
+ cmd = add_arg(cmd, "--output-format=eps --input-format=BMP --output-file \"");
+
+ cmd = add_arg(cmd, tempname_out);
+ cmd = add_arg(cmd, "\" \"");
+ cmd = add_arg(cmd, tempname_in);
+ cmd = add_arg(cmd, "\"");
+ /*fprintf(stdout, "---EXEC---\n%s\n----------\n", command);fflush(stdout);*/
+ system(command);
+ gfree(command);
+
+ ps = fopen(tempname_out, "r");
+ if(ps){
+ new = localSplinesFromEntities(EntityInterpretPS(ps,NULL),bgcol,ispotrace);
+ transform[0] = images->xscale; transform[3] = images->yscale;
+ transform[1] = transform[2] = 0;
+ transform[4] = images->xoff;
+ transform[5] = images->yoff - images->yscale*ib->height;
+ new = SplinePointListTransform(new,transform,true);
+ if ( sc->layers[layer].order2 ) {
+ SplineSet *o2 = SplineSetsTTFApprox(new);
+ SplinePointListsFree(new);
+ new = o2;
+ }
+ if ( new!=NULL ) {
+ sc->parent->onlybitmaps = false;
+ if ( !changed )
+ SCPreserveLayer(sc,layer,false);
+ for ( last=new; last->next!=NULL; last=last->next );
+ last->next = sc->layers[layer].splines;
+ sc->layers[layer].splines = new;
+ changed = true;
+ }
+ fclose(ps);
+ }
+
+ unlink(tempname_in);
+ unlink(tempname_out);
+ }
+ if ( changed )
+ SCCharChangedUpdate(sc,layer);
+
+}
+#else
void _SCAutoTrace(SplineChar *sc, int layer, char **args) {
ImageList *images;
char *prog, *pt;
@@ -340,6 +446,7 @@ return;
if ( changed )
SCCharChangedUpdate(sc,layer);
}
+#endif
static char **makevector(const char *str) {
char **vector;
@@ -638,6 +745,9 @@ return( mf_args );
}
SplineFont *SFFromMF(char *filename) {
+#if defined(__MINGW32__)
+return (NULL);
+#else
char *tempdir;
char *arglist[8];
int pid, status, ac, i;
@@ -720,4 +830,5 @@ return( NULL );
free(arglist[1]);
cleantempdir(tempdir);
return( sf );
+#endif
}
diff --git a/fontforge/bdfinfo.c b/fontforge/bdfinfo.c
index f1c0bc13..66451ac0 100644
--- a/fontforge/bdfinfo.c
+++ b/fontforge/bdfinfo.c
@@ -486,6 +486,7 @@ static void BdfP_Expose(struct bdf_dlg *bd, GWindow pixmap) {
int page = bd->vheight/(bd->fh+1);
GRect clip, old, r;
char buffer[40];
+ extern GBox _ggadget_Default_Box;
GDrawSetFont(pixmap,bd->font);
clip.x = 4; clip.width = bd->value_x-4-2; clip.height = bd->fh;
@@ -533,9 +534,9 @@ static void BdfP_Expose(struct bdf_dlg *bd, GWindow pixmap) {
/* GT: a translator may need to ask me to disambiguate more strings. Please do so: */
/* GT: <pfaedit@users.sourceforge.net> */
GDrawDrawBiText8(pixmap,4,i*(bd->fh+1)+bd->as,S_("Property|New..."),-1,NULL,0xff0000);
- GDrawDrawLine(pixmap,0,i*(bd->fh+1)+bd->fh,bd->vwidth,i*(bd->fh+1)+bd->fh,0x808080);
+ GDrawDrawLine(pixmap,0,i*(bd->fh+1)+bd->fh,bd->vwidth,i*(bd->fh+1)+bd->fh, _ggadget_Default_Box.border_darker);
}
- GDrawDrawLine(pixmap,bd->value_x,0,bd->value_x,bd->vheight,0x808080);
+ GDrawDrawLine(pixmap,bd->value_x,0,bd->value_x,bd->vheight, _ggadget_Default_Box.border_darker);
}
static void BdfP_Invoked(GWindow v, GMenuItem *mi, GEvent *e) {
diff --git a/fontforge/charview.c b/fontforge/charview.c
index f7e0b752..4bb54722 100644
--- a/fontforge/charview.c
+++ b/fontforge/charview.c
@@ -44,6 +44,25 @@ extern int _GScrollBar_Width;
#undef H_
#define H_(str) ("CV*" str)
+#if defined(__MINGW32__)
+#include <Windows.h>
+#undef PrintDlg
+#undef small
+static void _mingw_hand_tool_hack(CharView* cv){
+ if(GetAsyncKeyState(VK_SPACE) & 0x8000){
+ if(cv->b1_tool != cvt_hand){
+ cv->b1_tool_old = cv->b1_tool;
+ cv->b1_tool = cvt_hand;
+ }
+ }
+ else{
+ if(cv->b1_tool == cvt_hand){
+ cv->b1_tool = cv->b1_tool_old;
+ }
+ }
+}
+#endif
+
int ItalicConstrained=true;
int cv_auto_goto = true;
float arrowAmount=1;
@@ -2993,6 +3012,12 @@ static void CVDoFindInFontView(CharView *cv) {
}
static void CVCharUp(CharView *cv, GEvent *event ) {
+
+ #if defined(__MINGW32__)
+ if(event->u.chr.keysym==' ')
+ _mingw_hand_tool_hack(cv);
+ #endif
+
#if _ModKeysAutoRepeat
/* Under cygwin these keys auto repeat, they don't under normal X */
if ( event->u.chr.keysym == GK_Shift_L || event->u.chr.keysym == GK_Shift_R ||
@@ -3582,6 +3607,11 @@ return; /* I treat this more like a modifier key change than a button press */
CVToolsPopup(cv,event);
return;
}
+
+ #if defined(__MINGW32__)
+ _mingw_hand_tool_hack(cv);
+ #endif
+
CVToolsSetCursor(cv,event->u.mouse.state|(1<<(7+event->u.mouse.button)), event->u.mouse.device );
cv->active_tool = cv->showing_tool;
cv->needsrasterize = false;
@@ -4116,6 +4146,10 @@ static void CVMouseUp(CharView *cv, GEvent *event ) {
}
cv->p.pressed = false;
+ #if defined(__MINGW32__)
+ _mingw_hand_tool_hack(cv);
+ #endif
+
if ( cv->p.rubberbanding ) {
CVDrawRubberRect(cv->v,cv);
cv->p.rubberbanding = false;
@@ -5364,9 +5398,9 @@ static void CVMenuWireframe(GWindow gw,struct gmenuitem *mi,GEvent *e) {
ShadowDlg(NULL,cv,NULL,true);
}
-static void _CVMenuScale(CharView *cv,struct gmenuitem *mi) {
+static void _CVMenuScale(CharView *cv, int mid) {
- if ( mi->mid == MID_Fit ) {
+ if ( mid == MID_Fit ) {
CVFit(cv);
} else {
BasePoint c;
@@ -5374,13 +5408,13 @@ static void _CVMenuScale(CharView *cv,struct gmenuitem *mi) {
c.y = (cv->height/2-cv->yoff)/cv->scale;
if ( CVAnySel(cv,NULL,NULL,NULL,NULL))
CVFindCenter(cv,&c,false);
- CVMagnify(cv,c.x,c.y,mi->mid==MID_ZoomOut?-1:1);
+ CVMagnify(cv,c.x,c.y, mid==MID_ZoomOut?-1:1);
}
}
static void CVMenuScale(GWindow gw,struct gmenuitem *mi,GEvent *e) {
CharView *cv = (CharView *) GDrawGetUserData(gw);
- _CVMenuScale(cv,mi);
+ _CVMenuScale(cv,mi->mid);
}
static void CVMenuShowHide(GWindow gw,struct gmenuitem *mi,GEvent *e) {
@@ -5859,6 +5893,11 @@ return;
}
#endif
+ #if defined(__MINGW32__)
+ if(event->u.chr.keysym==' ')
+ _mingw_hand_tool_hack(cv);
+ #endif
+
CVPaletteActivate(cv);
CVToolsSetCursor(cv,TrueCharState(event),NULL);
/* The window check is to prevent infinite loops since DVChar can */
@@ -5904,6 +5943,10 @@ return;
} else if ( event->u.chr.keysym=='\\' && (event->u.chr.state&ksm_control) ) {
/* European keyboards need a funky modifier to get \ */
CVDoTransform(cv,cvt_none);
+ } else if ( (event->u.chr.state&ksm_control) && (event->u.chr.keysym=='-' || event->u.chr.keysym==0xffad/*XK_KP_Subtract*/) ){
+ _CVMenuScale(cv, MID_ZoomOut);
+ } else if ( (event->u.chr.state&ksm_control) && (event->u.chr.keysym=='=' || event->u.chr.keysym==0xffab/*XK_KP_Add*/) ){
+ _CVMenuScale(cv, MID_ZoomIn);
} else if ( event->u.chr.keysym == GK_Left ||
event->u.chr.keysym == GK_Up ||
event->u.chr.keysym == GK_Right ||
@@ -5978,6 +6021,9 @@ return;
CVVScroll(cv,&sb);
} else if ( event->u.chr.keysym == GK_Home ) {
CVFit(cv);
+ #if defined(__MINGW32__)
+ } else if ( event->u.chr.keysym == ' '){
+ #endif
} else if ( (event->u.chr.state&((GMenuMask()|navigation_mask)&~(ksm_shift|ksm_capslock)))==navigation_mask &&
event->type == et_char &&
event->u.chr.keysym!=0 &&
@@ -9688,9 +9734,9 @@ static GMenuItem2 nplist[] = {
static GMenuItem2 gflist[] = {
{ { (unichar_t *) N_("Show _Grid Fit..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'l' }, H_("Show Grid Fit...|No Shortcut"), NULL, NULL, CVMenuShowGridFit, MID_ShowGridFit },
- { { (unichar_t *) N_("_Bigger Point Size"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Bigger Point Size|Ctl+Shft++"), NULL, NULL, CVMenuChangePointSize, MID_Bigger },
- { { (unichar_t *) N_("_Smaller Point Size"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Smaller Point Size|Ctl+-"), NULL, NULL, CVMenuChangePointSize, MID_Smaller },
- { { (unichar_t *) N_("_Anti Alias"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'L' }, H_("Grid Fit Anti Alias|Ctl+="), NULL, NULL, CVMenuChangePointSize, MID_GridFitAA },
+ { { (unichar_t *) N_("_Bigger Point Size"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Bigger Point Size|No Shortcut"), NULL, NULL, CVMenuChangePointSize, MID_Bigger },
+ { { (unichar_t *) N_("_Smaller Point Size"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Smaller Point Size|No Shortcut"), NULL, NULL, CVMenuChangePointSize, MID_Smaller },
+ { { (unichar_t *) N_("_Anti Alias"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'L' }, H_("Grid Fit Anti Alias|No Shortcut"), NULL, NULL, CVMenuChangePointSize, MID_GridFitAA },
{ { (unichar_t *) N_("_Off"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Grid Fit Off|No Shortcut"), NULL, NULL, CVMenuChangePointSize, MID_GridFitOff },
NULL
};
@@ -10063,6 +10109,7 @@ static void _CharViewCreate(CharView *cv, SplineChar *sc, FontView *fv,int enc)
cv->gi.u.image->clut->clut[0] = view_bgcol;
cv->gi.u.image->clut->clut[1] = fillcol;
cv->b1_tool = cv_b1_tool; cv->cb1_tool = cv_cb1_tool;
+ cv->b1_tool_old = cv->b1_tool;
cv->b2_tool = cv_b2_tool; cv->cb2_tool = cv_cb2_tool;
cv->s1_tool = cvt_freehand; cv->s2_tool = cvt_pen;
cv->er_tool = cvt_knife;
diff --git a/fontforge/cvdebug.c b/fontforge/cvdebug.c
index 59153952..c7f0c436 100644
--- a/fontforge/cvdebug.c
+++ b/fontforge/cvdebug.c
@@ -52,10 +52,17 @@ void CVDebugPointPopup(CharView *cv) {
#else
#include <ft2build.h>
#include FT_FREETYPE_H
-#if FREETYPE_MINOR>=2
-# include <internal/internal.h>
+#if defined(__MINGW32__)
+# if FREETYPE_MINOR>=2
+# include <freetype/internal/internal.h>
+# endif
+# include <freetype/truetype/ttinterp.h>
+#else
+# if FREETYPE_MINOR>=2
+# include <internal/internal.h>
+# endif
+# include "ttinterp.h"
#endif
-#include "ttinterp.h"
#if FREETYPE_MAJOR==2 && (FREETYPE_MINOR<3 || (FREETYPE_MINOR==3 && FREETYPE_PATCH<5))
# define PPEMX(exc) ((exc)->size->metrics.x_ppem)
diff --git a/fontforge/cvdgloss.c b/fontforge/cvdgloss.c
index 85d76bd7..b1f1470c 100644
--- a/fontforge/cvdgloss.c
+++ b/fontforge/cvdgloss.c
@@ -37,10 +37,17 @@ extern GBox _ggadget_Default_Box;
#include <ft2build.h>
#include FT_FREETYPE_H
-#if FREETYPE_MINOR>=2
-# include <internal/internal.h>
+#if defined(__MINGW32__)
+# if FREETYPE_MINOR>=2
+# include <freetype/internal/internal.h>
+# endif
+# include <freetype/truetype/ttinterp.h>
+#else
+# if FREETYPE_MINOR>=2
+# include <internal/internal.h>
+# endif
+# include "ttinterp.h"
#endif
-#include "ttinterp.h"
#if FREETYPE_MAJOR==2 && (FREETYPE_MINOR<3 || (FREETYPE_MINOR==3 && FREETYPE_PATCH<5))
# define PPEMX(exc) ((exc)->size->metrics.x_ppem)
diff --git a/fontforge/cvexport.c b/fontforge/cvexport.c
index 1a998918..bb9de93a 100644
--- a/fontforge/cvexport.c
+++ b/fontforge/cvexport.c
@@ -30,7 +30,6 @@
#include <string.h>
#include "gfile.h"
#include <time.h>
-#include <pwd.h>
#include "ustring.h"
#include "gio.h"
#include "gicons.h"
diff --git a/fontforge/cvexportdlg.c b/fontforge/cvexportdlg.c
index 46612819..72a8bc4a 100644
--- a/fontforge/cvexportdlg.c
+++ b/fontforge/cvexportdlg.c
@@ -30,7 +30,6 @@
#include <string.h>
#include "gfile.h"
#include <time.h>
-#include <pwd.h>
#include "ustring.h"
#include "gio.h"
#include "gicons.h"
diff --git a/fontforge/cvpalettes.c b/fontforge/cvpalettes.c
index d778d2bb..89350a9a 100644
--- a/fontforge/cvpalettes.c
+++ b/fontforge/cvpalettes.c
@@ -1016,6 +1016,10 @@ static void ToolsMouse(CharView *cv, GEvent *event) {
int styluscntl = isstylus && (event->u.mouse.state&0x200);
static int settings[2];
+ if(j >= 2)
+return; /* If the wm gave me a window the wrong size */
+
+
if ( i==(cvt_rect)/2 ) {
int current = CVCurrentTool(cv,event);
int changed = false;
diff --git a/fontforge/displayfonts.c b/fontforge/displayfonts.c
index 76642066..a419843c 100644
--- a/fontforge/displayfonts.c
+++ b/fontforge/displayfonts.c
@@ -33,7 +33,9 @@
#include <ustring.h>
#include "utype.h"
#include <sys/types.h>
+#if !defined(__MINGW32__)
#include <sys/wait.h>
+#endif
#include <gkeysym.h>
#include "print.h"
diff --git a/fontforge/dumppfa.c b/fontforge/dumppfa.c
index dec79218..944d0748 100644
--- a/fontforge/dumppfa.c
+++ b/fontforge/dumppfa.c
@@ -33,7 +33,9 @@
#include <utype.h>
#include <unistd.h>
#include <locale.h>
+#if !defined(__MINGW32__)
# include <pwd.h>
+#endif
#include <stdarg.h>
#include <time.h>
#include "psfont.h"
@@ -1782,6 +1784,16 @@ static void dumpfontinfo(void (*dumpchar)(int ch,void *data), void *data, Spline
}
const char *GetAuthor(void) {
+#if defined(__MINGW32__)
+ static char author[200] = { '\0' };
+ if ( author[0] == '\0' ){
+ char* name = getenv("USER");
+ if(!name) return NULL;
+ strncpy(author, name, sizeof(author));
+ author[sizeof(author)-1] = '\0';
+ }
+ return author;
+#else
struct passwd *pwd;
static char author[200] = { '\0' };
const char *ret = NULL, *pt;
@@ -1811,6 +1823,7 @@ return( author );
endpwent();
/* End comment */
return( ret );
+#endif
}
static void dumpfontcomments(void (*dumpchar)(int ch,void *data), void *data,
diff --git a/fontforge/fffreetype.h b/fontforge/fffreetype.h
index 7108d92d..52504206 100644
--- a/fontforge/fffreetype.h
+++ b/fontforge/fffreetype.h
@@ -30,13 +30,34 @@
#include FT_FREETYPE_H
#include FT_OUTLINE_H
#if defined(FREETYPE_HAS_DEBUGGER) && FREETYPE_MINOR>=2
-# include <internal/internal.h>
+# if defined(__MINGW32__)
+# include <freetype/internal/internal.h>
+# else
+# include <internal/internal.h>
+# endif
#endif
#include <unistd.h>
-#include <sys/mman.h>
+
+#if defined(__MINGW32__)
+# include "winmmap.h"
+#else
+# include <sys/mman.h>
+#endif
extern FT_Library ff_ft_context;
+#if FREETYPE_HAS_DEBUGGER
+# if defined(__MINGW32__)
+# include "freetype/truetype/ttobjs.h"
+# include "freetype/truetype/ttdriver.h"
+# include "freetype/truetype/ttinterp.h"
+# else
+# include "ttobjs.h"
+# include "ttdriver.h"
+# include "ttinterp.h"
+# endif
+#endif
+
# if defined(_STATIC_LIBFREETYPE) || defined(NODYNAMIC)
#define _FT_Init_FreeType FT_Init_FreeType
@@ -52,10 +73,6 @@ extern FT_Library ff_ft_context;
#define _FT_Done_FreeType FT_Done_FreeType
# if FREETYPE_HAS_DEBUGGER
-# include "ttobjs.h"
-# include "ttdriver.h"
-# include "ttinterp.h"
-
# define _FT_Set_Debug_Hook FT_Set_Debug_Hook
# define _TT_RunIns TT_RunIns
# endif
@@ -69,10 +86,6 @@ extern FT_Error (*_FT_Set_Char_Size)( FT_Face, int wid/*=0*/, int height/* =ptsi
extern FT_Error (*_FT_Outline_Get_Bitmap)(FT_Library, FT_Outline *,FT_Bitmap *);
# if FREETYPE_HAS_DEBUGGER
-# include "ttobjs.h"
-# include "ttdriver.h"
-# include "ttinterp.h"
-
extern void (*_FT_Set_Debug_Hook)(FT_Library, FT_UInt, FT_DebugHook_Func);
extern FT_Error (*_TT_RunIns)( TT_ExecContext );
# endif
diff --git a/fontforge/fontinfo.c b/fontforge/fontinfo.c
index f4108d74..51df48e1 100644
--- a/fontforge/fontinfo.c
+++ b/fontforge/fontinfo.c
@@ -6348,6 +6348,7 @@ static void LookupExpose(GWindow pixmap, struct gfi_data *gfi, int isgpos) {
int lcnt, i,j;
struct lkdata *lk = &gfi->tables[isgpos];
GRect r, old;
+ extern GBox _ggadget_Default_Box;
r.x = LK_MARGIN; r.width = gfi->lkwidth-2*LK_MARGIN;
r.y = LK_MARGIN; r.height = gfi->lkheight-2*LK_MARGIN;
@@ -10274,7 +10275,8 @@ return;
t = sf->creationtime;
tm = localtime(&t);
- strftime(createtime,sizeof(createtime),"%c",tm);
+ if(!tm) strcpy(createtime, "error");
+ else strftime(createtime,sizeof(createtime),"%c",tm);
tmpcreatetime = def2u_copy(createtime);
dgcd[1].gd.pos.x = 115; dgcd[1].gd.pos.y = dgcd[0].gd.pos.y;
dgcd[1].gd.flags = gg_visible | gg_enabled;
@@ -10292,7 +10294,8 @@ return;
t = sf->modificationtime;
tm = localtime(&t);
- strftime(modtime,sizeof(modtime),"%c",tm);
+ if(!tm) strcpy(modtime, "error");
+ else strftime(modtime,sizeof(modtime),"%c",tm);
tmpmodtime = def2u_copy(modtime);
dgcd[3].gd.pos.x = 115; dgcd[3].gd.pos.y = dgcd[2].gd.pos.y;
dgcd[3].gd.flags = gg_visible | gg_enabled;
diff --git a/fontforge/freetypeui.c b/fontforge/freetypeui.c
index 9149b0a3..81fe62cd 100644
--- a/fontforge/freetypeui.c
+++ b/fontforge/freetypeui.c
@@ -37,7 +37,11 @@
#if FREETYPE_HAS_DEBUGGER
#include <pthread.h>
-#include <tterrors.h>
+#if defined(__MINGW32__)
+# include <freetype/truetype/tterrors.h>
+#else
+# include <tterrors.h>
+#endif
typedef struct bpdata {
int range; /* tt_coderange_glyph, tt_coderange_font, tt_coderange_cvt */
diff --git a/fontforge/http.c b/fontforge/http.c
index 774358d2..5b7657ec 100644
--- a/fontforge/http.c
+++ b/fontforge/http.c
@@ -29,6 +29,24 @@
#include <utype.h>
#include <gio.h>
+#if defined(__MINGW32__)
+int HasLicense(SplineFont *sf,FILE *tmp) {
+ return true;
+}
+int OFLibUploadFont(OFLibData *oflib) {
+ return false;
+}
+int HttpGetBuf(char *url, char *databuf, int *datalen, void *_lock) {
+ return -1;
+}
+FILE *URLToTempFile(char *url,void *_lock) {
+ return NULL;
+}
+int URLFromFile(char *url,FILE *from) {
+ return false;
+}
+#else
+
#include <stdio.h>
#include <unistd.h>
#include <sys/select.h>
@@ -1493,3 +1511,5 @@ return( FtpURLAndTempFile(url,NULL,from));
return( false );
}
}
+
+#endif /* !__MINGW32__ */
diff --git a/fontforge/libffstamp.h b/fontforge/libffstamp.h
index 4878b06b..c8f082d5 100644
--- a/fontforge/libffstamp.h
+++ b/fontforge/libffstamp.h
@@ -1,3 +1,3 @@
-#define LibFF_ModTime 1265242765L /* Seconds since 1970 (standard unix time) */
-#define LibFF_ModTime_Str "00:19 GMT 4-Feb-2010"
-#define LibFF_VersionDate 20100204 /* Year, month, day */
+#define LibFF_ModTime 1265934098L /* Seconds since 1970 (standard unix time) */
+#define LibFF_ModTime_Str "00:21 GMT 12-Feb-2010"
+#define LibFF_VersionDate 20100212 /* Year, month, day */
diff --git a/fontforge/noprefs.c b/fontforge/noprefs.c
index 3f7d91c2..38ec8450 100644
--- a/fontforge/noprefs.c
+++ b/fontforge/noprefs.c
@@ -444,7 +444,26 @@ return( prefs );
}
static char *NOUI_getFontForgeShareDir(void) {
-#if defined(SHAREDIR)
+#if defined(__MINGW32__)
+ static char* sharedir = NULL;
+ if(!sharedir){
+ char path[MAX_PATH+32];
+ char* c = path;
+ char* tail = 0;
+ unsigned int len = GetModuleFileNameA(NULL, path, MAX_PATH);
+ path[len] = '\0';
+ for(; *c; *c++){
+ if(*c == '\\'){
+ tail=c;
+ *c = '/';
+ }
+ }
+ if(!tail) tail=c;
+ strcpy(tail, "/share/fontforge");
+ sharedir = copy(path);
+ }
+ return sharedir;
+#elif defined(SHAREDIR)
return( SHAREDIR "/fontforge" );
#elif defined(PREFIX)
return( PREFIX "/share/fontforge" );
diff --git a/fontforge/oflib.c b/fontforge/oflib.c
index f8c8625c..2df67cad 100644
--- a/fontforge/oflib.c
+++ b/fontforge/oflib.c
@@ -31,6 +31,7 @@
#include <gkeysym.h>
#include <unistd.h>
#include <sys/stat.h>
+#include "gfile.h"
#include <pthread.h>
#ifndef __VMS
@@ -43,6 +44,10 @@ extern GBox _ggadget_Default_Box;
#define ACTIVE_BORDER (_ggadget_Default_Box.active_border)
#define MAIN_FOREGROUND (_ggadget_Default_Box.main_foreground)
+#if defined(__MINGW32__)
+# define SIGUSR1 18
+#endif
+
/* A dialog for browsing through fonts on the Open Font Library website */
@@ -517,7 +522,7 @@ return( oflibdir );
return( NULL );
sprintf(buffer,"%s/OFLib", getPfaEditDir(buffer));
if ( access(buffer,F_OK)==-1 )
- if ( mkdir(buffer,0700)==-1 )
+ if ( GFileMkDir(buffer)==-1 )
return( NULL );
oflibdir = copy(buffer);
@@ -1018,7 +1023,12 @@ pthread_exit(NULL);
d->http_timer=NULL;
d->die = true;
- if ( d->http_thread ) {
+#if defined(__MINGW32__)
+ if ( d->http_thread.x )
+#else
+ if ( d->http_thread )
+#endif
+ {
void *status;
pthread_mutex_unlock(&d->http_thread_done);
pthread_mutex_unlock(&d->http_thread_can_do_stuff);
diff --git a/fontforge/prefs.c b/fontforge/prefs.c
index 07ae6737..1f3996fd 100644
--- a/fontforge/prefs.c
+++ b/fontforge/prefs.c
@@ -730,6 +730,17 @@ static char *PrefsUI_getFontForgeShareDir(void) {
return( sharedir );
set = true;
+
+#if defined(__MINGW32__)
+
+ len = strlen(GResourceProgramDir) + strlen("/share/fontforge") +1;
+ sharedir = galloc(len);
+ strcpy(sharedir, GResourceProgramDir);
+ strcat(sharedir, "/share/fontforge");
+ return sharedir;
+
+#else
+
pt = strstr(GResourceProgramDir,"/bin");
if ( pt==NULL ) {
#if defined(SHAREDIR)
@@ -747,6 +758,8 @@ return( NULL );
strncpy(sharedir,GResourceProgramDir,pt-GResourceProgramDir);
strcpy(sharedir+(pt-GResourceProgramDir),"/share/fontforge");
return( sharedir );
+
+#endif
}
# include <charset.h> /* we still need the charsets & encoding to set local_encoding */
@@ -960,7 +973,9 @@ static void DefaultXUID(void) {
static void DefaultHelp(void) {
if ( helpdir==NULL ) {
-#ifdef DOCDIR
+#if defined(__MINGW32__)
+ helpdir = copy("");
+#elif defined(DOCDIR)
helpdir = copy(DOCDIR "/");
#elif defined(SHAREDIR)
helpdir = copy(SHAREDIR "/doc/fontforge/");
diff --git a/fontforge/print.c b/fontforge/print.c
index b88e0c13..23462316 100644
--- a/fontforge/print.c
+++ b/fontforge/print.c
@@ -33,7 +33,9 @@
#include <ustring.h>
#include "utype.h"
#include <sys/types.h>
+#if !defined(__MINGW32__)
#include <sys/wait.h>
+#endif
#include "print.h"
int pagewidth = 0, pageheight=0; /* In points */
@@ -2748,6 +2750,7 @@ return( gcalloc(1,sizeof(unichar_t)));
/* ************************************************************************** */
static void QueueIt(PI *pi) {
+ #if !defined(__MINGW32__)
int pid;
int stdinno, i, status;
char *argv[40], buf[10];
@@ -2837,6 +2840,7 @@ static void QueueIt(PI *pi) {
}
}
waitpid(-1,&status,WNOHANG); /* Clean up any zombie ghostviews */
+ #endif
}
void DoPrinting(PI *pi,char *filename) {
diff --git a/fontforge/scripting.c b/fontforge/scripting.c
index b8a55536..20ffad35 100644
--- a/fontforge/scripting.c
+++ b/fontforge/scripting.c
@@ -7969,11 +7969,9 @@ static void bCompareFonts(Context *c) {
t = script2utf8_copy(c->a.vals[1].u.sval);
locfilename = utf82def_copy(t);
free(t);
- if ( *locfilename!='/' ) {
- t = ToAbsolute(locfilename);
- free(locfilename);
- locfilename = t;
- }
+ t = GFileMakeAbsoluteName(locfilename);
+ free(locfilename);
+ locfilename = t;
sf2 = FontWithThisFilename(locfilename);
free( locfilename );
if ( sf2==NULL )
diff --git a/fontforge/sfd.c b/fontforge/sfd.c
index ad9609c0..bd5e7a40 100644
--- a/fontforge/sfd.c
+++ b/fontforge/sfd.c
@@ -40,6 +40,9 @@
#include <dirent.h>
#include <limits.h> /* For NAME_MAX or _POSIX_NAME_MAX */
#ifndef NAME_MAX
+# ifndef _POSIX_NAME_MAX
+# define _POSIX_NAME_MAX 512
+# endif
# define NAME_MAX _POSIX_NAME_MAX
#endif
@@ -2287,7 +2290,7 @@ static int SFD_Dump(FILE *sfd,SplineFont *sf,EncMap *map,EncMap *normal,
char *fontprops;
FILE *ssfd;
sprintf( subfont,"%s/%s" SUBFONT_EXT, dirname, sf->subfonts[i]->fontname );
- mkdir(subfont,0755);
+ GFileMkDir(subfont);
fontprops = galloc(strlen(subfont)+strlen("/" FONT_PROPS)+1);
strcpy(fontprops,subfont); strcat(fontprops,"/" FONT_PROPS);
ssfd = fopen( fontprops,"w");
@@ -2372,7 +2375,7 @@ static int SFD_Dump(FILE *sfd,SplineFont *sf,EncMap *map,EncMap *normal,
char *strikeprops;
FILE *ssfd;
sprintf( strike,"%s/%d" STRIKE_EXT, dirname, bdf->pixelsize );
- mkdir(strike,0755);
+ GFileMkDir(strike);
strikeprops = galloc(strlen(strike)+strlen("/" STRIKE_PROPS)+1);
strcpy(strikeprops,strike); strcat(strikeprops,"/" STRIKE_PROPS);
ssfd = fopen( strikeprops,"w");
@@ -2403,7 +2406,7 @@ static int SFD_MIDump(SplineFont *sf,EncMap *map,EncMap *normal, char *dirname,
/* I'd like to use the font name, but the order of the instances is */
/* crucial and I must enforce an ordering on them */
sprintf( instance,"%s/mm%d" INSTANCE_EXT, dirname, mm_pos );
- mkdir(instance,0755);
+ GFileMkDir(instance);
fontprops = galloc(strlen(instance)+strlen("/" FONT_PROPS)+1);
strcpy(fontprops,instance); strcat(fontprops,"/" FONT_PROPS);
ssfd = fopen( fontprops,"w");
@@ -2585,7 +2588,7 @@ int SFDWrite(char *filename,SplineFont *sf,EncMap *map,EncMap *normal,int todir)
if ( todir ) {
SFDirClean(filename);
- mkdir(filename,0755); /* this will fail if directory already exists. That's ok */
+ GFileMkDir(filename); /* this will fail if directory already exists. That's ok */
tempfilename = galloc(strlen(filename)+strlen("/" FONT_PROPS)+1);
strcpy(tempfilename,filename); strcat(tempfilename,"/" FONT_PROPS);
}
diff --git a/fontforge/splinefont.c b/fontforge/splinefont.c
index efee0bb1..93f79466 100644
--- a/fontforge/splinefont.c
+++ b/fontforge/splinefont.c
@@ -784,7 +784,7 @@ return( NULL );
if ( dir==NULL ) dir = P_tmpdir;
archivedir = galloc(strlen(dir)+100);
sprintf( archivedir, "%s/ffarchive-%d-%d", dir, getpid(), ++cnt );
- if ( mkdir(archivedir,0700)!=0 ) {
+ if ( GFileMkDir(archivedir)!=0 ) {
free(archivedir);
return( NULL );
}
diff --git a/fontforge/stamp.c b/fontforge/stamp.c
index 15bd49b8..ed864d0d 100644
--- a/fontforge/stamp.c
+++ b/fontforge/stamp.c
@@ -1,5 +1,5 @@
#include <time.h>
-const time_t source_modtime = 1265930128L;
-const char *source_modtime_str = "23:15 GMT 11-Feb-2010";
-const char *source_version_str = "20100211";
+const time_t source_modtime = 1265934914L;
+const char *source_modtime_str = "00:35 GMT 12-Feb-2010";
+const char *source_version_str = "20100212";
diff --git a/fontforge/startnoui.c b/fontforge/startnoui.c
index facb73d1..cd3e774c 100644
--- a/fontforge/startnoui.c
+++ b/fontforge/startnoui.c
@@ -39,12 +39,28 @@
static char *GResourceProgramDir;
static void FindProgDir(char *prog) {
+#if defined(__MINGW32__)
+ char path[MAX_PATH+4];
+ char* c = path;
+ char* tail = 0;
+ unsigned int len = GetModuleFileNameA(NULL, path, MAX_PATH);
+ path[len] = '\0';
+ for(; *c; *c++){
+ if(*c == '\\'){
+ tail=c;
+ *c = '/';
+ }
+ }
+ if(tail) *tail='\0';
+ GResourceProgramDir = copy(path);
+#else
GResourceProgramDir = _GFile_find_program_dir(prog);
if ( GResourceProgramDir==NULL ) {
char filename[1025];
GFileGetAbsoluteName(".",filename,sizeof(filename));
GResourceProgramDir = copy(filename);
}
+#endif
}
static char *getLocaleDir(void) {
@@ -57,6 +73,17 @@ static char *getLocaleDir(void) {
return( sharedir );
set = true;
+
+#if defined(__MINGW32__)
+
+ len = strlen(GResourceProgramDir) + strlen("/share/locale") +1;
+ sharedir = galloc(len);
+ strcpy(sharedir, GResourceProgramDir);
+ strcat(sharedir, "/share/locale");
+ return sharedir;
+
+#else
+
pt = strstr(GResourceProgramDir,"/bin");
if ( pt==NULL ) {
#ifdef SHAREDIR
@@ -72,6 +99,8 @@ return( sharedir = PREFIX "/share/locale" );
strncpy(sharedir,GResourceProgramDir,pt-GResourceProgramDir);
strcpy(sharedir+(pt-GResourceProgramDir),"/share/locale");
return( sharedir );
+
+#endif
}
static void _doscriptusage(void) {
printf( "fontforge [options]\n" );
diff --git a/fontforge/startui.c b/fontforge/startui.c
index 0000e958..112c0fea 100644
--- a/fontforge/startui.c
+++ b/fontforge/startui.c
@@ -49,6 +49,13 @@ extern void RunApplicationEventLoop(void);
# undef KernPair
#endif
+#if defined(__MINGW32__)
+#include <Windows.h>
+int srandom( int n ){ srand(n); }
+int random( void ){ return rand();}
+void sleep( int n ){ _sleep(n);}
+#endif
+
int splash = 1;
static int localsplash;
static int unique = 0;
@@ -306,6 +313,7 @@ static struct library_descriptor {
};
static void _dolibrary(void) {
+#if !defined(__MINGW32__)
#ifndef __VMS
int i, j;
char buffer[3000];
@@ -432,6 +440,7 @@ static void _dolibrary(void) {
fprintf( stderr, "\tUnfortunately this version of fontforge is not configured to use this\n\t library. You must rebuild from source.\n" );
}
#endif
+#endif
}
static void dolibrary(void) {
@@ -975,6 +984,17 @@ static char *getLocaleDir(void) {
return( sharedir );
set = true;
+
+#if defined(__MINGW32__)
+
+ len = strlen(GResourceProgramDir) + strlen("/share/locale") +1;
+ sharedir = galloc(len);
+ strcpy(sharedir, GResourceProgramDir);
+ strcat(sharedir, "/share/locale");
+ return sharedir;
+
+#else
+
pt = strstr(GResourceProgramDir,"/bin");
if ( pt==NULL ) {
#ifdef SHAREDIR
@@ -990,6 +1010,8 @@ return( sharedir = PREFIX "/share/locale" );
strncpy(sharedir,GResourceProgramDir,pt-GResourceProgramDir);
strcpy(sharedir+(pt-GResourceProgramDir),"/share/locale");
return( sharedir );
+
+#endif
}
#if defined(__Mac)
@@ -1066,6 +1088,21 @@ int main( int argc, char **argv ) {
local_x = 0;
#endif
+#if defined(__MINGW32__)
+ if( getenv("DISPLAY")==NULL ) {
+ putenv("DISPLAY=127.0.0.1:0.0");
+ }
+ if( getenv("LC_ALL")==NULL ){
+ char lang[8];
+ char env[32];
+ if( GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, lang, 8) > 0 ){
+ strcpy(env, "LC_ALL=");
+ strcat(env, lang);
+ putenv(env);
+ }
+ }
+#endif
+
FF_SetUiInterface(&gdraw_ui_interface);
FF_SetPrefsInterface(&gdraw_prefs_interface);
FF_SetSCInterface(&gdraw_sc_interface);
@@ -1081,7 +1118,20 @@ int main( int argc, char **argv ) {
InitSimpleStuff();
+#if defined(__MINGW32__)
+ {
+ char path[MAX_PATH+4];
+ char *c = path;
+ unsigned int len = GetModuleFileNameA(NULL, path, MAX_PATH);
+ path[len] = '\0';
+ for(; *c; *c++) /* backslash to slash */
+ if(*c == '\\')
+ *c = '/';
+ GResourceSetProg(path);
+ }
+#else
GResourceSetProg(argv[0]);
+#endif
#if defined(__Mac)
/* The mac seems to default to the "C" locale, LANG and LC_MESSAGES are not*/
@@ -1099,8 +1149,9 @@ int main( int argc, char **argv ) {
{ int did_keybindings = 0;
if ( local_x && !get_mac_x11_prop("enable_key_equivalents") ) {
/* Ok, we get the command key */
- if ( getenv("LANG")==NULL && getenv("LC_MESSAGES")==NULL )
+ if ( getenv("LANG")==NULL && getenv("LC_MESSAGES")==NULL ) {
setenv("LC_MESSAGES","en_US.UTF-8",0);
+ }
/* Can we find a set of keybindings designed for the mac with cmd key? */
bind_textdomain_codeset("Mac-FontForge-MenuShortCuts","UTF-8");
bindtextdomain("Mac-FontForge-MenuShortCuts", getLocaleDir());
@@ -1122,7 +1173,21 @@ int main( int argc, char **argv ) {
bindtextdomain("FontForge", getLocaleDir());
textdomain("FontForge");
GResourceUseGetText();
-#ifdef SHAREDIR
+#if defined(__MINGW32__)
+ {
+ size_t len = strlen(GResourceProgramDir);
+ char* path = galloc(len + 64);
+ strcpy(path, GResourceProgramDir);
+
+ strcpy(path+len, "/share/fontforge/pixmaps"); /* PixmapDir */
+ GGadgetSetImageDir(path);
+
+ strcpy(path+len, "/fontforge.resource"); /* Resource File */
+ GResourceAddResourceFile(path, GResourceProgramName);
+
+ gfree(path);
+ }
+#elif defined(SHAREDIR)
GGadgetSetImageDir(SHAREDIR "/pixmaps");
#endif
diff --git a/fontforge/ttfinstrsui.c b/fontforge/ttfinstrsui.c
index fc83ce31..71c004f5 100644
--- a/fontforge/ttfinstrsui.c
+++ b/fontforge/ttfinstrsui.c
@@ -367,6 +367,7 @@ static void instr_expose(struct instrinfo *ii,GWindow pixmap,GRect *rect) {
int addr_end, num_end;
static unichar_t nums[] = { '0', '0', '0', '0', '0', '0', '\0' };
int indent;
+ extern GBox _ggadget_Default_Box;
GDrawSetFont(pixmap,ii->gfont);
GDrawSetLineWidth(pixmap,0);
diff --git a/fontforge/ufo.c b/fontforge/ufo.c
index 5b8eb859..151c56fc 100644
--- a/fontforge/ufo.c
+++ b/fontforge/ufo.c
@@ -736,7 +736,7 @@ int WriteUFOFont(char *basedir,SplineFont *sf,enum fontformat ff,int flags,
free( foo );
/* Create it */
- mkdir( basedir, 0755 );
+ GFileMkDir( basedir );
err = !UFOOutputMetaInfo(basedir,sf);
err |= !UFOOutputFontInfo(basedir,sf,layer);
@@ -752,7 +752,7 @@ int WriteUFOFont(char *basedir,SplineFont *sf,enum fontformat ff,int flags,
return( false );
glyphdir = buildname(basedir,"glyphs");
- mkdir( glyphdir, 0755 );
+ GFileMkDir( glyphdir );
plist = PListCreate(glyphdir,"contents.plist");
if ( plist==NULL ) {
diff --git a/fontforge/uiutil.c b/fontforge/uiutil.c
index ae3fbaee..20dc0e3f 100644
--- a/fontforge/uiutil.c
+++ b/fontforge/uiutil.c
@@ -252,6 +252,53 @@ return;
}
}
+#if defined(__MINGW32__)
+#include <gresource.h>
+#include <Windows.h>
+void help(char *file) {
+ if(file){
+ char* p_file = copy(file);
+ char* p_uri = p_file;
+ char* p_param = strrchr(p_file,'#');
+
+ if(p_param){
+ *p_param = '\0';
+ }
+ if(! GFileIsAbsolute(p_file)){
+ p_uri = (char*) galloc( 256 + strlen(GResourceProgramDir) + strlen(p_file) );
+
+ strcpy(p_uri, GResourceProgramDir); /* doc/fontforge/ja/file */
+ strcat(p_uri, "/doc/fontforge/");
+ AppendSupportedLocale(p_uri);
+ strcat(p_uri, p_file);
+
+ if(!GFileReadable(p_uri)){
+ strcpy(p_uri, GResourceProgramDir);/* doc/fontforge/file */
+ strcat(p_uri, "/doc/fontforge/");
+ strcat(p_uri, p_file);
+
+ if(!GFileReadable(p_uri)){
+ strcpy(p_uri, "http://fontforge.sourceforge.net/"); /* http://host/ja/file */
+ AppendSupportedLocale(p_uri);
+ strcat(p_uri, p_file);
+ }
+ }
+ }
+ if(p_param){
+ if(p_uri != p_file)
+ strcat(p_uri, p_param);
+ else
+ *p_param = '#';
+ }
+
+ /* using default browser */
+ ShellExecute(NULL, "open", p_uri, NULL, NULL, SW_SHOWDEFAULT);
+
+ if(p_uri != p_file) gfree(p_uri);
+ }
+}
+#else
+
void help(char *file) {
char fullspec[1024], *temp, *pt;
@@ -266,7 +313,7 @@ return;
if ( strstr(file,"http://")==NULL ) {
fullspec[0] = 0;
- if ( *file!='/' ) {
+ if ( ! GFileIsAbsolute(file) ) {
if ( helpdir==NULL || *helpdir=='\0' ) {
#ifdef DOCDIR
strcpy(fullspec,DOCDIR "/");
@@ -364,6 +411,7 @@ return;
}
free(temp);
}
+#endif
static void UI_IError(const char *format,...) {
va_list ap;
@@ -609,6 +657,7 @@ GMenuItem warnpopupmenu[] = {
static int warningsv_e_h(GWindow gw, GEvent *event) {
int i;
+ extern GBox _ggadget_Default_Box;
if (( event->type==et_mouseup || event->type==et_mousedown ) &&
(event->u.mouse.button==4 || event->u.mouse.button==5) ) {
@@ -872,6 +921,7 @@ return( gwwv_save_filename(title,defaultfile,initial_filter) );
}
static void tinysleep(int microsecs) {
+ #if !defined(__MINGW32__)
fd_set none;
struct timeval timeout;
@@ -880,6 +930,7 @@ static void tinysleep(int microsecs) {
timeout.tv_usec = microsecs;
select(1,&none,&none,&none,&timeout);
+ #endif
}
static void allow_events(void) {
diff --git a/fontforge/views.h b/fontforge/views.h
index 030b5df8..4fc9ad45 100644
--- a/fontforge/views.h
+++ b/fontforge/views.h
@@ -197,8 +197,9 @@ typedef struct charview {
SplinePoint *lastselpt;
spiro_cp *lastselcp;
/*GWindow tools, layers;*/
- int8 b1_tool, cb1_tool, b2_tool, cb2_tool; /* Button 3 does a popup */
- int8 s1_tool, s2_tool, er_tool; /* Bindings for wacom stylus and eraser */
+ int8 b1_tool, cb1_tool, b2_tool, cb2_tool; /* Button 3 does a popup */
+ int8 b1_tool_old; /* Used by mingw port */
+ int8 s1_tool, s2_tool, er_tool; /* Bindings for wacom stylus and eraser */
int8 showing_tool, pressed_tool, pressed_display, had_control, active_tool;
SplinePointList *active_spl;
SplinePoint *active_sp;
diff --git a/fontforge/windowmenu.c b/fontforge/windowmenu.c
index 0c6ec225..114e81bb 100644
--- a/fontforge/windowmenu.c
+++ b/fontforge/windowmenu.c
@@ -41,8 +41,10 @@ static void AddMI(GMenuItem *mi,GWindow gw,int changed, int top) {
if ( top ) mi->ti.fg = 0x008000;
mi->invoke = WindowSelect;
mi->ti.text = GDrawGetWindowTitle(gw);
- if ( u_strlen( mi->ti.text ) > 20 )
- mi->ti.text[20] = '\0';
+ if(mi->ti.text == NULL)
+ mi->ti.text = utf82u_copy("(null)");
+ if ( u_strlen( mi->ti.text ) > 35 )
+ mi->ti.text[35] = '\0';
}
/* Builds up a menu containing the titles of all the major windows */