| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#include <fontforge-config.h> |
| 29 |
|
| 30 |
#include "autosave.h" |
| 31 |
#include "autotrace.h" |
| 32 |
#include "autowidth.h" |
| 33 |
#include "autowidth2.h" |
| 34 |
#include "bitmapchar.h" |
| 35 |
#include "bvedit.h" |
| 36 |
#include "cvundoes.h" |
| 37 |
#include "dumppfa.h" |
| 38 |
#include "encoding.h" |
| 39 |
#include "ffglib.h" |
| 40 |
#include "ffprocess.h" |
| 41 |
#include "fontforgeui.h" |
| 42 |
#include "fvcomposite.h" |
| 43 |
#include "fvfonts.h" |
| 44 |
#include "gfile.h" |
| 45 |
#include "gimage.h" |
| 46 |
#include "gkeysym.h" |
| 47 |
#include "gresedit.h" |
| 48 |
#include "groups.h" |
| 49 |
#include "mm.h" |
| 50 |
#include "namelist.h" |
| 51 |
#include "nonlineartrans.h" |
| 52 |
#include "psfont.h" |
| 53 |
#include "pua.h" |
| 54 |
#include "scripting.h" |
| 55 |
#include "search.h" |
| 56 |
#include "sfd.h" |
| 57 |
#include "sfundo.h" |
| 58 |
#include "splinefill.h" |
| 59 |
#include "splinesaveafm.h" |
| 60 |
#include "splineutil.h" |
| 61 |
#include "splineutil2.h" |
| 62 |
#include "tottfgpos.h" |
| 63 |
#include "ustring.h" |
| 64 |
#include "utype.h" |
| 65 |
#include "views.h" |
| 66 |
|
| 67 |
#include "fv_mids.h" |
| 68 |
|
| 69 |
#include "gtk/show_histogram_shim.hpp" |
| 70 |
#include "gtk/simple_dialogs.hpp" |
| 71 |
|
| 72 |
#include <math.h> |
| 73 |
#include <unistd.h> |
| 74 |
|
| 75 |
#if defined (__MINGW32__) |
| 76 |
#include <windows.h> |
| 77 |
#endif |
| 78 |
|
| 79 |
int OpenCharsInNewWindow = 0; |
| 80 |
char *RecentFiles[RECENT_MAX] = { NULL }; |
| 81 |
int save_to_dir = 0; |
| 82 |
unichar_t *script_menu_names[SCRIPT_MENU_MAX]; |
| 83 |
char *script_filenames[SCRIPT_MENU_MAX]; |
| 84 |
extern int onlycopydisplayed, copymetadata, copyttfinstr, add_char_to_name_list; |
| 85 |
int home_char='A'; |
| 86 |
int compact_font_on_open=0; |
| 87 |
int warn_script_unsaved = 0; |
| 88 |
int navigation_mask = 0; |
| 89 |
|
| 90 |
static int fv_fontpx; |
| 91 |
static GResFont fv_font = GRESFONT_INIT("400 12pt " SANS_UI_FAMILIES); |
| 92 |
extern void python_call_onClosingFunctions(); |
| 93 |
|
| 94 |
extern GResInfo fontview_ri, view_ri; |
| 95 |
|
| 96 |
#define FV_LAB_HEIGHT 15 |
| 97 |
|
| 98 |
#ifdef BIGICONS |
| 99 |
#define fontview_width 32 |
| 100 |
#define fontview_height 32 |
| 101 |
static unsigned char fontview_bits[] = { |
| 102 |
0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x20, 0x80, 0x00, |
| 103 |
0x82, 0x20, 0x86, 0x08, 0x42, 0x21, 0x8a, 0x14, 0xc2, 0x21, 0x86, 0x04, |
| 104 |
0x42, 0x21, 0x8a, 0x14, 0x42, 0x21, 0x86, 0x08, 0x02, 0x20, 0x80, 0x00, |
| 105 |
0xaa, 0xaa, 0xaa, 0xaa, 0x02, 0x20, 0x80, 0x00, 0x82, 0xa0, 0x8f, 0x18, |
| 106 |
0x82, 0x20, 0x91, 0x24, 0x42, 0x21, 0x91, 0x02, 0x42, 0x21, 0x91, 0x02, |
| 107 |
0x22, 0x21, 0x8f, 0x02, 0xe2, 0x23, 0x91, 0x02, 0x12, 0x22, 0x91, 0x02, |
| 108 |
0x3a, 0x27, 0x91, 0x24, 0x02, 0xa0, 0x8f, 0x18, 0x02, 0x20, 0x80, 0x00, |
| 109 |
0xfe, 0xff, 0xff, 0xff, 0x02, 0x20, 0x80, 0x00, 0x42, 0x20, 0x86, 0x18, |
| 110 |
0xa2, 0x20, 0x8a, 0x04, 0xa2, 0x20, 0x86, 0x08, 0xa2, 0x20, 0x8a, 0x10, |
| 111 |
0x42, 0x20, 0x8a, 0x0c, 0x82, 0x20, 0x80, 0x00, 0x02, 0x20, 0x80, 0x00, |
| 112 |
0xaa, 0xaa, 0xaa, 0xaa, 0x02, 0x20, 0x80, 0x00}; |
| 113 |
#else |
| 114 |
#define fontview2_width 16 |
| 115 |
#define fontview2_height 16 |
| 116 |
static unsigned char fontview2_bits[] = { |
| 117 |
0x00, 0x07, 0x80, 0x08, 0x40, 0x17, 0x40, 0x15, 0x60, 0x09, 0x10, 0x02, |
| 118 |
0xa0, 0x01, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0x50, 0x00, 0x52, 0x00, |
| 119 |
0x55, 0x00, 0x5d, 0x00, 0x22, 0x00, 0x1c, 0x00}; |
| 120 |
#endif |
| 121 |
|
| 122 |
extern int _GScrollBar_Width; |
| 123 |
|
| 124 |
static int fv_fs_init=0; |
| 125 |
Color fvfgcol = 0x000000; |
| 126 |
static Color fvselcol = 0xffff00, fvselfgcol=0x000000; |
| 127 |
Color view_bgcol = 0xffffff; |
| 128 |
static Color fvslotcol = 0x000000; |
| 129 |
static Color fvslotdivcol = 0x808080; |
| 130 |
static Color fvlabelcol = 0x000000; |
| 131 |
static Color fvunenclabelcol = 0x505050; |
| 132 |
static Color fvmissinglabelcol = 0xff0000; |
| 133 |
static Color fvglyphinfocol = 0xff0000; |
| 134 |
static Color fvemtpyslotfgcol = 0xd08080; |
| 135 |
static Color fvchangedcol = 0x000060; |
| 136 |
static Color fvhintingneededcol = 0x0000ff; |
| 137 |
static Color fvmetbaselinecol = 0x0000c0; |
| 138 |
static Color fvmetorigincol = 0xc00000; |
| 139 |
static Color fvmetglyphcontourcol = 0xa45a38; |
| 140 |
static Color fvmetadvanceatcol = 0x008000; |
| 141 |
static Color fvmetadvancetocol = 0x008000; |
| 142 |
static Color fvmissingbitmapcol = 0xff0000; |
| 143 |
static Color fvmissingoutlinecol = 0x008000; |
| 144 |
|
| 145 |
enum glyphlable { gl_glyph, gl_name, gl_unicode, gl_encoding }; |
| 146 |
int default_fv_showhmetrics=false, default_fv_showvmetrics=false, |
| 147 |
default_fv_glyphlabel = gl_glyph; |
| 148 |
FontView *fv_list=NULL; |
| 149 |
|
| 150 |
|
| 151 |
static void FV_ToggleCharChanged(SplineChar *sc) { |
| 152 |
int i, j; |
| 153 |
int pos; |
| 154 |
FontView *fv; |
| 155 |
|
| 156 |
for ( fv = (FontView *) (sc->parent->fv); fv!=NULL; fv=(FontView *) (fv->b.nextsame) ) { |
| 157 |
if ( fv->b.sf!=sc->parent ) |
| 158 |
continue; |
| 159 |
if ( fv->v==NULL || fv->colcnt==0 ) |
| 160 |
continue; |
| 161 |
for ( pos=0; pos<fv->b.map->enccount; ++pos ) if ( fv->b.map->map[pos]==sc->orig_pos ) { |
| 162 |
i = pos / fv->colcnt; |
| 163 |
j = pos - i*fv->colcnt; |
| 164 |
i -= fv->rowoff; |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
if ( i>=0 && i<=fv->rowcnt ) { |
| 170 |
GRect r; |
| 171 |
r.x = j*fv->cbw+1; r.width = fv->cbw-1; |
| 172 |
r.y = i*fv->cbh+1; r.height = fv->lab_height-1; |
| 173 |
GDrawRequestExpose(fv->v,&r,false); |
| 174 |
} |
| 175 |
} |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 179 |
void FVMarkHintsOutOfDate(SplineChar *sc) { |
| 180 |
int i, j; |
| 181 |
int pos; |
| 182 |
FontView *fv; |
| 183 |
|
| 184 |
if ( sc->parent->onlybitmaps || sc->parent->multilayer || sc->parent->strokedfont ) |
| 185 |
return; |
| 186 |
for ( fv = (FontView *) (sc->parent->fv); fv!=NULL; fv=(FontView *) (fv->b.nextsame) ) { |
| 187 |
if ( fv->b.sf!=sc->parent ) |
| 188 |
continue; |
| 189 |
if ( sc->layers[fv->b.active_layer].order2 ) |
| 190 |
continue; |
| 191 |
if ( fv->v==NULL || fv->colcnt==0 ) |
| 192 |
continue; |
| 193 |
for ( pos=0; pos<fv->b.map->enccount; ++pos ) if ( fv->b.map->map[pos]==sc->orig_pos ) { |
| 194 |
i = pos / fv->colcnt; |
| 195 |
j = pos - i*fv->colcnt; |
| 196 |
i -= fv->rowoff; |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
if ( i>=0 && i<=fv->rowcnt ) { |
| 202 |
GRect r; |
| 203 |
r.x = j*fv->cbw+1; r.width = fv->cbw-1; |
| 204 |
r.y = i*fv->cbh+1; r.height = fv->lab_height-1; |
| 205 |
GDrawRequestExpose(fv->v, &r, false); |
| 206 |
} |
| 207 |
} |
| 208 |
} |
| 209 |
} |
| 210 |
|
| 211 |
static int FeatureTrans(FontView *fv, int enc) { |
| 212 |
SplineChar *sc; |
| 213 |
PST *pst; |
| 214 |
char *pt; |
| 215 |
int gid; |
| 216 |
|
| 217 |
if ( enc<0 || enc>=fv->b.map->enccount || (gid = fv->b.map->map[enc])==-1 ) |
| 218 |
return( -1 ); |
| 219 |
if ( fv->cur_subtable==NULL ) |
| 220 |
return( gid ); |
| 221 |
|
| 222 |
sc = fv->b.sf->glyphs[gid]; |
| 223 |
if ( sc==NULL ) |
| 224 |
return( -1 ); |
| 225 |
for ( pst = sc->possub; pst!=NULL; pst=pst->next ) { |
| 226 |
if (( pst->type == pst_substitution || pst->type == pst_alternate ) && |
| 227 |
pst->subtable == fv->cur_subtable ) |
| 228 |
break; |
| 229 |
} |
| 230 |
if ( pst==NULL ) |
| 231 |
return( -1 ); |
| 232 |
pt = strchr(pst->u.subs.variant,' '); |
| 233 |
if ( pt!=NULL ) |
| 234 |
*pt = '\0'; |
| 235 |
gid = SFFindExistingSlot(fv->b.sf, -1, pst->u.subs.variant ); |
| 236 |
if ( pt!=NULL ) |
| 237 |
*pt = ' '; |
| 238 |
return( gid ); |
| 239 |
} |
| 240 |
|
| 241 |
extern BDFFont *FVSplineFontPieceMeal(SplineFont *sf, int layer, int ptsize, int dpi, int flags, void *freetype_context) { |
| 242 |
BDFFont *new = SplineFontPieceMeal(sf, layer, ptsize, dpi, flags, freetype_context); |
| 243 |
if (new->clut != NULL) { |
| 244 |
Color bg = view_bgcol; |
| 245 |
Color fg = fvfgcol; |
| 246 |
int l, scale = new->clut->clut_len; |
| 247 |
for ( l=0; l<scale; ++l ) |
| 248 |
new->clut->clut[l] = COLOR_CREATE( |
| 249 |
COLOR_RED(bg) + ((int32_t) (l*(COLOR_RED(fg)-COLOR_RED(bg))))/(scale-1), |
| 250 |
COLOR_GREEN(bg) + ((int32_t) (l*(COLOR_GREEN(fg)-COLOR_GREEN(bg))))/(scale-1), |
| 251 |
COLOR_BLUE(bg) + ((int32_t) (l*(COLOR_BLUE(fg)-COLOR_BLUE(bg))))/(scale-1) ); |
| 252 |
} |
| 253 |
return new; |
| 254 |
} |
| 255 |
|
| 256 |
static void FVDrawGlyph(GWindow pixmap, FontView *fv, int index, int request_expose) { |
| 257 |
GRect box, old2; |
| 258 |
int feat_gid; |
| 259 |
SplineChar *sc; |
| 260 |
struct _GImage base; |
| 261 |
GImage gi; |
| 262 |
GClut clut; |
| 263 |
int i,j; |
| 264 |
int em = fv->b.sf->ascent+fv->b.sf->descent; |
| 265 |
int yorg = fv->magnify*(fv->show->ascent); |
| 266 |
|
| 267 |
i = index / fv->colcnt; |
| 268 |
j = index - i*fv->colcnt; |
| 269 |
i -= fv->rowoff; |
| 270 |
box.x = j*fv->cbw+1; box.width = fv->cbw-1; |
| 271 |
box.y = i*fv->cbh+fv->lab_height+1; box.height = fv->cbw; |
| 272 |
|
| 273 |
if (request_expose) { |
| 274 |
if (index < fv->b.map->enccount) { |
| 275 |
GDrawRequestExpose(pixmap, &box, false); |
| 276 |
} |
| 277 |
return; |
| 278 |
} |
| 279 |
|
| 280 |
if ( index<fv->b.map->enccount && fv->b.selected[index] ) { |
| 281 |
GDrawFillRect(pixmap,&box,fv->b.selected[index] ? fvselcol : view_bgcol ); |
| 282 |
} |
| 283 |
feat_gid = FeatureTrans(fv,index); |
| 284 |
sc = feat_gid!=-1 ? fv->b.sf->glyphs[feat_gid]: NULL; |
| 285 |
if ( !SCWorthOutputting(sc) ) { |
| 286 |
int x = j*fv->cbw+1, xend = x+fv->cbw-2; |
| 287 |
int y = i*fv->cbh+fv->lab_height+1, yend = y+fv->cbw-1; |
| 288 |
GDrawDrawLine(pixmap,x,y,xend,yend,fvemtpyslotfgcol); |
| 289 |
GDrawDrawLine(pixmap,x,yend,xend,y,fvemtpyslotfgcol); |
| 290 |
} |
| 291 |
if ( sc!=NULL ) { |
| 292 |
BDFChar *bdfc; |
| 293 |
|
| 294 |
if ( fv->show!=NULL && fv->show->piecemeal && |
| 295 |
feat_gid!=-1 && |
| 296 |
(feat_gid>=fv->show->glyphcnt || fv->show->glyphs[feat_gid]==NULL) && |
| 297 |
fv->b.sf->glyphs[feat_gid]!=NULL ) |
| 298 |
BDFPieceMeal(fv->show,feat_gid); |
| 299 |
|
| 300 |
if ( fv->show!=NULL && feat_gid!=-1 && |
| 301 |
feat_gid < fv->show->glyphcnt && |
| 302 |
fv->show->glyphs[feat_gid]==NULL && |
| 303 |
SCWorthOutputting(fv->b.sf->glyphs[feat_gid]) ) { |
| 304 |
|
| 305 |
box.x = j*fv->cbw+1; box.width = fv->cbw-2; |
| 306 |
box.y = i*fv->cbh+fv->lab_height+2; box.height = box.width+1; |
| 307 |
GDrawDrawRect(pixmap,&box,fvmissingbitmapcol); |
| 308 |
++box.x; ++box.y; box.width -= 2; box.height -= 2; |
| 309 |
GDrawDrawRect(pixmap,&box,fvmissingbitmapcol); |
| 310 |
|
| 311 |
} else if ( fv->show!=NULL && feat_gid<fv->show->glyphcnt && feat_gid!=-1 && |
| 312 |
fv->show->glyphs[feat_gid]!=NULL ) { |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
bdfc = fv->show->piecemeal ? |
| 318 |
fv->show->glyphs[feat_gid] : BDFGetMergedChar( fv->show->glyphs[feat_gid] ); |
| 319 |
|
| 320 |
memset(&gi,'\0',sizeof(gi)); |
| 321 |
memset(&base,'\0',sizeof(base)); |
| 322 |
if ( bdfc->byte_data ) { |
| 323 |
gi.u.image = &base; |
| 324 |
base.image_type = it_index; |
| 325 |
if ( !fv->b.selected[index] ) |
| 326 |
base.clut = fv->show->clut; |
| 327 |
else { |
| 328 |
int bgr=((fvselcol>>16)&0xff), bgg=((fvselcol>>8)&0xff), bgb= (fvselcol&0xff); |
| 329 |
int fgr=((fvselfgcol>>16)&0xff), fgg=((fvselfgcol>>8)&0xff), fgb= (fvselfgcol&0xff); |
| 330 |
int i; |
| 331 |
memset(&clut,'\0',sizeof(clut)); |
| 332 |
base.clut = &clut; |
| 333 |
clut.clut_len = fv->show->clut->clut_len; |
| 334 |
for ( i=0; i<clut.clut_len; ++i ) { |
| 335 |
clut.clut[i] = |
| 336 |
COLOR_CREATE( bgr + (i*(fgr-bgr))/(clut.clut_len-1), |
| 337 |
bgg + (i*(fgg-bgg))/(clut.clut_len-1), |
| 338 |
bgb + (i*(fgb-bgb))/(clut.clut_len-1)); |
| 339 |
} |
| 340 |
} |
| 341 |
GDrawSetDither(NULL, false); |
| 342 |
} else { |
| 343 |
memset(&clut,'\0',sizeof(clut)); |
| 344 |
gi.u.image = &base; |
| 345 |
base.image_type = it_mono; |
| 346 |
base.clut = &clut; |
| 347 |
clut.clut_len = 2; |
| 348 |
clut.clut[0] = fv->b.selected[index] ? fvselcol : view_bgcol ; |
| 349 |
clut.clut[1] = fv->b.selected[index] ? fvselfgcol : fvfgcol ; |
| 350 |
} |
| 351 |
base.trans = 0; |
| 352 |
base.clut->trans_index = 0; |
| 353 |
|
| 354 |
base.data = bdfc->bitmap; |
| 355 |
base.bytes_per_line = bdfc->bytes_per_line; |
| 356 |
base.width = bdfc->xmax-bdfc->xmin+1; |
| 357 |
base.height = bdfc->ymax-bdfc->ymin+1; |
| 358 |
box.x = j*fv->cbw; box.width = fv->cbw; |
| 359 |
box.y = i*fv->cbh+fv->lab_height+1; box.height = box.width+1; |
| 360 |
GDrawPushClip(pixmap,&box,&old2); |
| 361 |
if ( !fv->b.sf->onlybitmaps && fv->show!=fv->filled && |
| 362 |
sc->layers[fv->b.active_layer].splines==NULL && sc->layers[fv->b.active_layer].refs==NULL && |
| 363 |
!sc->widthset && |
| 364 |
!(bdfc->xmax<=0 && bdfc->xmin==0 && bdfc->ymax<=0 && bdfc->ymax==0) ) { |
| 365 |
|
| 366 |
GRect b; |
| 367 |
b.x = box.x+1; b.y = box.y+1; b.width = box.width-2; b.height = box.height-2; |
| 368 |
GDrawDrawRect(pixmap,&b,fvmissingoutlinecol); |
| 369 |
++b.x; ++b.y; b.width -= 2; b.height -= 2; |
| 370 |
GDrawDrawRect(pixmap,&b,fvmissingoutlinecol); |
| 371 |
} |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
int xwidth = (bdfc->width != base.width) ? bdfc->width - bdfc->xmin*2 : base.width; |
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
if ( fv->magnify>1 ) { |
| 383 |
GDrawDrawImageMagnified(pixmap,&gi,NULL, |
| 384 |
j*fv->cbw+(fv->cbw-1-fv->magnify*xwidth)/2, |
| 385 |
i*fv->cbh+fv->lab_height+1+fv->magnify*(fv->show->ascent-bdfc->ymax), |
| 386 |
fv->magnify*base.width,fv->magnify*base.height); |
| 387 |
} else if ( base.image_type==it_index ) { |
| 388 |
GDrawDrawGlyph(pixmap,&gi,NULL, |
| 389 |
j*fv->cbw+(fv->cbw-1-xwidth)/2, |
| 390 |
i*fv->cbh+fv->lab_height+1+fv->show->ascent-bdfc->ymax); |
| 391 |
} else |
| 392 |
GDrawDrawImage(pixmap,&gi,NULL, |
| 393 |
j*fv->cbw+(fv->cbw-1-xwidth)/2, |
| 394 |
i*fv->cbh+fv->lab_height+1+fv->show->ascent-bdfc->ymax); |
| 395 |
if ( fv->showhmetrics ) { |
| 396 |
int x1, x0 = j*fv->cbw+(fv->cbw-1-fv->magnify*xwidth)/2- bdfc->xmin*fv->magnify; |
| 397 |
|
| 398 |
if ( fv->showhmetrics&fvm_origin ) |
| 399 |
GDrawDrawLine(pixmap,x0,i*fv->cbh+fv->lab_height+yorg-3,x0, |
| 400 |
i*fv->cbh+fv->lab_height+yorg+2,fvmetorigincol); |
| 401 |
x1 = x0 + fv->magnify*bdfc->width; |
| 402 |
if ( fv->showhmetrics&fvm_advanceat ) |
| 403 |
GDrawDrawLine(pixmap,x1,i*fv->cbh+fv->lab_height+1,x1, |
| 404 |
(i+1)*fv->cbh-1,fvmetadvanceatcol); |
| 405 |
if ( fv->showhmetrics&fvm_advanceto ) |
| 406 |
GDrawDrawLine(pixmap,x0,(i+1)*fv->cbh-2,x1, |
| 407 |
(i+1)*fv->cbh-2,fvmetadvancetocol); |
| 408 |
if (fv->showhmetrics & fvm_contour) { |
| 409 |
int x0 = j * fv->cbw + (fv->cbw - 1 - fv->magnify * xwidth) / 2 - bdfc->xmin * fv->magnify; |
| 410 |
int y0 = i * fv->cbh + fv->lab_height + fv->magnify * fv->show->ascent + 1; |
| 411 |
CVDrawSplinePointList(NULL, pixmap, sc->layers[1].splines, fvmetglyphcontourcol, |
| 412 |
sfm_stroke, x0, y0, (double) (box.width - 1) / sc->vwidth); |
| 413 |
} |
| 414 |
} |
| 415 |
if ( fv->showvmetrics ) { |
| 416 |
int x0 = j*fv->cbw+(fv->cbw-1-fv->magnify*xwidth)/2- bdfc->xmin*fv->magnify |
| 417 |
+ fv->magnify*fv->show->pixelsize/2; |
| 418 |
int y0 = i*fv->cbh+fv->lab_height+yorg; |
| 419 |
int yvw = y0 + fv->magnify*sc->vwidth*fv->show->pixelsize/em; |
| 420 |
if ( fv->showvmetrics&fvm_baseline ) |
| 421 |
GDrawDrawLine(pixmap,x0,i*fv->cbh+fv->lab_height+1,x0, |
| 422 |
(i+1)*fv->cbh-1,fvmetbaselinecol); |
| 423 |
if ( fv->showvmetrics&fvm_advanceat ) |
| 424 |
GDrawDrawLine(pixmap,j*fv->cbw,yvw,(j+1)*fv->cbw, |
| 425 |
yvw,fvmetadvanceatcol); |
| 426 |
if ( fv->showvmetrics&fvm_advanceto ) |
| 427 |
GDrawDrawLine(pixmap,j*fv->cbw+2,y0,j*fv->cbw+2, |
| 428 |
yvw,fvmetadvancetocol); |
| 429 |
if ( fv->showvmetrics&fvm_origin ) |
| 430 |
GDrawDrawLine(pixmap,x0-3,i*fv->cbh+fv->lab_height+yorg,x0+2,i*fv->cbh+fv->lab_height+yorg,fvmetorigincol); |
| 431 |
} |
| 432 |
GDrawPopClip(pixmap,&old2); |
| 433 |
if ( !fv->show->piecemeal ) BDFCharFree( bdfc ); |
| 434 |
} |
| 435 |
} |
| 436 |
} |
| 437 |
|
| 438 |
static void FVToggleCharSelected(FontView *fv,int enc) { |
| 439 |
int i; |
| 440 |
|
| 441 |
if ( fv->v==NULL || fv->colcnt==0 ) |
| 442 |
return; |
| 443 |
|
| 444 |
i = enc / fv->colcnt; |
| 445 |
i -= fv->rowoff; |
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
if ( i>=0 && i<=fv->rowcnt ) |
| 451 |
FVDrawGlyph(fv->v,fv,enc,true); |
| 452 |
} |
| 453 |
|
| 454 |
static void FontViewRefreshAll(SplineFont *sf) { |
| 455 |
FontView *fv; |
| 456 |
for ( fv = (FontView *) (sf->fv); fv!=NULL; fv = (FontView *) (fv->b.nextsame) ) |
| 457 |
if ( fv->v!=NULL ) |
| 458 |
GDrawRequestExpose(fv->v,NULL,false); |
| 459 |
} |
| 460 |
|
| 461 |
void FVDeselectAll(FontView *fv) { |
| 462 |
int i; |
| 463 |
|
| 464 |
for ( i=0; i<fv->b.map->enccount; ++i ) { |
| 465 |
if ( fv->b.selected[i] ) { |
| 466 |
fv->b.selected[i] = false; |
| 467 |
FVToggleCharSelected(fv,i); |
| 468 |
} |
| 469 |
} |
| 470 |
fv->sel_index = 0; |
| 471 |
} |
| 472 |
|
| 473 |
static void FVInvertSelection(FontView *fv) { |
| 474 |
int i; |
| 475 |
|
| 476 |
for ( i=0; i<fv->b.map->enccount; ++i ) { |
| 477 |
fv->b.selected[i] = !fv->b.selected[i]; |
| 478 |
FVToggleCharSelected(fv,i); |
| 479 |
} |
| 480 |
fv->sel_index = 1; |
| 481 |
} |
| 482 |
|
| 483 |
static void FVSelectAll(FontView *fv) { |
| 484 |
int i; |
| 485 |
|
| 486 |
for ( i=0; i<fv->b.map->enccount; ++i ) { |
| 487 |
if ( !fv->b.selected[i] ) { |
| 488 |
fv->b.selected[i] = true; |
| 489 |
FVToggleCharSelected(fv,i); |
| 490 |
} |
| 491 |
} |
| 492 |
fv->sel_index = 1; |
| 493 |
} |
| 494 |
|
| 495 |
static void FVReselect(FontView *fv, int newpos) { |
| 496 |
int i; |
| 497 |
|
| 498 |
if ( newpos<0 ) newpos = 0; |
| 499 |
else if ( newpos>=fv->b.map->enccount ) newpos = fv->b.map->enccount-1; |
| 500 |
|
| 501 |
if ( fv->pressed_pos<fv->end_pos ) { |
| 502 |
if ( newpos>fv->end_pos ) { |
| 503 |
for ( i=fv->end_pos+1; i<=newpos; ++i ) if ( !fv->b.selected[i] ) { |
| 504 |
fv->b.selected[i] = fv->sel_index; |
| 505 |
FVToggleCharSelected(fv,i); |
| 506 |
} |
| 507 |
} else if ( newpos<fv->pressed_pos ) { |
| 508 |
for ( i=fv->end_pos; i>fv->pressed_pos; --i ) if ( fv->b.selected[i] ) { |
| 509 |
fv->b.selected[i] = false; |
| 510 |
FVToggleCharSelected(fv,i); |
| 511 |
} |
| 512 |
for ( i=fv->pressed_pos-1; i>=newpos; --i ) if ( !fv->b.selected[i] ) { |
| 513 |
fv->b.selected[i] = fv->sel_index; |
| 514 |
FVToggleCharSelected(fv,i); |
| 515 |
} |
| 516 |
} else { |
| 517 |
for ( i=fv->end_pos; i>newpos; --i ) if ( fv->b.selected[i] ) { |
| 518 |
fv->b.selected[i] = false; |
| 519 |
FVToggleCharSelected(fv,i); |
| 520 |
} |
| 521 |
} |
| 522 |
} else { |
| 523 |
if ( newpos<fv->end_pos ) { |
| 524 |
for ( i=fv->end_pos-1; i>=newpos; --i ) if ( !fv->b.selected[i] ) { |
| 525 |
fv->b.selected[i] = fv->sel_index; |
| 526 |
FVToggleCharSelected(fv,i); |
| 527 |
} |
| 528 |
} else if ( newpos>fv->pressed_pos ) { |
| 529 |
for ( i=fv->end_pos; i<fv->pressed_pos; ++i ) if ( fv->b.selected[i] ) { |
| 530 |
fv->b.selected[i] = false; |
| 531 |
FVToggleCharSelected(fv,i); |
| 532 |
} |
| 533 |
for ( i=fv->pressed_pos+1; i<=newpos; ++i ) if ( !fv->b.selected[i] ) { |
| 534 |
fv->b.selected[i] = fv->sel_index; |
| 535 |
FVToggleCharSelected(fv,i); |
| 536 |
} |
| 537 |
} else { |
| 538 |
for ( i=fv->end_pos; i<newpos; ++i ) if ( fv->b.selected[i] ) { |
| 539 |
fv->b.selected[i] = false; |
| 540 |
FVToggleCharSelected(fv,i); |
| 541 |
} |
| 542 |
} |
| 543 |
} |
| 544 |
fv->end_pos = newpos; |
| 545 |
} |
| 546 |
|
| 547 |
static void FVFlattenAllBitmapSelections(FontView *fv) { |
| 548 |
BDFFont *bdf; |
| 549 |
int i; |
| 550 |
|
| 551 |
for ( bdf = fv->b.sf->bitmaps; bdf!=NULL; bdf=bdf->next ) { |
| 552 |
for ( i=0; i<bdf->glyphcnt; ++i ) |
| 553 |
if ( bdf->glyphs[i]!=NULL && bdf->glyphs[i]->selection!=NULL ) |
| 554 |
BCFlattenFloat(bdf->glyphs[i]); |
| 555 |
} |
| 556 |
} |
| 557 |
|
| 558 |
static int AskChanged(SplineFont *sf) { |
| 559 |
int ret; |
| 560 |
char *buts[4]; |
| 561 |
char *filename, *fontname; |
| 562 |
|
| 563 |
if ( sf->cidmaster!=NULL ) |
| 564 |
sf = sf->cidmaster; |
| 565 |
|
| 566 |
filename = sf->filename; |
| 567 |
fontname = sf->fontname; |
| 568 |
|
| 569 |
if ( filename==NULL && sf->origname!=NULL && |
| 570 |
sf->onlybitmaps && sf->bitmaps!=NULL && sf->bitmaps->next==NULL ) |
| 571 |
filename = sf->origname; |
| 572 |
if ( filename==NULL ) filename = "untitled.sfd"; |
| 573 |
filename = GFileNameTail(filename); |
| 574 |
buts[0] = _("_Save"); |
| 575 |
buts[1] = _("_Don't Save"); |
| 576 |
buts[2] = _("_Cancel"); |
| 577 |
buts[3] = NULL; |
| 578 |
ret = gwwv_ask( _("Font changed"),(const char **) buts,0,2,_("Font %1$.40s in file %2$.40s has been changed.\nDo you want to save it?"),fontname,filename); |
| 579 |
return( ret ); |
| 580 |
} |
| 581 |
|
| 582 |
static int AskScriptChanged() { |
| 583 |
int ret; |
| 584 |
char *buts[4]; |
| 585 |
|
| 586 |
buts[0] = _("_Yes"); |
| 587 |
buts[1] = _("Yes, and don't _remind me again"); |
| 588 |
buts[2] = _("_No"); |
| 589 |
buts[3] = NULL; |
| 590 |
ret = gwwv_ask( _("Unsaved script"),(const char **) buts,0,2,_("You have an unsaved script in the «Execute Script» dialog. Do you intend to discard it?")); |
| 591 |
if (ret == 1) { |
| 592 |
warn_script_unsaved = 0; |
| 593 |
SavePrefs(true); |
| 594 |
} |
| 595 |
return( ret ); |
| 596 |
} |
| 597 |
|
| 598 |
int _FVMenuGenerate(FontView *fv,int family) { |
| 599 |
FVFlattenAllBitmapSelections(fv); |
| 600 |
return( SFGenerateFont(fv->b.sf,fv->b.active_layer,family,fv->b.normal==NULL?fv->b.map:fv->b.normal) ); |
| 601 |
} |
| 602 |
|
| 603 |
static void FVMenuGenerate(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 604 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 605 |
|
| 606 |
_FVMenuGenerate(fv,gf_none); |
| 607 |
} |
| 608 |
|
| 609 |
static void FVMenuGenerateFamily(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 610 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 611 |
|
| 612 |
_FVMenuGenerate(fv,gf_macfamily); |
| 613 |
} |
| 614 |
|
| 615 |
static void FVMenuGenerateTTC(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 616 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 617 |
|
| 618 |
_FVMenuGenerate(fv,gf_ttc); |
| 619 |
} |
| 620 |
|
| 621 |
extern int save_to_dir; |
| 622 |
|
| 623 |
static int SaveAs_FormatChange(GGadget *g, GEvent *e) { |
| 624 |
if ( e->type==et_controlevent && e->u.control.subtype == et_radiochanged ) { |
| 625 |
GGadget *fc = GWidgetGetControl(GGadgetGetWindow(g),1000); |
| 626 |
char *oldname = GGadgetGetTitle8(fc); |
| 627 |
int *_s2d = GGadgetGetUserData(g); |
| 628 |
int s2d = GGadgetIsChecked(g); |
| 629 |
char *pt, *newname = malloc(strlen(oldname)+8); |
| 630 |
strcpy(newname,oldname); |
| 631 |
pt = strrchr(newname,'.'); |
| 632 |
if ( pt==NULL ) |
| 633 |
pt = newname+strlen(newname); |
| 634 |
strcpy(pt,s2d ? ".sfdir" : ".sfd" ); |
| 635 |
GGadgetSetTitle8(fc,newname); |
| 636 |
save_to_dir = *_s2d = s2d; |
| 637 |
SavePrefs(true); |
| 638 |
} |
| 639 |
return( true ); |
| 640 |
} |
| 641 |
|
| 642 |
|
| 643 |
static enum fchooserret _FVSaveAsFilterFunc(GGadget *g,const struct gdirentry *ent, const char *dir) |
| 644 |
{ |
| 645 |
int ew = endswithi( ent->name, "sfd" ) || endswithi( ent->name, "sfdir" ); |
| 646 |
if( ew ) |
| 647 |
return fc_show; |
| 648 |
if( ent->isdir ) |
| 649 |
return fc_show; |
| 650 |
return fc_hide; |
| 651 |
} |
| 652 |
|
| 653 |
|
| 654 |
int _FVMenuSaveAs(FontView *fv) { |
| 655 |
char *temp; |
| 656 |
char *ret; |
| 657 |
char *filename; |
| 658 |
int ok; |
| 659 |
int s2d = fv->b.cidmaster!=NULL ? fv->b.cidmaster->save_to_dir : |
| 660 |
fv->b.sf->mm!=NULL ? fv->b.sf->mm->normal->save_to_dir : |
| 661 |
fv->b.sf->save_to_dir; |
| 662 |
GGadgetCreateData gcd; |
| 663 |
GTextInfo label; |
| 664 |
|
| 665 |
if ( fv->b.cidmaster!=NULL && fv->b.cidmaster->filename!=NULL ) |
| 666 |
temp=def2utf8_copy(fv->b.cidmaster->filename); |
| 667 |
else if ( fv->b.sf->mm!=NULL && fv->b.sf->mm->normal->filename!=NULL ) |
| 668 |
temp=def2utf8_copy(fv->b.sf->mm->normal->filename); |
| 669 |
else if ( fv->b.sf->filename!=NULL ) |
| 670 |
temp=def2utf8_copy(fv->b.sf->filename); |
| 671 |
else { |
| 672 |
SplineFont *sf = fv->b.cidmaster?fv->b.cidmaster: |
| 673 |
fv->b.sf->mm!=NULL?fv->b.sf->mm->normal:fv->b.sf; |
| 674 |
char *fn = sf->defbasefilename ? sf->defbasefilename : sf->fontname; |
| 675 |
temp = malloc((strlen(fn)+10)); |
| 676 |
strcpy(temp,fn); |
| 677 |
if ( sf->defbasefilename!=NULL ) |
| 678 |
; |
| 679 |
else if ( fv->b.cidmaster!=NULL ) |
| 680 |
strcat(temp,"CID"); |
| 681 |
else if ( sf->mm==NULL ) |
| 682 |
; |
| 683 |
else if ( sf->mm->apple ) |
| 684 |
strcat(temp,"Var"); |
| 685 |
else |
| 686 |
strcat(temp,"MM"); |
| 687 |
strcat(temp,save_to_dir ? ".sfdir" : ".sfd"); |
| 688 |
s2d = save_to_dir; |
| 689 |
} |
| 690 |
|
| 691 |
memset(&gcd,0,sizeof(gcd)); |
| 692 |
memset(&label,0,sizeof(label)); |
| 693 |
gcd.gd.flags = s2d ? (gg_visible | gg_enabled | gg_cb_on) : (gg_visible | gg_enabled); |
| 694 |
label.text = (unichar_t *) _("Save as _Directory"); |
| 695 |
label.text_is_1byte = true; |
| 696 |
label.text_in_resource = true; |
| 697 |
gcd.gd.label = &label; |
| 698 |
gcd.gd.handle_controlevent = SaveAs_FormatChange; |
| 699 |
gcd.data = &s2d; |
| 700 |
gcd.creator = GCheckBoxCreate; |
| 701 |
|
| 702 |
GFileChooserInputFilenameFuncType FilenameFunc = GFileChooserDefInputFilenameFunc; |
| 703 |
|
| 704 |
#if defined(__MINGW32__) |
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
if( !GFileIsAbsolute(temp) ) |
| 710 |
{ |
| 711 |
char* defaultSaveDir = GFileGetHomeDocumentsDir(); |
| 712 |
|
| 713 |
char* temp2 = GFileAppendFile( defaultSaveDir, temp, 0 ); |
| 714 |
free(temp); |
| 715 |
temp = temp2; |
| 716 |
} |
| 717 |
#endif |
| 718 |
|
| 719 |
ret = GWidgetSaveAsFileWithGadget8(_("Save as..."),temp,0,NULL, |
| 720 |
_FVSaveAsFilterFunc, FilenameFunc, |
| 721 |
&gcd ); |
| 722 |
free(temp); |
| 723 |
if ( ret==NULL ) |
| 724 |
return( 0 ); |
| 725 |
filename = utf82def_copy(ret); |
| 726 |
free(ret); |
| 727 |
|
| 728 |
if(!(endswithi( filename, ".sfdir") || endswithi( filename, ".sfd"))) |
| 729 |
{ |
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
char* newpath = copyn( filename, strlen(filename) + strlen(".sfd") + 1 ); |
| 735 |
strcat( newpath, ".sfd" ); |
| 736 |
|
| 737 |
char* oldfn = GFileNameTail( filename ); |
| 738 |
char* newfn = GFileNameTail( newpath ); |
| 739 |
|
| 740 |
LogError( _("You tried to save with the filename %s but it was saved as %s. "), |
| 741 |
oldfn, newfn ); |
| 742 |
LogError( _("Please choose File/Generate Fonts to save to other formats.")); |
| 743 |
|
| 744 |
free(filename); |
| 745 |
filename = newpath; |
| 746 |
} |
| 747 |
|
| 748 |
FVFlattenAllBitmapSelections(fv); |
| 749 |
fv->b.sf->compression = 0; |
| 750 |
ok = SFDWrite(filename,fv->b.sf,fv->b.map,fv->b.normal,s2d); |
| 751 |
if ( ok ) { |
| 752 |
SplineFont *sf = fv->b.cidmaster?fv->b.cidmaster:fv->b.sf->mm!=NULL?fv->b.sf->mm->normal:fv->b.sf; |
| 753 |
free(sf->filename); |
| 754 |
sf->filename = filename; |
| 755 |
sf->save_to_dir = s2d; |
| 756 |
free(sf->origname); |
| 757 |
sf->origname = copy(filename); |
| 758 |
sf->isnew = false; |
| 759 |
if ( sf->mm!=NULL ) { |
| 760 |
int i; |
| 761 |
for ( i=0; i<sf->mm->instance_count; ++i ) { |
| 762 |
free(sf->mm->instances[i]->filename); |
| 763 |
sf->mm->instances[i]->filename = filename; |
| 764 |
free(sf->mm->instances[i]->origname); |
| 765 |
sf->mm->instances[i]->origname = copy(filename); |
| 766 |
sf->mm->instances[i]->isnew = false; |
| 767 |
} |
| 768 |
} |
| 769 |
SplineFontSetUnChanged(sf); |
| 770 |
FVSetTitles(fv->b.sf); |
| 771 |
} else { |
| 772 |
ff_post_error(_("Save Failed"),_("Save Failed")); |
| 773 |
free(filename); |
| 774 |
} |
| 775 |
return( ok ); |
| 776 |
} |
| 777 |
|
| 778 |
static void FVMenuSaveAs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 779 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 780 |
|
| 781 |
_FVMenuSaveAs(fv); |
| 782 |
} |
| 783 |
|
| 784 |
static int IsBackupName(char *filename) { |
| 785 |
|
| 786 |
if ( filename==NULL ) |
| 787 |
return( false ); |
| 788 |
return( filename[strlen(filename)-1]=='~' ); |
| 789 |
} |
| 790 |
|
| 791 |
int _FVMenuSave(FontView *fv) { |
| 792 |
int ret = 0; |
| 793 |
SplineFont *sf = fv->b.cidmaster?fv->b.cidmaster: |
| 794 |
fv->b.sf->mm!=NULL?fv->b.sf->mm->normal: |
| 795 |
fv->b.sf; |
| 796 |
|
| 797 |
if ( sf->filename==NULL || IsBackupName(sf->filename)) |
| 798 |
ret = _FVMenuSaveAs(fv); |
| 799 |
else { |
| 800 |
FVFlattenAllBitmapSelections(fv); |
| 801 |
if ( !SFDWriteBak(sf->filename,sf,fv->b.map,fv->b.normal) ) |
| 802 |
ff_post_error(_("Save Failed"),_("Save Failed")); |
| 803 |
else { |
| 804 |
SplineFontSetUnChanged(sf); |
| 805 |
ret = true; |
| 806 |
} |
| 807 |
} |
| 808 |
return( ret ); |
| 809 |
} |
| 810 |
|
| 811 |
static void FVMenuSave(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 812 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 813 |
_FVMenuSave(fv); |
| 814 |
} |
| 815 |
|
| 816 |
void _FVCloseWindows(FontView *fv) { |
| 817 |
int i, j; |
| 818 |
BDFFont *bdf; |
| 819 |
MetricsView *mv, *mnext; |
| 820 |
SplineFont *sf = fv->b.cidmaster?fv->b.cidmaster:fv->b.sf->mm!=NULL?fv->b.sf->mm->normal : fv->b.sf; |
| 821 |
|
| 822 |
PrintWindowClose(); |
| 823 |
if ( fv->b.nextsame==NULL && fv->b.sf->fv==&fv->b && fv->b.sf->kcld!=NULL ) |
| 824 |
KCLD_End(fv->b.sf->kcld); |
| 825 |
if ( fv->b.nextsame==NULL && fv->b.sf->fv==&fv->b && fv->b.sf->vkcld!=NULL ) |
| 826 |
KCLD_End(fv->b.sf->vkcld); |
| 827 |
|
| 828 |
for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) { |
| 829 |
CharView *cv, *next; |
| 830 |
for ( cv = (CharView *) (sf->glyphs[i]->views); cv!=NULL; cv = next ) { |
| 831 |
next = (CharView *) (cv->b.next); |
| 832 |
GDrawDestroyWindow(cv->gw); |
| 833 |
} |
| 834 |
if ( sf->glyphs[i]->charinfo ) |
| 835 |
CharInfoDestroy(sf->glyphs[i]->charinfo); |
| 836 |
} |
| 837 |
if ( sf->mm!=NULL ) { |
| 838 |
MMSet *mm = sf->mm; |
| 839 |
for ( j=0; j<mm->instance_count; ++j ) { |
| 840 |
SplineFont *sf = mm->instances[j]; |
| 841 |
for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) { |
| 842 |
CharView *cv, *next; |
| 843 |
for ( cv = (CharView *) (sf->glyphs[i]->views); cv!=NULL; cv = next ) { |
| 844 |
next = (CharView *) (cv->b.next); |
| 845 |
GDrawDestroyWindow(cv->gw); |
| 846 |
} |
| 847 |
if ( sf->glyphs[i]->charinfo ) |
| 848 |
CharInfoDestroy(sf->glyphs[i]->charinfo); |
| 849 |
} |
| 850 |
for ( mv=sf->metrics; mv!=NULL; mv = mnext ) { |
| 851 |
mnext = mv->next; |
| 852 |
GDrawDestroyWindow(mv->gw); |
| 853 |
} |
| 854 |
} |
| 855 |
} else if ( sf->subfontcnt!=0 ) { |
| 856 |
for ( j=0; j<sf->subfontcnt; ++j ) { |
| 857 |
for ( i=0; i<sf->subfonts[j]->glyphcnt; ++i ) if ( sf->subfonts[j]->glyphs[i]!=NULL ) { |
| 858 |
CharView *cv, *next; |
| 859 |
for ( cv = (CharView *) (sf->subfonts[j]->glyphs[i]->views); cv!=NULL; cv = next ) { |
| 860 |
next = (CharView *) (cv->b.next); |
| 861 |
GDrawDestroyWindow(cv->gw); |
| 862 |
if ( sf->subfonts[j]->glyphs[i]->charinfo ) |
| 863 |
CharInfoDestroy(sf->subfonts[j]->glyphs[i]->charinfo); |
| 864 |
} |
| 865 |
} |
| 866 |
for ( mv=sf->subfonts[j]->metrics; mv!=NULL; mv = mnext ) { |
| 867 |
mnext = mv->next; |
| 868 |
GDrawDestroyWindow(mv->gw); |
| 869 |
} |
| 870 |
} |
| 871 |
} else { |
| 872 |
for ( mv=sf->metrics; mv!=NULL; mv = mnext ) { |
| 873 |
mnext = mv->next; |
| 874 |
GDrawDestroyWindow(mv->gw); |
| 875 |
} |
| 876 |
} |
| 877 |
for ( bdf = sf->bitmaps; bdf!=NULL; bdf=bdf->next ) { |
| 878 |
for ( i=0; i<bdf->glyphcnt; ++i ) if ( bdf->glyphs[i]!=NULL ) { |
| 879 |
BitmapView *bv, *next; |
| 880 |
for ( bv = bdf->glyphs[i]->views; bv!=NULL; bv = next ) { |
| 881 |
next = bv->next; |
| 882 |
GDrawDestroyWindow(bv->gw); |
| 883 |
} |
| 884 |
} |
| 885 |
} |
| 886 |
if ( fv->b.sf->fontinfo!=NULL ) |
| 887 |
FontInfoDestroy(fv->b.sf); |
| 888 |
if ( fv->b.sf->valwin!=NULL ) |
| 889 |
ValidationDestroy(fv->b.sf); |
| 890 |
SVDetachFV(fv); |
| 891 |
} |
| 892 |
|
| 893 |
static int SFAnyChanged(SplineFont *sf) { |
| 894 |
if ( sf->mm!=NULL ) { |
| 895 |
MMSet *mm = sf->mm; |
| 896 |
int i; |
| 897 |
if ( mm->changed ) |
| 898 |
return( true ); |
| 899 |
for ( i=0; i<mm->instance_count; ++i ) |
| 900 |
if ( sf->mm->instances[i]->changed ) |
| 901 |
return( true ); |
| 902 |
|
| 903 |
if ( mm->apple && mm->normal->changed ) |
| 904 |
return( true ); |
| 905 |
|
| 906 |
return( false ); |
| 907 |
} else |
| 908 |
return( sf->changed ); |
| 909 |
} |
| 910 |
|
| 911 |
static int _FVMenuClose(FontView *fv) { |
| 912 |
int i; |
| 913 |
SplineFont *sf = fv->b.cidmaster?fv->b.cidmaster:fv->b.sf; |
| 914 |
|
| 915 |
if ( !SFCloseAllInstrs(fv->b.sf) ) |
| 916 |
return( false ); |
| 917 |
|
| 918 |
if ( fv->b.nextsame!=NULL || fv->b.sf->fv!=&fv->b ) { |
| 919 |
|
| 920 |
} else if ( warn_script_unsaved && fv->script_unsaved && |
| 921 |
AskScriptChanged()==2 ) { |
| 922 |
return false; |
| 923 |
} else if ( SFAnyChanged(sf) ) { |
| 924 |
i = AskChanged(fv->b.sf); |
| 925 |
if ( i==2 ) |
| 926 |
return( false ); |
| 927 |
if ( i==0 && !_FVMenuSave(fv)) |
| 928 |
return(false); |
| 929 |
else |
| 930 |
SFClearAutoSave(sf); |
| 931 |
} |
| 932 |
_FVCloseWindows(fv); |
| 933 |
if ( sf->filename!=NULL ) |
| 934 |
RecentFilesRemember(sf->filename); |
| 935 |
else if ( sf->origname!=NULL ) |
| 936 |
RecentFilesRemember(sf->origname); |
| 937 |
GDrawDestroyWindow(fv->gw); |
| 938 |
return( true ); |
| 939 |
} |
| 940 |
|
| 941 |
void MenuNew(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 942 |
FontNew(); |
| 943 |
} |
| 944 |
|
| 945 |
static void FVMenuClose(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 946 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 947 |
|
| 948 |
if ( fv->b.container ) |
| 949 |
(fv->b.container->funcs->doClose)(fv->b.container); |
| 950 |
else |
| 951 |
_FVMenuClose(fv); |
| 952 |
} |
| 953 |
|
| 954 |
static void FV_ReattachCVs(SplineFont *old,SplineFont *new) { |
| 955 |
int i, j, pos; |
| 956 |
CharView *cv, *cvnext; |
| 957 |
SplineFont *sub; |
| 958 |
|
| 959 |
for ( i=0; i<old->glyphcnt; ++i ) { |
| 960 |
if ( old->glyphs[i]!=NULL && old->glyphs[i]->views!=NULL ) { |
| 961 |
if ( new->subfontcnt==0 ) { |
| 962 |
pos = SFFindExistingSlot(new,old->glyphs[i]->unicodeenc,old->glyphs[i]->name); |
| 963 |
sub = new; |
| 964 |
} else { |
| 965 |
pos = -1; |
| 966 |
for ( j=0; j<new->subfontcnt && pos==-1 ; ++j ) { |
| 967 |
sub = new->subfonts[j]; |
| 968 |
pos = SFFindExistingSlot(sub,old->glyphs[i]->unicodeenc,old->glyphs[i]->name); |
| 969 |
} |
| 970 |
} |
| 971 |
if ( pos==-1 ) { |
| 972 |
for ( cv=(CharView *) (old->glyphs[i]->views); cv!=NULL; cv = cvnext ) { |
| 973 |
cvnext = (CharView *) (cv->b.next); |
| 974 |
GDrawDestroyWindow(cv->gw); |
| 975 |
} |
| 976 |
} else { |
| 977 |
for ( cv=(CharView *) (old->glyphs[i]->views); cv!=NULL; cv = cvnext ) { |
| 978 |
cvnext = (CharView *) (cv->b.next); |
| 979 |
CVChangeSC(cv,sub->glyphs[pos]); |
| 980 |
cv->b.layerheads[dm_grid] = &new->grid; |
| 981 |
} |
| 982 |
} |
| 983 |
GDrawProcessPendingEvents(NULL); |
| 984 |
} |
| 985 |
} |
| 986 |
} |
| 987 |
|
| 988 |
static void FVMenuRevert(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 989 |
FontViewBase *fv = (FontViewBase *) GDrawGetUserData(gw); |
| 990 |
FVRevert(fv); |
| 991 |
} |
| 992 |
|
| 993 |
static void FVMenuRevertBackup(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 994 |
FontViewBase *fv = (FontViewBase *) GDrawGetUserData(gw); |
| 995 |
FVRevertBackup(fv); |
| 996 |
} |
| 997 |
|
| 998 |
static void FVMenuRevertGlyph(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 999 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1000 |
FVRevertGlyph((FontViewBase *) fv); |
| 1001 |
} |
| 1002 |
|
| 1003 |
static void FVMenuClearSpecialData(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1004 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1005 |
FVClearSpecialData((FontViewBase *) fv); |
| 1006 |
} |
| 1007 |
|
| 1008 |
void MenuPrefs(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1009 |
DoPrefs(); |
| 1010 |
} |
| 1011 |
|
| 1012 |
void MenuXRes(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1013 |
DoXRes(); |
| 1014 |
} |
| 1015 |
|
| 1016 |
void MenuSaveAll(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1017 |
FontView *fv; |
| 1018 |
|
| 1019 |
for ( fv = fv_list; fv!=NULL; fv = (FontView *) (fv->b.next) ) { |
| 1020 |
if ( SFAnyChanged(fv->b.sf) && !_FVMenuSave(fv)) |
| 1021 |
return; |
| 1022 |
} |
| 1023 |
} |
| 1024 |
|
| 1025 |
static void _MenuExit(void *UNUSED(junk)) { |
| 1026 |
|
| 1027 |
FontView *fv, *next; |
| 1028 |
|
| 1029 |
#ifndef _NO_PYTHON |
| 1030 |
python_call_onClosingFunctions(); |
| 1031 |
#endif |
| 1032 |
|
| 1033 |
LastFonts_Save(); |
| 1034 |
for ( fv = fv_list; fv!=NULL; fv = next ) |
| 1035 |
{ |
| 1036 |
next = (FontView *) (fv->b.next); |
| 1037 |
if ( !_FVMenuClose(fv)) |
| 1038 |
return; |
| 1039 |
if ( fv->b.nextsame!=NULL || fv->b.sf->fv!=&fv->b ) |
| 1040 |
{ |
| 1041 |
GDrawSync(NULL); |
| 1042 |
GDrawProcessPendingEvents(NULL); |
| 1043 |
} |
| 1044 |
} |
| 1045 |
GDrawSync(NULL); |
| 1046 |
GDrawProcessPendingEvents(NULL); |
| 1047 |
exit(0); |
| 1048 |
} |
| 1049 |
|
| 1050 |
static void FVMenuExit(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1051 |
_MenuExit(NULL); |
| 1052 |
} |
| 1053 |
|
| 1054 |
void MenuExit(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 1055 |
if ( e==NULL ) |
| 1056 |
_MenuExit(NULL); |
| 1057 |
else |
| 1058 |
DelayEvent(_MenuExit,NULL); |
| 1059 |
} |
| 1060 |
|
| 1061 |
|
| 1062 |
struct gfc_data { |
| 1063 |
int done; |
| 1064 |
int ret; |
| 1065 |
GGadget *gfc; |
| 1066 |
GGadget *ignore_invalid_replacement; |
| 1067 |
SplineFont *sf; |
| 1068 |
EncMap *map; |
| 1069 |
}; |
| 1070 |
|
| 1071 |
static int feat_e_h(GWindow gw, GEvent *event) { |
| 1072 |
if ( event->type==et_close ) { |
| 1073 |
struct gfc_data *d = GDrawGetUserData(gw); |
| 1074 |
d->done = true; |
| 1075 |
d->ret = false; |
| 1076 |
} else if ( event->type==et_char ) { |
| 1077 |
return( false ); |
| 1078 |
} else if ( event->type==et_map ) { |
| 1079 |
GDrawRaise(gw); |
| 1080 |
} else if ( event->type==et_mousemove || |
| 1081 |
(event->type==et_mousedown && event->u.mouse.button==3 )) { |
| 1082 |
struct gfc_data *d = GDrawGetUserData(gw); |
| 1083 |
GFileChooserPopupCheck(d->gfc,event); |
| 1084 |
} else if (( event->type==et_mouseup || event->type==et_mousedown ) && |
| 1085 |
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) { |
| 1086 |
struct gfc_data *d = GDrawGetUserData(gw); |
| 1087 |
return( GGadgetDispatchEvent((GGadget *) (d->gfc),event)); |
| 1088 |
} |
| 1089 |
return( true ); |
| 1090 |
} |
| 1091 |
|
| 1092 |
static int FEAT_ImportOk(GGadget *g, GEvent *e) { |
| 1093 |
if ( e->type==et_controlevent && e->u.control.subtype==et_buttonactivate ) { |
| 1094 |
struct gfc_data *d = GDrawGetUserData(GGadgetGetWindow(g)); |
| 1095 |
unichar_t *ret = GGadgetGetTitle(d->gfc); |
| 1096 |
char *temp = u2def_copy(ret); |
| 1097 |
int ignore_invalid_replacement = GGadgetIsChecked(d->ignore_invalid_replacement); |
| 1098 |
GGadget *tf; |
| 1099 |
|
| 1100 |
GFileChooserGetChildren(d->gfc,NULL,NULL,&tf); |
| 1101 |
if ( *_GGadgetGetTitle(tf)=='\0' ) |
| 1102 |
return( true ); |
| 1103 |
GDrawSetCursor(GGadgetGetWindow(g),ct_watch); |
| 1104 |
|
| 1105 |
if ( !LoadKerningDataFromMetricsFile(d->sf,temp,d->map,ignore_invalid_replacement)) |
| 1106 |
ff_post_error(_("Load of Kerning Metrics Failed"),_("Failed to load kern data from %s"), temp); |
| 1107 |
d->done = true; |
| 1108 |
|
| 1109 |
GDrawSetCursor(GGadgetGetWindow(g),ct_pointer); |
| 1110 |
free(ret); free(temp); |
| 1111 |
} |
| 1112 |
return( true ); |
| 1113 |
|
| 1114 |
} |
| 1115 |
|
| 1116 |
static int FEAT_Cancel(GGadget *g, GEvent *e) { |
| 1117 |
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { |
| 1118 |
struct gfc_data *d = GDrawGetUserData(GGadgetGetWindow(g)); |
| 1119 |
d->done = true; |
| 1120 |
d->ret = false; |
| 1121 |
} |
| 1122 |
return( true ); |
| 1123 |
} |
| 1124 |
|
| 1125 |
|
| 1126 |
void MergeKernInfo(SplineFont *sf,EncMap *map) { |
| 1127 |
#ifndef __Mac |
| 1128 |
static char wild[] = "*.{afm,tfm,ofm,pfm,bin,hqx,dfont,feature,feat,fea}"; |
| 1129 |
static char wild2[] = "*.{afm,amfm,tfm,ofm,pfm,bin,hqx,dfont,feature,feat,fea}"; |
| 1130 |
#else |
| 1131 |
static char wild[] = "*"; |
| 1132 |
static char wild2[] = "*"; |
| 1133 |
#endif |
| 1134 |
|
| 1135 |
GRect pos; |
| 1136 |
GWindow gw; |
| 1137 |
GWindowAttrs wattrs; |
| 1138 |
GGadgetCreateData gcd[7], boxes[4], *varray[9], *harray[3], *buttons[10]; |
| 1139 |
GTextInfo label[9]; |
| 1140 |
struct gfc_data d; |
| 1141 |
int bs = GIntGetResource(_NUM_Buttonsize), bsbigger, totwid, scalewid; |
| 1142 |
|
| 1143 |
memset(&wattrs,0,sizeof(wattrs)); |
| 1144 |
wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict|wam_isdlg; |
| 1145 |
wattrs.event_masks = ~(1<<et_charup); |
| 1146 |
wattrs.restrict_input_to_me = 1; |
| 1147 |
wattrs.is_dlg = 1; |
| 1148 |
wattrs.undercursor = 1; |
| 1149 |
wattrs.cursor = ct_pointer; |
| 1150 |
wattrs.utf8_window_title = _("Import feature file"); |
| 1151 |
pos.x = pos.y = 0; |
| 1152 |
totwid = 300; |
| 1153 |
scalewid = GGadgetScale(totwid); |
| 1154 |
bsbigger = 3*bs+4*14>scalewid; scalewid = bsbigger?3*bs+4*12:scalewid; |
| 1155 |
pos.width = GDrawPointsToPixels(NULL,scalewid); |
| 1156 |
pos.height = GDrawPointsToPixels(NULL,255); |
| 1157 |
gw = GDrawCreateTopWindow(NULL,&pos,feat_e_h,&d,&wattrs); |
| 1158 |
|
| 1159 |
memset(&label,0,sizeof(label)); |
| 1160 |
memset(&gcd,0,sizeof(gcd)); |
| 1161 |
memset(&boxes,0,sizeof(boxes)); |
| 1162 |
gcd[0].gd.pos.x = 12; gcd[0].gd.pos.y = 6; gcd[0].gd.pos.width = totwid-24; gcd[0].gd.pos.height = 182; |
| 1163 |
gcd[0].gd.flags = gg_visible | gg_enabled; |
| 1164 |
gcd[0].creator = GFileChooserCreate; |
| 1165 |
varray[0] = &gcd[0]; varray[1] = NULL; |
| 1166 |
|
| 1167 |
gcd[1].gd.pos.x = 12; gcd[1].gd.pos.y = 224-3; gcd[1].gd.pos.width = -1; gcd[1].gd.pos.height = 0; |
| 1168 |
gcd[1].gd.flags = gg_visible | gg_enabled | gg_but_default; |
| 1169 |
label[1].text = (unichar_t *) _("_OK"); |
| 1170 |
label[1].text_is_1byte = true; |
| 1171 |
label[1].text_in_resource = true; |
| 1172 |
gcd[1].gd.label = &label[1]; |
| 1173 |
gcd[1].gd.handle_controlevent = FEAT_ImportOk; |
| 1174 |
gcd[1].creator = GButtonCreate; |
| 1175 |
buttons[0] = GCD_Glue; buttons[1] = &gcd[1]; buttons[2] = GCD_Glue; |
| 1176 |
|
| 1177 |
gcd[2].gd.pos.x = (totwid-bs)*100/GIntGetResource(_NUM_ScaleFactor)/2; gcd[2].gd.pos.y = 224; gcd[2].gd.pos.width = -1; gcd[2].gd.pos.height = 0; |
| 1178 |
gcd[2].gd.flags = gg_visible | gg_enabled; |
| 1179 |
label[2].text = (unichar_t *) _("_Filter"); |
| 1180 |
label[2].text_is_1byte = true; |
| 1181 |
label[2].text_in_resource = true; |
| 1182 |
gcd[2].gd.mnemonic = 'F'; |
| 1183 |
gcd[2].gd.label = &label[2]; |
| 1184 |
gcd[2].gd.handle_controlevent = GFileChooserFilterEh; |
| 1185 |
gcd[2].creator = GButtonCreate; |
| 1186 |
buttons[3] = GCD_Glue; buttons[4] = &gcd[2]; buttons[5] = GCD_Glue; |
| 1187 |
|
| 1188 |
gcd[3].gd.pos.x = -gcd[1].gd.pos.x; gcd[3].gd.pos.y = 224; gcd[3].gd.pos.width = -1; gcd[3].gd.pos.height = 0; |
| 1189 |
gcd[3].gd.flags = gg_visible | gg_enabled | gg_but_cancel; |
| 1190 |
label[3].text = (unichar_t *) _("_Cancel"); |
| 1191 |
label[3].text_is_1byte = true; |
| 1192 |
label[3].text_in_resource = true; |
| 1193 |
gcd[3].gd.label = &label[3]; |
| 1194 |
gcd[3].gd.handle_controlevent = FEAT_Cancel; |
| 1195 |
gcd[3].creator = GButtonCreate; |
| 1196 |
buttons[6] = GCD_Glue; buttons[7] = &gcd[3]; buttons[8] = GCD_Glue; |
| 1197 |
buttons[9] = NULL; |
| 1198 |
|
| 1199 |
gcd[4].gd.pos.x = 12; gcd[4].gd.pos.y = gcd[3].gd.pos.y+6; |
| 1200 |
gcd[4].gd.flags = gg_visible | gg_enabled ; |
| 1201 |
gcd[4].gd.flags = gg_visible | gg_enabled; |
| 1202 |
label[4].text = (unichar_t *) _("Ignore invalid substitutions"); |
| 1203 |
label[4].text_is_1byte = true; |
| 1204 |
gcd[4].gd.label = &label[4]; |
| 1205 |
gcd[4].creator = GCheckBoxCreate; |
| 1206 |
harray[0] = &gcd[4]; harray[1] = GCD_Glue; harray[2] = NULL; |
| 1207 |
|
| 1208 |
|
| 1209 |
boxes[2].gd.flags = gg_enabled|gg_visible; |
| 1210 |
boxes[2].gd.u.boxelements = harray; |
| 1211 |
boxes[2].creator = GHBoxCreate; |
| 1212 |
varray[2] = &boxes[2]; varray[3] = NULL; |
| 1213 |
|
| 1214 |
boxes[3].gd.flags = gg_enabled|gg_visible; |
| 1215 |
boxes[3].gd.u.boxelements = buttons; |
| 1216 |
boxes[3].creator = GHBoxCreate; |
| 1217 |
varray[4] = GCD_Glue; varray[5] = NULL; |
| 1218 |
varray[6] = &boxes[3]; varray[7] = NULL; |
| 1219 |
varray[8] = NULL; |
| 1220 |
|
| 1221 |
boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; |
| 1222 |
boxes[0].gd.flags = gg_enabled|gg_visible; |
| 1223 |
boxes[0].gd.u.boxelements = varray; |
| 1224 |
boxes[0].creator = GHVGroupCreate; |
| 1225 |
|
| 1226 |
GGadgetsCreate(gw,boxes); |
| 1227 |
GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); |
| 1228 |
GHVBoxSetExpandableCol(boxes[3].ret,gb_expandgluesame); |
| 1229 |
GHVBoxSetExpandableCol(boxes[2].ret,gb_expandglue); |
| 1230 |
GGadgetSetUserData(gcd[2].ret,gcd[0].ret); |
| 1231 |
|
| 1232 |
GFileChooserConnectButtons(gcd[0].ret,gcd[1].ret,gcd[2].ret); |
| 1233 |
GFileChooserSetFilterText8(gcd[0].ret, sf->mm!=NULL?wild2:wild); |
| 1234 |
GFileChooserRefreshList(gcd[0].ret); |
| 1235 |
GHVBoxFitWindow(boxes[0].ret); |
| 1236 |
|
| 1237 |
memset(&d,'\0',sizeof(d)); |
| 1238 |
d.sf = sf; |
| 1239 |
d.map = map; |
| 1240 |
d.gfc = gcd[0].ret; |
| 1241 |
if ( sf!=NULL ) |
| 1242 |
d.ignore_invalid_replacement = gcd[4].ret; |
| 1243 |
|
| 1244 |
GDrawSetVisible(gw,true); |
| 1245 |
while ( !d.done ) |
| 1246 |
GDrawProcessOneEvent(NULL); |
| 1247 |
GDrawDestroyWindow(gw); |
| 1248 |
|
| 1249 |
} |
| 1250 |
|
| 1251 |
static void FVMenuMergeKern(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1252 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1253 |
MergeKernInfo(fv->b.sf,fv->b.map); |
| 1254 |
} |
| 1255 |
|
| 1256 |
void _FVMenuOpen(FontView *fv) { |
| 1257 |
char *temp; |
| 1258 |
FontView *test; int fvcnt, fvtest; |
| 1259 |
|
| 1260 |
char* OpenDir = NULL, *DefaultDir = NULL, *NewDir = NULL; |
| 1261 |
#if defined(__MINGW32__) |
| 1262 |
DefaultDir = copy(GFileGetHomeDocumentsDir()); |
| 1263 |
if (fv && fv->b.sf && fv->b.sf->filename) { |
| 1264 |
free(DefaultDir); |
| 1265 |
DefaultDir = GFileDirNameEx(fv->b.sf->filename, true); |
| 1266 |
} |
| 1267 |
#endif |
| 1268 |
|
| 1269 |
for ( fvcnt=0, test=fv_list; test!=NULL; ++fvcnt, test=(FontView *) (test->b.next) ); |
| 1270 |
do { |
| 1271 |
if (NewDir != NULL) { |
| 1272 |
if (OpenDir != DefaultDir) { |
| 1273 |
free(OpenDir); |
| 1274 |
} |
| 1275 |
|
| 1276 |
OpenDir = NewDir; |
| 1277 |
NewDir = NULL; |
| 1278 |
} else if (OpenDir != DefaultDir) { |
| 1279 |
free(OpenDir); |
| 1280 |
OpenDir = DefaultDir; |
| 1281 |
} |
| 1282 |
|
| 1283 |
temp = GetPostScriptFontName(OpenDir,true,fv != NULL); |
| 1284 |
char** path_list = GFileChooserGetMultipleFiles(temp); |
| 1285 |
if ( temp==NULL ) |
| 1286 |
return; |
| 1287 |
|
| 1288 |
|
| 1289 |
NewDir = GFileDirName(temp); |
| 1290 |
if (!GFileExists(NewDir)) { |
| 1291 |
free(NewDir); |
| 1292 |
NewDir = NULL; |
| 1293 |
} |
| 1294 |
|
| 1295 |
for (char** p_path = path_list; *p_path != NULL; ++p_path) |
| 1296 |
ViewPostScriptFont(*p_path,0); |
| 1297 |
|
| 1298 |
free(temp); |
| 1299 |
for (char** p_path = path_list; *p_path != NULL; ++p_path) |
| 1300 |
free(*p_path); |
| 1301 |
free(path_list); |
| 1302 |
|
| 1303 |
for ( fvtest=0, test=fv_list; test!=NULL; ++fvtest, test=(FontView *) (test->b.next) ); |
| 1304 |
} while ( fvtest==fvcnt ); |
| 1305 |
|
| 1306 |
free( NewDir ); |
| 1307 |
free( OpenDir ); |
| 1308 |
if (OpenDir != DefaultDir) { |
| 1309 |
free( DefaultDir ); |
| 1310 |
} |
| 1311 |
} |
| 1312 |
|
| 1313 |
static void FVMenuOpen(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1314 |
FontView *fv = (FontView*) GDrawGetUserData(gw); |
| 1315 |
_FVMenuOpen(fv); |
| 1316 |
} |
| 1317 |
|
| 1318 |
static void FVMenuContextualHelp(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1319 |
help("ui/mainviews/fontview.html", NULL); |
| 1320 |
} |
| 1321 |
|
| 1322 |
void MenuHelp(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1323 |
help("index.html", NULL); |
| 1324 |
} |
| 1325 |
|
| 1326 |
void MenuIndex(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1327 |
help("index.html", NULL); |
| 1328 |
} |
| 1329 |
|
| 1330 |
void MenuLicense(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1331 |
help("https://github.com/fontforge/fontforge/blob/master/LICENSE", NULL); |
| 1332 |
} |
| 1333 |
|
| 1334 |
void MenuAbout(GWindow UNUSED(base), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1335 |
ShowAboutScreen(); |
| 1336 |
} |
| 1337 |
|
| 1338 |
static void FVMenuImport(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1339 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1340 |
int empty = fv->b.sf->onlybitmaps && fv->b.sf->bitmaps==NULL; |
| 1341 |
BDFFont *bdf; |
| 1342 |
FVImport(fv); |
| 1343 |
if ( empty && fv->b.sf->bitmaps!=NULL ) { |
| 1344 |
for ( bdf= fv->b.sf->bitmaps; bdf->next!=NULL; bdf = bdf->next ); |
| 1345 |
FVChangeDisplayBitmap((FontViewBase *) fv,bdf); |
| 1346 |
} |
| 1347 |
} |
| 1348 |
|
| 1349 |
static int FVSelCount(FontView *fv) { |
| 1350 |
int i, cnt=0; |
| 1351 |
|
| 1352 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 1353 |
if ( fv->b.selected[i] ) ++cnt; |
| 1354 |
if ( cnt>10 ) { |
| 1355 |
char *buts[3]; |
| 1356 |
buts[0] = _("_OK"); |
| 1357 |
buts[1] = _("_Cancel"); |
| 1358 |
buts[2] = NULL; |
| 1359 |
if ( gwwv_ask(_("Many Windows"),(const char **) buts,0,1,_("This involves opening more than 10 windows.\nIs that really what you want?"))==1 ) |
| 1360 |
return( false ); |
| 1361 |
} |
| 1362 |
return( true ); |
| 1363 |
} |
| 1364 |
|
| 1365 |
static void FVMenuOpenOutline(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1366 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1367 |
int i; |
| 1368 |
SplineChar *sc; |
| 1369 |
|
| 1370 |
if ( !FVSelCount(fv)) |
| 1371 |
return; |
| 1372 |
if ( fv->b.container!=NULL && fv->b.container->funcs->is_modal ) |
| 1373 |
return; |
| 1374 |
|
| 1375 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 1376 |
if ( fv->b.selected[i] ) { |
| 1377 |
sc = FVMakeChar(fv,i); |
| 1378 |
CharViewCreate(sc,fv,i); |
| 1379 |
} |
| 1380 |
} |
| 1381 |
|
| 1382 |
static void FVMenuOpenBitmap(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1383 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1384 |
int i; |
| 1385 |
SplineChar *sc; |
| 1386 |
|
| 1387 |
if ( fv->b.cidmaster==NULL ? (fv->b.sf->bitmaps==NULL) : (fv->b.cidmaster->bitmaps==NULL) ) |
| 1388 |
return; |
| 1389 |
if ( fv->b.container!=NULL && fv->b.container->funcs->is_modal ) |
| 1390 |
return; |
| 1391 |
if ( !FVSelCount(fv)) |
| 1392 |
return; |
| 1393 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 1394 |
if ( fv->b.selected[i] ) { |
| 1395 |
sc = FVMakeChar(fv,i); |
| 1396 |
if ( sc!=NULL ) |
| 1397 |
BitmapViewCreatePick(i,fv); |
| 1398 |
} |
| 1399 |
} |
| 1400 |
|
| 1401 |
void _MenuWarnings(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1402 |
ShowErrorWindow(); |
| 1403 |
} |
| 1404 |
|
| 1405 |
static void FVMenuOpenMetrics(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1406 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1407 |
if ( fv->b.container!=NULL && fv->b.container->funcs->is_modal ) |
| 1408 |
return; |
| 1409 |
MetricsViewCreate(fv,NULL,fv->filled==fv->show?NULL:fv->show); |
| 1410 |
} |
| 1411 |
|
| 1412 |
static void FVMenuPrint(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1413 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1414 |
|
| 1415 |
if ( fv->b.container!=NULL && fv->b.container->funcs->is_modal ) |
| 1416 |
return; |
| 1417 |
PrintFFDlg(fv,NULL,NULL); |
| 1418 |
} |
| 1419 |
|
| 1420 |
#if !defined(_NO_FFSCRIPT) || !defined(_NO_PYTHON) |
| 1421 |
static void FVMenuExecute(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1422 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1423 |
|
| 1424 |
ScriptDlg(fv,NULL); |
| 1425 |
} |
| 1426 |
#endif |
| 1427 |
|
| 1428 |
static void FVMenuFontInfo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1429 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1430 |
if ( fv->b.container!=NULL && fv->b.container->funcs->is_modal ) |
| 1431 |
return; |
| 1432 |
FontMenuFontInfo(fv); |
| 1433 |
} |
| 1434 |
|
| 1435 |
static void FVMenuMATHInfo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1436 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1437 |
SFMathDlg(fv->b.sf,fv->b.active_layer); |
| 1438 |
} |
| 1439 |
|
| 1440 |
static void FVMenuFindProblems(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1441 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1442 |
FindProblems(fv,NULL,NULL); |
| 1443 |
} |
| 1444 |
|
| 1445 |
static void FVMenuValidate(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1446 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1447 |
SFValidationWindow(fv->b.sf,fv->b.active_layer,ff_none); |
| 1448 |
} |
| 1449 |
|
| 1450 |
static void FVMenuSetExtremumBound(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1451 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1452 |
char buffer[40], *end, *ret; |
| 1453 |
int val; |
| 1454 |
|
| 1455 |
sprintf( buffer, "%d", fv->b.sf->extrema_bound<=0 ? |
| 1456 |
(int) rint((fv->b.sf->ascent+fv->b.sf->descent)/100.0) : |
| 1457 |
fv->b.sf->extrema_bound ); |
| 1458 |
ret = gwwv_ask_string(_("Extremum bound..."),buffer,_("Adobe says that \"big\" splines should not have extrema.\nBut they don't define what big means.\nIf the distance between the spline's end-points is bigger than this value, then the spline is \"big\" to fontforge.")); |
| 1459 |
if ( ret==NULL ) |
| 1460 |
return; |
| 1461 |
val = (int) rint(strtod(ret,&end)); |
| 1462 |
if ( *end!='\0' ) |
| 1463 |
ff_post_error( _("Bad Number"),_("Bad Number") ); |
| 1464 |
else { |
| 1465 |
fv->b.sf->extrema_bound = val; |
| 1466 |
if ( !fv->b.sf->changed ) { |
| 1467 |
fv->b.sf->changed = true; |
| 1468 |
FVSetTitles(fv->b.sf); |
| 1469 |
} |
| 1470 |
} |
| 1471 |
free(ret); |
| 1472 |
} |
| 1473 |
|
| 1474 |
static void FVMenuEmbolden(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1475 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1476 |
EmboldenDlg(fv,NULL); |
| 1477 |
} |
| 1478 |
|
| 1479 |
static void FVMenuItalic(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1480 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1481 |
ItalicDlg(fv,NULL); |
| 1482 |
} |
| 1483 |
|
| 1484 |
static void FVMenuSmallCaps(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1485 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1486 |
GlyphChangeDlg(fv,NULL,gc_smallcaps); |
| 1487 |
} |
| 1488 |
|
| 1489 |
static void FVMenuChangeXHeight(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1490 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1491 |
ChangeXHeightDlg(fv,NULL); |
| 1492 |
} |
| 1493 |
|
| 1494 |
static void FVMenuChangeGlyph(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1495 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1496 |
GlyphChangeDlg(fv,NULL,gc_generic); |
| 1497 |
} |
| 1498 |
|
| 1499 |
static void FVMenuSubSup(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1500 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1501 |
GlyphChangeDlg(fv,NULL,gc_subsuper); |
| 1502 |
} |
| 1503 |
|
| 1504 |
static void FVMenuOblique(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1505 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1506 |
ObliqueDlg(fv,NULL); |
| 1507 |
} |
| 1508 |
|
| 1509 |
static void FVMenuCondense(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1510 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1511 |
CondenseExtendDlg(fv,NULL); |
| 1512 |
} |
| 1513 |
|
| 1514 |
|
| 1515 |
static int FVAnyCharSelected(FontView *fv) { |
| 1516 |
int i, val=-1; |
| 1517 |
|
| 1518 |
for ( i=0; i<fv->b.map->enccount; ++i ) { |
| 1519 |
if ( fv->b.selected[i]) { |
| 1520 |
if ( val==-1 ) |
| 1521 |
val = i; |
| 1522 |
else |
| 1523 |
return( -2 ); |
| 1524 |
} |
| 1525 |
} |
| 1526 |
return( val ); |
| 1527 |
} |
| 1528 |
|
| 1529 |
static int FVAllSelected(FontView *fv) { |
| 1530 |
int i, any = false; |
| 1531 |
|
| 1532 |
|
| 1533 |
for ( i=0; i<fv->b.sf->glyphcnt; ++i ) if ( SCWorthOutputting(fv->b.sf->glyphs[i])) { |
| 1534 |
if ( !fv->b.selected[fv->b.map->backmap[i]] ) |
| 1535 |
return( false ); |
| 1536 |
any = true; |
| 1537 |
} |
| 1538 |
return( any ); |
| 1539 |
} |
| 1540 |
|
| 1541 |
static void FVMenuCopyFrom(GWindow UNUSED(gw), struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 1542 |
|
| 1543 |
|
| 1544 |
if ( mi->mid==FV_MID_CharName ) |
| 1545 |
copymetadata = !copymetadata; |
| 1546 |
else if ( mi->mid==FV_MID_TTFInstr ) |
| 1547 |
copyttfinstr = !copyttfinstr; |
| 1548 |
else |
| 1549 |
onlycopydisplayed = (mi->mid==FV_MID_DisplayedFont); |
| 1550 |
SavePrefs(true); |
| 1551 |
} |
| 1552 |
|
| 1553 |
static void FVMenuCopy(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1554 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1555 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 1556 |
return; |
| 1557 |
FVCopy((FontViewBase *) fv,ct_fullcopy); |
| 1558 |
} |
| 1559 |
|
| 1560 |
static void FVMenuCopyLookupData(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1561 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1562 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 1563 |
return; |
| 1564 |
FVCopy((FontViewBase *) fv,ct_lookups); |
| 1565 |
} |
| 1566 |
|
| 1567 |
static void FVMenuCopyRef(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1568 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1569 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 1570 |
return; |
| 1571 |
FVCopy((FontViewBase *) fv,ct_reference); |
| 1572 |
} |
| 1573 |
|
| 1574 |
static void FVMenuCopyWidth(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 1575 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1576 |
|
| 1577 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 1578 |
return; |
| 1579 |
if ( mi->mid==FV_MID_CopyVWidth && !fv->b.sf->hasvmetrics ) |
| 1580 |
return; |
| 1581 |
FVCopyWidth((FontViewBase *) fv, |
| 1582 |
mi->mid==FV_MID_CopyWidth?ut_width: |
| 1583 |
mi->mid==FV_MID_CopyVWidth?ut_vwidth: |
| 1584 |
mi->mid==FV_MID_CopyLBearing?ut_lbearing: |
| 1585 |
ut_rbearing); |
| 1586 |
} |
| 1587 |
|
| 1588 |
static void FVMenuPaste(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1589 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1590 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 1591 |
return; |
| 1592 |
PasteIntoFV((FontViewBase *) fv,false,NULL); |
| 1593 |
} |
| 1594 |
|
| 1595 |
static void FVMenuPasteInto(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1596 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1597 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 1598 |
return; |
| 1599 |
PasteIntoFV((FontViewBase *) fv,true,NULL); |
| 1600 |
} |
| 1601 |
|
| 1602 |
static void FVMenuPasteAfter(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1603 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1604 |
int pos = FVAnyCharSelected(fv); |
| 1605 |
if ( pos<0 ) |
| 1606 |
return; |
| 1607 |
PasteIntoFV(&fv->b,2,NULL); |
| 1608 |
} |
| 1609 |
|
| 1610 |
static void FVMenuSameGlyphAs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1611 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1612 |
FVSameGlyphAs((FontViewBase *) fv); |
| 1613 |
GDrawRequestExpose(fv->v,NULL,false); |
| 1614 |
} |
| 1615 |
|
| 1616 |
static void FVMenuCopyFgBg(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1617 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1618 |
FVCopyFgtoBg( (FontViewBase *) fv ); |
| 1619 |
} |
| 1620 |
|
| 1621 |
static void FVMenuCopyL2L(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1622 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1623 |
FVCopyLayerToLayer( fv ); |
| 1624 |
} |
| 1625 |
|
| 1626 |
static void FVMenuCompareL2L(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1627 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1628 |
FVCompareLayerToLayer( fv ); |
| 1629 |
} |
| 1630 |
|
| 1631 |
static void FVMenuClear(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1632 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1633 |
FVClear( (FontViewBase *) fv ); |
| 1634 |
} |
| 1635 |
|
| 1636 |
static void FVMenuClearBackground(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1637 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1638 |
FVClearBackground( (FontViewBase *) fv ); |
| 1639 |
} |
| 1640 |
|
| 1641 |
static void FVMenuJoin(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1642 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1643 |
FVJoin( (FontViewBase *) fv ); |
| 1644 |
} |
| 1645 |
|
| 1646 |
static void FVMenuUnlinkRef(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1647 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1648 |
FVUnlinkRef( (FontViewBase *) fv ); |
| 1649 |
} |
| 1650 |
|
| 1651 |
static void FVMenuRemoveUndoes(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1652 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1653 |
SFRemoveUndoes(fv->b.sf,fv->b.selected,fv->b.map); |
| 1654 |
} |
| 1655 |
|
| 1656 |
static void FVMenuUndo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1657 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1658 |
FVUndo((FontViewBase *) fv); |
| 1659 |
} |
| 1660 |
|
| 1661 |
static void FVMenuRedo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1662 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1663 |
FVRedo((FontViewBase *) fv); |
| 1664 |
} |
| 1665 |
|
| 1666 |
static void FVMenuUndoFontLevel(GWindow gw,struct gmenuitem *mi,GEvent *e) { |
| 1667 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1668 |
FontViewBase * fvb = (FontViewBase *) fv; |
| 1669 |
SplineFont *sf = fvb->sf; |
| 1670 |
|
| 1671 |
if( !sf->undoes ) |
| 1672 |
return; |
| 1673 |
|
| 1674 |
struct sfundoes *undo = sf->undoes; |
| 1675 |
|
| 1676 |
SFUndoPerform( undo, sf ); |
| 1677 |
SFUndoRemoveAndFree( sf, undo ); |
| 1678 |
} |
| 1679 |
|
| 1680 |
static void FVMenuCut(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1681 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1682 |
FVCopy(&fv->b,ct_fullcopy); |
| 1683 |
FVClear(&fv->b); |
| 1684 |
} |
| 1685 |
|
| 1686 |
static void FVMenuSelectAll(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1687 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1688 |
|
| 1689 |
FVSelectAll(fv); |
| 1690 |
} |
| 1691 |
|
| 1692 |
static void FVMenuInvertSelection(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1693 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1694 |
|
| 1695 |
FVInvertSelection(fv); |
| 1696 |
} |
| 1697 |
|
| 1698 |
static void FVMenuDeselectAll(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 1699 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 1700 |
|
| 1701 |
FVDeselectAll(fv); |
| 1702 |
} |
| 1703 |
|
| 1704 |
enum merge_type { mt_set=0, mt_merge=4, mt_or=mt_merge, mt_restrict=8, mt_and=12 }; |
| 1705 |
|
| 1706 |
const uint8_t mergefunc[] = { |
| 1707 |
|
| 1708 |
0, 1, |
| 1709 |
0, 1, |
| 1710 |
|
| 1711 |
0, 1, |
| 1712 |
1, 1, |
| 1713 |
|
| 1714 |
0, 0, |
| 1715 |
1, 0, |
| 1716 |
|
| 1717 |
0, 0, |
| 1718 |
0, 1, |
| 1719 |
}; |
| 1720 |
|
| 1721 |
static enum merge_type SelMergeType(GEvent *e) { |
| 1722 |
if ( e==NULL || e->type!=et_mouseup ) |
| 1723 |
return( mt_set ); |
| 1724 |
|
| 1725 |
return( ((e->u.mouse.state&ksm_shift)?mt_merge:0) | |
| 1726 |
((e->u.mouse.state&ksm_control)?mt_restrict:0) ); |
| 1727 |
} |
| 1728 |
|
| 1729 |
static char *SubMatch(char *pattern, char *eop, char *name,int ignorecase) { |
| 1730 |
char ch, *ppt, *npt, *ept, *eon; |
| 1731 |
|
| 1732 |
while ( pattern<eop && ( ch = *pattern)!='\0' ) { |
| 1733 |
if ( ch=='*' ) { |
| 1734 |
if ( pattern[1]=='\0' ) |
| 1735 |
return( name+strlen(name)); |
| 1736 |
for ( npt=name; ; ++npt ) { |
| 1737 |
if ( (eon = SubMatch(pattern+1,eop,npt,ignorecase))!= NULL ) |
| 1738 |
return( eon ); |
| 1739 |
if ( *npt=='\0' ) |
| 1740 |
return( NULL ); |
| 1741 |
} |
| 1742 |
} else if ( ch=='?' ) { |
| 1743 |
if ( *name=='\0' ) |
| 1744 |
return( NULL ); |
| 1745 |
++name; |
| 1746 |
} else if ( ch=='[' ) { |
| 1747 |
|
| 1748 |
|
| 1749 |
|
| 1750 |
|
| 1751 |
|
| 1752 |
|
| 1753 |
|
| 1754 |
|
| 1755 |
|
| 1756 |
int found = 0, not=0; |
| 1757 |
++pattern; |
| 1758 |
if ( pattern[0]=='^' ) { not = 1; ++pattern; } |
| 1759 |
for ( ppt = pattern; (ppt!=pattern || *ppt!=']') && *ppt!='\0' ; ++ppt ) { |
| 1760 |
ch = *ppt; |
| 1761 |
if ( ppt[1]=='-' && ppt[2]!=']' && ppt[2]!='\0' ) { |
| 1762 |
char ch2 = ppt[2]; |
| 1763 |
if ( (*name>=ch && *name<=ch2) || |
| 1764 |
(ignorecase && islower(ch) && islower(ch2) && |
| 1765 |
*name>=toupper(ch) && *name<=toupper(ch2)) || |
| 1766 |
(ignorecase && isupper(ch) && isupper(ch2) && |
| 1767 |
*name>=tolower(ch) && *name<=tolower(ch2))) { |
| 1768 |
if ( !not ) { |
| 1769 |
found = 1; |
| 1770 |
break; |
| 1771 |
} |
| 1772 |
} else { |
| 1773 |
if ( not ) { |
| 1774 |
found = 1; |
| 1775 |
break; |
| 1776 |
} |
| 1777 |
} |
| 1778 |
ppt += 2; |
| 1779 |
} else if ( ch==*name || (ignorecase && tolower(ch)==tolower(*name)) ) { |
| 1780 |
if ( !not ) { |
| 1781 |
found = 1; |
| 1782 |
break; |
| 1783 |
} |
| 1784 |
} else { |
| 1785 |
if ( not ) { |
| 1786 |
found = 1; |
| 1787 |
break; |
| 1788 |
} |
| 1789 |
} |
| 1790 |
} |
| 1791 |
if ( !found ) |
| 1792 |
return( NULL ); |
| 1793 |
while ( *ppt!=']' && *ppt!='\0' ) ++ppt; |
| 1794 |
pattern = ppt; |
| 1795 |
++name; |
| 1796 |
} else if ( ch=='{' ) { |
| 1797 |
|
| 1798 |
for ( ppt = pattern+1; *ppt!='\0' ; ppt = ept ) { |
| 1799 |
for ( ept=ppt; *ept!='}' && *ept!=',' && *ept!='\0'; ++ept ); |
| 1800 |
npt = SubMatch(ppt,ept,name,ignorecase); |
| 1801 |
if ( npt!=NULL ) { |
| 1802 |
char *ecurly = ept; |
| 1803 |
while ( *ecurly!='}' && ecurly<eop && *ecurly!='\0' ) ++ecurly; |
| 1804 |
if ( (eon=SubMatch(ecurly+1,eop,npt,ignorecase))!=NULL ) |
| 1805 |
return( eon ); |
| 1806 |
} |
| 1807 |
if ( *ept=='}' ) |
| 1808 |
return( NULL ); |
| 1809 |
if ( *ept==',' ) ++ept; |
| 1810 |
} |
| 1811 |
} else if ( ch==*name ) { |
| 1812 |
++name; |
| 1813 |
} else if ( ignorecase && tolower(ch)==tolower(*name)) { |
| 1814 |
++name; |
| 1815 |
} else |
| 1816 |
return( NULL ); |
| 1817 |
++pattern; |
| 1818 |
} |
| 1819 |
return( name ); |
| 1820 |
} |
| 1821 |
|
| 1822 |
|
| 1823 |
static int WildMatch(char *pattern, char *name,int ignorecase) { |
| 1824 |
char *eop = pattern + strlen(pattern); |
| 1825 |
|
| 1826 |
if ( pattern==NULL ) |
| 1827 |
return( true ); |
| 1828 |
|
| 1829 |
name = SubMatch(pattern,eop,name,ignorecase); |
| 1830 |
if ( name==NULL ) |
| 1831 |
return( false ); |
| 1832 |
if ( *name=='\0' ) |
| 1833 |
return( true ); |
| 1834 |
|
| 1835 |
return( false ); |
| 1836 |
} |
| 1837 |
|
| 1838 |
static int SS_ScriptChanged(GGadget *g, GEvent *e) { |
| 1839 |
|
| 1840 |
if ( e->type==et_controlevent && e->u.control.subtype != et_textfocuschanged ) { |
| 1841 |
char *txt = GGadgetGetTitle8(g); |
| 1842 |
char buf[8]; |
| 1843 |
int i; |
| 1844 |
extern GTextInfo scripts[]; |
| 1845 |
|
| 1846 |
for ( i=0; scripts[i].text!=NULL; ++i ) { |
| 1847 |
if ( strcmp((char *) scripts[i].text,txt)==0 ) |
| 1848 |
break; |
| 1849 |
} |
| 1850 |
free(txt); |
| 1851 |
if ( scripts[i].text==NULL ) |
| 1852 |
return( true ); |
| 1853 |
buf[0] = ((intptr_t) scripts[i].userdata)>>24; |
| 1854 |
buf[1] = ((intptr_t) scripts[i].userdata)>>16; |
| 1855 |
buf[2] = ((intptr_t) scripts[i].userdata)>>8 ; |
| 1856 |
buf[3] = ((intptr_t) scripts[i].userdata) ; |
| 1857 |
buf[4] = 0; |
| 1858 |
GGadgetSetTitle8(g,buf); |
| 1859 |
} |
| 1860 |
return( true ); |
| 1861 |
} |
| 1862 |
|
| 1863 |
static int SS_OK(GGadget *g, GEvent *e) { |
| 1864 |
|
| 1865 |
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { |
| 1866 |
int *done = GDrawGetUserData(GGadgetGetWindow(g)); |
| 1867 |
*done = 2; |
| 1868 |
} |
| 1869 |
return( true ); |
| 1870 |
} |
| 1871 |
|
| 1872 |
static int SS_Cancel(GGadget *g, GEvent *e) { |
| 1873 |
|
| 1874 |
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { |
| 1875 |
int *done = GDrawGetUserData(GGadgetGetWindow(g)); |
| 1876 |
*done = true; |
| 1877 |
} |
| 1878 |
return( true ); |
| 1879 |
} |
| 1880 |
|
| 1881 |
static int ss_e_h(GWindow gw, GEvent *event) { |
| 1882 |
int *done = GDrawGetUserData(gw); |
| 1883 |
|
| 1884 |
switch ( event->type ) { |
| 1885 |
case et_char: |
| 1886 |
return( false ); |
| 1887 |
case et_close: |
| 1888 |
*done = true; |
| 1889 |
break; |
| 1890 |
default: break; |
| 1891 |
} |
| 1892 |
return( true ); |
| 1893 |
} |
| 1894 |
|
| 1895 |
static void FVSelectByScript(FontView *fv,int merge) { |
| 1896 |
int j, gid; |
| 1897 |
SplineChar *sc; |
| 1898 |
EncMap *map = fv->b.map; |
| 1899 |
SplineFont *sf = fv->b.sf; |
| 1900 |
extern GTextInfo scripts[]; |
| 1901 |
GRect pos; |
| 1902 |
GWindow gw; |
| 1903 |
GWindowAttrs wattrs; |
| 1904 |
GGadgetCreateData gcd[10], *hvarray[21][2], *barray[8], boxes[3]; |
| 1905 |
GTextInfo label[10]; |
| 1906 |
int i,k; |
| 1907 |
int done = 0, doit; |
| 1908 |
char tagbuf[4]; |
| 1909 |
uint32_t tag; |
| 1910 |
const unichar_t *ret; |
| 1911 |
int lc_k, uc_k, select_k; |
| 1912 |
int only_uc=0, only_lc=0; |
| 1913 |
|
| 1914 |
LookupUIInit(); |
| 1915 |
|
| 1916 |
memset(&wattrs,0,sizeof(wattrs)); |
| 1917 |
memset(&gcd,0,sizeof(gcd)); |
| 1918 |
memset(&label,0,sizeof(label)); |
| 1919 |
memset(&boxes,0,sizeof(boxes)); |
| 1920 |
|
| 1921 |
wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; |
| 1922 |
wattrs.event_masks = ~(1<<et_charup); |
| 1923 |
wattrs.restrict_input_to_me = false; |
| 1924 |
wattrs.is_dlg = 1; |
| 1925 |
wattrs.undercursor = 1; |
| 1926 |
wattrs.cursor = ct_pointer; |
| 1927 |
wattrs.utf8_window_title = _("Select by Script"); |
| 1928 |
wattrs.is_dlg = true; |
| 1929 |
pos.x = pos.y = 0; |
| 1930 |
pos.width = 100; |
| 1931 |
pos.height = 100; |
| 1932 |
gw = GDrawCreateTopWindow(NULL,&pos,ss_e_h,&done,&wattrs); |
| 1933 |
|
| 1934 |
k = i = 0; |
| 1935 |
|
| 1936 |
gcd[k].gd.flags = gg_visible|gg_enabled ; |
| 1937 |
gcd[k].gd.u.list = scripts; |
| 1938 |
gcd[k].gd.handle_controlevent = SS_ScriptChanged; |
| 1939 |
gcd[k++].creator = GListFieldCreate; |
| 1940 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 1941 |
|
| 1942 |
label[k].text = (unichar_t *) _("All glyphs"); |
| 1943 |
label[k].text_is_1byte = true; |
| 1944 |
gcd[k].gd.label = &label[k]; |
| 1945 |
gcd[k].gd.flags = gg_enabled|gg_visible|gg_cb_on; |
| 1946 |
gcd[k].gd.popup_msg = _("Set the selection of the font view to all glyphs in the script."); |
| 1947 |
gcd[k++].creator = GRadioCreate; |
| 1948 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 1949 |
hvarray[i][0] = GCD_HPad10; hvarray[i++][1] = NULL; |
| 1950 |
|
| 1951 |
uc_k = k; |
| 1952 |
label[k].text = (unichar_t *) _("Only upper case"); |
| 1953 |
label[k].text_is_1byte = true; |
| 1954 |
gcd[k].gd.label = &label[k]; |
| 1955 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 1956 |
gcd[k].gd.popup_msg = _("Set the selection of the font view to any upper case glyphs in the script."); |
| 1957 |
gcd[k++].creator = GRadioCreate; |
| 1958 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 1959 |
|
| 1960 |
lc_k = k; |
| 1961 |
label[k].text = (unichar_t *) _("Only lower case"); |
| 1962 |
label[k].text_is_1byte = true; |
| 1963 |
gcd[k].gd.label = &label[k]; |
| 1964 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 1965 |
gcd[k].gd.popup_msg = _("Set the selection of the font view to any lower case glyphs in the script."); |
| 1966 |
gcd[k++].creator = GRadioCreate; |
| 1967 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 1968 |
hvarray[i][0] = GCD_HPad10; hvarray[i++][1] = NULL; |
| 1969 |
|
| 1970 |
select_k = k; |
| 1971 |
label[k].text = (unichar_t *) _("Select Results"); |
| 1972 |
label[k].text_is_1byte = true; |
| 1973 |
gcd[k].gd.label = &label[k]; |
| 1974 |
gcd[k].gd.flags = gg_enabled|gg_visible|gg_rad_startnew; |
| 1975 |
gcd[k].gd.popup_msg = _("Set the selection of the font view to the glyphs\nwhich match"); |
| 1976 |
gcd[k++].creator = GRadioCreate; |
| 1977 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 1978 |
|
| 1979 |
label[k].text = (unichar_t *) _("Merge Results"); |
| 1980 |
label[k].text_is_1byte = true; |
| 1981 |
gcd[k].gd.label = &label[k]; |
| 1982 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 1983 |
gcd[k].gd.popup_msg = _("Expand the selection of the font view to include\nall the glyphs which match"); |
| 1984 |
gcd[k++].creator = GRadioCreate; |
| 1985 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 1986 |
|
| 1987 |
label[k].text = (unichar_t *) _("Restrict Selection"); |
| 1988 |
label[k].text_is_1byte = true; |
| 1989 |
gcd[k].gd.label = &label[k]; |
| 1990 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 1991 |
gcd[k].gd.popup_msg = _("Remove matching glyphs from the selection." ); |
| 1992 |
gcd[k++].creator = GRadioCreate; |
| 1993 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 1994 |
|
| 1995 |
label[k].text = (unichar_t *) _("Logical And with Selection"); |
| 1996 |
label[k].text_is_1byte = true; |
| 1997 |
gcd[k].gd.label = &label[k]; |
| 1998 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 1999 |
gcd[k].gd.popup_msg = _("Remove glyphs which do not match from the selection." ); |
| 2000 |
gcd[k++].creator = GRadioCreate; |
| 2001 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 2002 |
gcd[k-4 + merge/4].gd.flags |= gg_cb_on; |
| 2003 |
|
| 2004 |
hvarray[i][0] = GCD_Glue; hvarray[i++][1] = NULL; |
| 2005 |
|
| 2006 |
label[k].text = (unichar_t *) _("_OK"); |
| 2007 |
label[k].text_is_1byte = true; |
| 2008 |
label[k].text_in_resource = true; |
| 2009 |
gcd[k].gd.label = &label[k]; |
| 2010 |
gcd[k].gd.flags = gg_visible|gg_enabled | gg_but_default; |
| 2011 |
gcd[k].gd.handle_controlevent = SS_OK; |
| 2012 |
gcd[k++].creator = GButtonCreate; |
| 2013 |
|
| 2014 |
label[k].text = (unichar_t *) _("_Cancel"); |
| 2015 |
label[k].text_is_1byte = true; |
| 2016 |
label[k].text_in_resource = true; |
| 2017 |
gcd[k].gd.label = &label[k]; |
| 2018 |
gcd[k].gd.flags = gg_visible|gg_enabled | gg_but_cancel; |
| 2019 |
gcd[k].gd.handle_controlevent = SS_Cancel; |
| 2020 |
gcd[k++].creator = GButtonCreate; |
| 2021 |
|
| 2022 |
barray[0] = barray[2] = barray[3] = barray[4] = barray[6] = GCD_Glue; barray[7] = NULL; |
| 2023 |
barray[1] = &gcd[k-2]; barray[5] = &gcd[k-1]; |
| 2024 |
hvarray[i][0] = &boxes[2]; hvarray[i++][1] = NULL; |
| 2025 |
hvarray[i][0] = NULL; |
| 2026 |
|
| 2027 |
memset(boxes,0,sizeof(boxes)); |
| 2028 |
boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; |
| 2029 |
boxes[0].gd.flags = gg_enabled|gg_visible; |
| 2030 |
boxes[0].gd.u.boxelements = hvarray[0]; |
| 2031 |
boxes[0].creator = GHVGroupCreate; |
| 2032 |
|
| 2033 |
boxes[2].gd.flags = gg_enabled|gg_visible; |
| 2034 |
boxes[2].gd.u.boxelements = barray; |
| 2035 |
boxes[2].creator = GHBoxCreate; |
| 2036 |
|
| 2037 |
GGadgetsCreate(gw,boxes); |
| 2038 |
GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); |
| 2039 |
GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); |
| 2040 |
|
| 2041 |
|
| 2042 |
GHVBoxFitWindow(boxes[0].ret); |
| 2043 |
|
| 2044 |
GDrawSetVisible(gw,true); |
| 2045 |
ret = NULL; |
| 2046 |
while ( !done ) { |
| 2047 |
GDrawProcessOneEvent(NULL); |
| 2048 |
if ( done==2 ) { |
| 2049 |
ret = _GGadgetGetTitle(gcd[0].ret); |
| 2050 |
if ( *ret=='\0' ) { |
| 2051 |
ff_post_error(_("No Script"),_("Please specify a script")); |
| 2052 |
done = 0; |
| 2053 |
} else if ( u_strlen(ret)>4 ) { |
| 2054 |
ff_post_error(_("Bad Script"),_("Scripts are 4 letter tags")); |
| 2055 |
done = 0; |
| 2056 |
} |
| 2057 |
} |
| 2058 |
} |
| 2059 |
memset(tagbuf,' ',4); |
| 2060 |
if ( done==2 && ret!=NULL ) { |
| 2061 |
tagbuf[0] = *ret; |
| 2062 |
if ( ret[1]!='\0' ) { |
| 2063 |
tagbuf[1] = ret[1]; |
| 2064 |
if ( ret[2]!='\0' ) { |
| 2065 |
tagbuf[2] = ret[2]; |
| 2066 |
if ( ret[3]!='\0' ) |
| 2067 |
tagbuf[3] = ret[3]; |
| 2068 |
} |
| 2069 |
} |
| 2070 |
} |
| 2071 |
merge = GGadgetIsChecked(gcd[select_k+0].ret) ? mt_set : |
| 2072 |
GGadgetIsChecked(gcd[select_k+1].ret) ? mt_merge : |
| 2073 |
GGadgetIsChecked(gcd[select_k+2].ret) ? mt_restrict : |
| 2074 |
mt_and; |
| 2075 |
only_uc = GGadgetIsChecked(gcd[uc_k+0].ret); |
| 2076 |
only_lc = GGadgetIsChecked(gcd[lc_k+0].ret); |
| 2077 |
|
| 2078 |
GDrawDestroyWindow(gw); |
| 2079 |
if ( done==1 ) |
| 2080 |
return; |
| 2081 |
tag = (tagbuf[0]<<24) | (tagbuf[1]<<16) | (tagbuf[2]<<8) | tagbuf[3]; |
| 2082 |
|
| 2083 |
for ( j=0; j<map->enccount; ++j ) if ( (gid=map->map[j])!=-1 && (sc=sf->glyphs[gid])!=NULL ) { |
| 2084 |
doit = ( SCScriptFromUnicode(sc)==tag ); |
| 2085 |
if ( doit ) { |
| 2086 |
if ( only_uc && (sc->unicodeenc==-1 || sc->unicodeenc>0xffff || |
| 2087 |
!isupper(sc->unicodeenc)) ) |
| 2088 |
doit = false; |
| 2089 |
else if ( only_lc && (sc->unicodeenc==-1 || sc->unicodeenc>0xffff || |
| 2090 |
!islower(sc->unicodeenc)) ) |
| 2091 |
doit = false; |
| 2092 |
} |
| 2093 |
fv->b.selected[j] = mergefunc[ merge + (fv->b.selected[j]?2:0) + doit ]; |
| 2094 |
} else if ( merge==mt_set ) |
| 2095 |
fv->b.selected[j] = false; |
| 2096 |
|
| 2097 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2098 |
} |
| 2099 |
|
| 2100 |
static void FVMenuSelectByScript(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2101 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2102 |
|
| 2103 |
FVSelectByScript(fv,SelMergeType(e)); |
| 2104 |
} |
| 2105 |
|
| 2106 |
static void FVSelectColor(FontView *fv, uint32_t col, int merge) { |
| 2107 |
int i, doit; |
| 2108 |
uint32_t sccol; |
| 2109 |
SplineChar **glyphs = fv->b.sf->glyphs; |
| 2110 |
|
| 2111 |
for ( i=0; i<fv->b.map->enccount; ++i ) { |
| 2112 |
int gid = fv->b.map->map[i]; |
| 2113 |
sccol = ( gid==-1 || glyphs[gid]==NULL ) ? COLOR_DEFAULT : glyphs[gid]->color; |
| 2114 |
doit = sccol==col; |
| 2115 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2116 |
} |
| 2117 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2118 |
} |
| 2119 |
|
| 2120 |
static void FVMenuSelectColor(GWindow gw, struct gmenuitem *mi, GEvent *e) { |
| 2121 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2122 |
Color col = (Color) (intptr_t) (mi->ti.userdata); |
| 2123 |
if ( (intptr_t) mi->ti.userdata == (intptr_t) -10 ) { |
| 2124 |
struct hslrgb retcol, font_cols[6]; |
| 2125 |
retcol = GWidgetColor(_("Pick a color"),NULL,SFFontCols(fv->b.sf,font_cols)); |
| 2126 |
if ( !retcol.rgb ) |
| 2127 |
return; |
| 2128 |
col = (((int) rint(255.*retcol.r))<<16 ) | |
| 2129 |
(((int) rint(255.*retcol.g))<<8 ) | |
| 2130 |
(((int) rint(255.*retcol.b)) ); |
| 2131 |
} |
| 2132 |
FVSelectColor(fv,col,SelMergeType(e)); |
| 2133 |
} |
| 2134 |
|
| 2135 |
static int FVSelectByName(FontView *fv, char *ret, int merge) { |
| 2136 |
int j, gid, doit; |
| 2137 |
char *end; |
| 2138 |
SplineChar *sc; |
| 2139 |
EncMap *map = fv->b.map; |
| 2140 |
SplineFont *sf = fv->b.sf; |
| 2141 |
struct altuni *alt; |
| 2142 |
|
| 2143 |
if ( !merge ) |
| 2144 |
FVDeselectAll(fv); |
| 2145 |
if (( *ret=='0' && ( ret[1]=='x' || ret[1]=='X' )) || |
| 2146 |
((*ret=='u' || *ret=='U') && ret[1]=='+' )) { |
| 2147 |
int uni = (int) strtol(ret+2,&end,16); |
| 2148 |
int vs= -2; |
| 2149 |
if ( *end=='.' ) { |
| 2150 |
++end; |
| 2151 |
if (( *end=='0' && ( end[1]=='x' || end[1]=='X' )) || |
| 2152 |
((*end=='u' || *end=='U') && end[1]=='+' )) |
| 2153 |
end += 2; |
| 2154 |
vs = (int) strtoul(end,&end,16); |
| 2155 |
} |
| 2156 |
if ( *end!='\0' || uni<0 || uni>=0x110000 ) { |
| 2157 |
ff_post_error( _("Bad Number"),_("Bad Number") ); |
| 2158 |
return( false ); |
| 2159 |
} |
| 2160 |
for ( j=0; j<map->enccount; ++j ) if ( (gid=map->map[j])!=-1 && (sc=sf->glyphs[gid])!=NULL ) { |
| 2161 |
if ( vs==-2 ) { |
| 2162 |
for ( alt=sc->altuni; alt!=NULL && (alt->unienc!=uni || alt->fid!=0); alt=alt->next ); |
| 2163 |
} else { |
| 2164 |
for ( alt=sc->altuni; alt!=NULL && (alt->unienc!=uni || alt->vs!=vs || alt->fid!=0); alt=alt->next ); |
| 2165 |
} |
| 2166 |
doit = (sc->unicodeenc == uni && vs<0) || alt!=NULL; |
| 2167 |
fv->b.selected[j] = mergefunc[ merge + (fv->b.selected[j]?2:0) + doit ]; |
| 2168 |
} else if ( merge==mt_set ) |
| 2169 |
fv->b.selected[j] = false; |
| 2170 |
} else { |
| 2171 |
for ( j=0; j<map->enccount; ++j ) if ( (gid=map->map[j])!=-1 && (sc=sf->glyphs[gid])!=NULL ) { |
| 2172 |
doit = WildMatch(ret,sc->name,false); |
| 2173 |
fv->b.selected[j] = mergefunc[ merge + (fv->b.selected[j]?2:0) + doit ]; |
| 2174 |
} else if ( merge==mt_set ) |
| 2175 |
fv->b.selected[j] = false; |
| 2176 |
} |
| 2177 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2178 |
fv->sel_index = 1; |
| 2179 |
return( true ); |
| 2180 |
} |
| 2181 |
|
| 2182 |
static void FVMenuSelectByName(GWindow _gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2183 |
FontView *fv = (FontView *) GDrawGetUserData(_gw); |
| 2184 |
GRect pos; |
| 2185 |
GWindow gw; |
| 2186 |
GWindowAttrs wattrs; |
| 2187 |
GGadgetCreateData gcd[8], *hvarray[12][2], *barray[8], boxes[3]; |
| 2188 |
GTextInfo label[8]; |
| 2189 |
int merge = SelMergeType(e); |
| 2190 |
int done=0,k,i; |
| 2191 |
|
| 2192 |
memset(&wattrs,0,sizeof(wattrs)); |
| 2193 |
memset(&gcd,0,sizeof(gcd)); |
| 2194 |
memset(&label,0,sizeof(label)); |
| 2195 |
memset(&boxes,0,sizeof(boxes)); |
| 2196 |
|
| 2197 |
wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; |
| 2198 |
wattrs.event_masks = ~(1<<et_charup); |
| 2199 |
wattrs.restrict_input_to_me = false; |
| 2200 |
wattrs.undercursor = 1; |
| 2201 |
wattrs.cursor = ct_pointer; |
| 2202 |
wattrs.utf8_window_title = _("Select by Name"); |
| 2203 |
wattrs.is_dlg = false; |
| 2204 |
pos.x = pos.y = 0; |
| 2205 |
pos.width = 100; |
| 2206 |
pos.height = 100; |
| 2207 |
gw = GDrawCreateTopWindow(NULL,&pos,ss_e_h,&done,&wattrs); |
| 2208 |
|
| 2209 |
k = i = 0; |
| 2210 |
|
| 2211 |
label[k].text = (unichar_t *) _("Enter either a wildcard pattern (to match glyph names)\n or a unicode encoding like \"U+0065\"."); |
| 2212 |
label[k].text_is_1byte = true; |
| 2213 |
gcd[k].gd.label = &label[k]; |
| 2214 |
gcd[k].gd.flags = gg_visible | gg_enabled; |
| 2215 |
gcd[k].gd.popup_msg = _( |
| 2216 |
"Unix style wildcarding is accepted:\n" |
| 2217 |
"Most characters match themselves\n" |
| 2218 |
"A \"?\" will match any single character\n" |
| 2219 |
"A \"*\" will match an arbitrary number of characters (including none)\n" |
| 2220 |
"An \"[abd]\" set of characters within square brackets will match any (single) character\n" |
| 2221 |
"A \"{scmp,c2sc}\" set of strings within curly brackets will match any string\n" |
| 2222 |
"So \"a.*\" would match \"a.\" or \"a.sc\" or \"a.swash\"\n" |
| 2223 |
"While \"a.{scmp,c2sc}\" would match \"a.scmp\" or \"a.c2sc\"\n" |
| 2224 |
"And \"a.[abd]\" would match \"a.a\" or \"a.b\" or \"a.d\""); |
| 2225 |
gcd[k++].creator = GLabelCreate; |
| 2226 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 2227 |
|
| 2228 |
gcd[k].gd.flags = gg_visible | gg_enabled; |
| 2229 |
gcd[k].gd.popup_msg = gcd[k-1].gd.popup_msg; |
| 2230 |
gcd[k++].creator = GTextFieldCreate; |
| 2231 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 2232 |
|
| 2233 |
label[k].text = (unichar_t *) _("Select Results"); |
| 2234 |
label[k].text_is_1byte = true; |
| 2235 |
gcd[k].gd.label = &label[k]; |
| 2236 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 2237 |
gcd[k].gd.popup_msg = _("Set the selection of the font view to the glyphs\nwhich match"); |
| 2238 |
gcd[k++].creator = GRadioCreate; |
| 2239 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 2240 |
|
| 2241 |
label[k].text = (unichar_t *) _("Merge Results"); |
| 2242 |
label[k].text_is_1byte = true; |
| 2243 |
gcd[k].gd.label = &label[k]; |
| 2244 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 2245 |
gcd[k].gd.popup_msg = _("Expand the selection of the font view to include\nall the glyphs which match"); |
| 2246 |
gcd[k++].creator = GRadioCreate; |
| 2247 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 2248 |
|
| 2249 |
label[k].text = (unichar_t *) _("Restrict Selection"); |
| 2250 |
label[k].text_is_1byte = true; |
| 2251 |
gcd[k].gd.label = &label[k]; |
| 2252 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 2253 |
gcd[k].gd.popup_msg = _("Remove matching glyphs from the selection." ); |
| 2254 |
gcd[k++].creator = GRadioCreate; |
| 2255 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 2256 |
|
| 2257 |
label[k].text = (unichar_t *) _("Logical And with Selection"); |
| 2258 |
label[k].text_is_1byte = true; |
| 2259 |
gcd[k].gd.label = &label[k]; |
| 2260 |
gcd[k].gd.flags = gg_enabled|gg_visible; |
| 2261 |
gcd[k].gd.popup_msg = _("Remove glyphs which do not match from the selection." ); |
| 2262 |
gcd[k++].creator = GRadioCreate; |
| 2263 |
hvarray[i][0] = &gcd[k-1]; hvarray[i++][1] = NULL; |
| 2264 |
gcd[k-4 + merge/4].gd.flags |= gg_cb_on; |
| 2265 |
|
| 2266 |
hvarray[i][0] = GCD_Glue; hvarray[i++][1] = NULL; |
| 2267 |
|
| 2268 |
label[k].text = (unichar_t *) _("_OK"); |
| 2269 |
label[k].text_is_1byte = true; |
| 2270 |
label[k].text_in_resource = true; |
| 2271 |
gcd[k].gd.label = &label[k]; |
| 2272 |
gcd[k].gd.flags = gg_visible|gg_enabled | gg_but_default; |
| 2273 |
gcd[k].gd.handle_controlevent = SS_OK; |
| 2274 |
gcd[k++].creator = GButtonCreate; |
| 2275 |
|
| 2276 |
label[k].text = (unichar_t *) _("_Cancel"); |
| 2277 |
label[k].text_is_1byte = true; |
| 2278 |
label[k].text_in_resource = true; |
| 2279 |
gcd[k].gd.label = &label[k]; |
| 2280 |
gcd[k].gd.flags = gg_visible|gg_enabled | gg_but_cancel; |
| 2281 |
gcd[k].gd.handle_controlevent = SS_Cancel; |
| 2282 |
gcd[k++].creator = GButtonCreate; |
| 2283 |
|
| 2284 |
barray[0] = barray[2] = barray[3] = barray[4] = barray[6] = GCD_Glue; barray[7] = NULL; |
| 2285 |
barray[1] = &gcd[k-2]; barray[5] = &gcd[k-1]; |
| 2286 |
hvarray[i][0] = &boxes[2]; hvarray[i++][1] = NULL; |
| 2287 |
hvarray[i][0] = NULL; |
| 2288 |
|
| 2289 |
memset(boxes,0,sizeof(boxes)); |
| 2290 |
boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; |
| 2291 |
boxes[0].gd.flags = gg_enabled|gg_visible; |
| 2292 |
boxes[0].gd.u.boxelements = hvarray[0]; |
| 2293 |
boxes[0].creator = GHVGroupCreate; |
| 2294 |
|
| 2295 |
boxes[2].gd.flags = gg_enabled|gg_visible; |
| 2296 |
boxes[2].gd.u.boxelements = barray; |
| 2297 |
boxes[2].creator = GHBoxCreate; |
| 2298 |
|
| 2299 |
GGadgetsCreate(gw,boxes); |
| 2300 |
GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); |
| 2301 |
GHVBoxSetExpandableRow(boxes[0].ret,gb_expandglue); |
| 2302 |
|
| 2303 |
|
| 2304 |
GHVBoxFitWindow(boxes[0].ret); |
| 2305 |
|
| 2306 |
GDrawSetVisible(gw,true); |
| 2307 |
while ( !done ) { |
| 2308 |
GDrawProcessOneEvent(NULL); |
| 2309 |
if ( done==2 ) { |
| 2310 |
char *str = GGadgetGetTitle8(gcd[1].ret); |
| 2311 |
int merge = GGadgetIsChecked(gcd[2].ret) ? mt_set : |
| 2312 |
GGadgetIsChecked(gcd[3].ret) ? mt_merge : |
| 2313 |
GGadgetIsChecked(gcd[4].ret) ? mt_restrict : |
| 2314 |
mt_and; |
| 2315 |
int ret = FVSelectByName(fv,str,merge); |
| 2316 |
free(str); |
| 2317 |
if ( !ret ) |
| 2318 |
done = 0; |
| 2319 |
} |
| 2320 |
} |
| 2321 |
GDrawDestroyWindow(gw); |
| 2322 |
} |
| 2323 |
|
| 2324 |
static void FVMenuSelectWorthOutputting(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2325 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2326 |
int i, gid, doit; |
| 2327 |
EncMap *map = fv->b.map; |
| 2328 |
SplineFont *sf = fv->b.sf; |
| 2329 |
int merge = SelMergeType(e); |
| 2330 |
|
| 2331 |
for ( i=0; i< map->enccount; ++i ) { |
| 2332 |
doit = ( (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && |
| 2333 |
SCWorthOutputting(sf->glyphs[gid]) ); |
| 2334 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2335 |
} |
| 2336 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2337 |
} |
| 2338 |
|
| 2339 |
static void FVMenuGlyphsRefs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2340 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2341 |
int i, gid, doit; |
| 2342 |
EncMap *map = fv->b.map; |
| 2343 |
SplineFont *sf = fv->b.sf; |
| 2344 |
int merge = SelMergeType(e); |
| 2345 |
int layer = fv->b.active_layer; |
| 2346 |
|
| 2347 |
for ( i=0; i< map->enccount; ++i ) { |
| 2348 |
doit = ( (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && |
| 2349 |
sf->glyphs[gid]->layers[layer].refs!=NULL && |
| 2350 |
sf->glyphs[gid]->layers[layer].splines==NULL ); |
| 2351 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2352 |
} |
| 2353 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2354 |
} |
| 2355 |
|
| 2356 |
static void FVMenuGlyphsSplines(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2357 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2358 |
int i, gid, doit; |
| 2359 |
EncMap *map = fv->b.map; |
| 2360 |
SplineFont *sf = fv->b.sf; |
| 2361 |
int merge = SelMergeType(e); |
| 2362 |
int layer = fv->b.active_layer; |
| 2363 |
|
| 2364 |
for ( i=0; i< map->enccount; ++i ) { |
| 2365 |
doit = ( (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && |
| 2366 |
sf->glyphs[gid]->layers[layer].refs==NULL && |
| 2367 |
sf->glyphs[gid]->layers[layer].splines!=NULL ); |
| 2368 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2369 |
} |
| 2370 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2371 |
} |
| 2372 |
|
| 2373 |
static void FVMenuGlyphsBoth(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2374 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2375 |
int i, gid, doit; |
| 2376 |
EncMap *map = fv->b.map; |
| 2377 |
SplineFont *sf = fv->b.sf; |
| 2378 |
int merge = SelMergeType(e); |
| 2379 |
int layer = fv->b.active_layer; |
| 2380 |
|
| 2381 |
for ( i=0; i< map->enccount; ++i ) { |
| 2382 |
doit = ( (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && |
| 2383 |
sf->glyphs[gid]->layers[layer].refs!=NULL && |
| 2384 |
sf->glyphs[gid]->layers[layer].splines!=NULL ); |
| 2385 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2386 |
} |
| 2387 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2388 |
} |
| 2389 |
|
| 2390 |
static void FVMenuGlyphsWhite(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2391 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2392 |
int i, gid, doit; |
| 2393 |
EncMap *map = fv->b.map; |
| 2394 |
SplineFont *sf = fv->b.sf; |
| 2395 |
int merge = SelMergeType(e); |
| 2396 |
int layer = fv->b.active_layer; |
| 2397 |
|
| 2398 |
for ( i=0; i< map->enccount; ++i ) { |
| 2399 |
doit = ( (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && |
| 2400 |
sf->glyphs[gid]->layers[layer].refs==NULL && |
| 2401 |
sf->glyphs[gid]->layers[layer].splines==NULL ); |
| 2402 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2403 |
} |
| 2404 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2405 |
} |
| 2406 |
|
| 2407 |
static void FVMenuSelectChanged(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2408 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2409 |
int i, gid, doit; |
| 2410 |
EncMap *map = fv->b.map; |
| 2411 |
SplineFont *sf = fv->b.sf; |
| 2412 |
int merge = SelMergeType(e); |
| 2413 |
|
| 2414 |
for ( i=0; i< map->enccount; ++i ) { |
| 2415 |
doit = ( (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && sf->glyphs[gid]->changed ); |
| 2416 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2417 |
} |
| 2418 |
|
| 2419 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2420 |
} |
| 2421 |
|
| 2422 |
static void FVMenuSelectHintingNeeded(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2423 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2424 |
int i, gid, doit; |
| 2425 |
EncMap *map = fv->b.map; |
| 2426 |
SplineFont *sf = fv->b.sf; |
| 2427 |
int order2 = sf->layers[fv->b.active_layer].order2; |
| 2428 |
int merge = SelMergeType(e); |
| 2429 |
|
| 2430 |
for ( i=0; i< map->enccount; ++i ) { |
| 2431 |
doit = ( (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && |
| 2432 |
((!order2 && sf->glyphs[gid]->changedsincelasthinted ) || |
| 2433 |
( order2 && sf->glyphs[gid]->layers[fv->b.active_layer].splines!=NULL && |
| 2434 |
sf->glyphs[gid]->ttf_instrs_len<=0 ) || |
| 2435 |
( order2 && sf->glyphs[gid]->instructions_out_of_date )) ); |
| 2436 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2437 |
} |
| 2438 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2439 |
} |
| 2440 |
|
| 2441 |
static void FVMenuSelectAutohintable(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2442 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2443 |
int i, gid, doit; |
| 2444 |
EncMap *map = fv->b.map; |
| 2445 |
SplineFont *sf = fv->b.sf; |
| 2446 |
int merge = SelMergeType(e); |
| 2447 |
|
| 2448 |
for ( i=0; i< map->enccount; ++i ) { |
| 2449 |
doit = (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL && |
| 2450 |
!sf->glyphs[gid]->manualhints; |
| 2451 |
fv->b.selected[i] = mergefunc[ merge + (fv->b.selected[i]?2:0) + doit ]; |
| 2452 |
} |
| 2453 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2454 |
} |
| 2455 |
|
| 2456 |
static void FVMenuSelectByPST(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2457 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2458 |
|
| 2459 |
FVSelectByPST(fv); |
| 2460 |
} |
| 2461 |
|
| 2462 |
static void FVMenuFindRpl(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2463 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2464 |
|
| 2465 |
SVCreate(fv); |
| 2466 |
} |
| 2467 |
|
| 2468 |
static void FVMenuReplaceWithRef(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2469 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2470 |
|
| 2471 |
FVReplaceOutlineWithReference(fv,.001); |
| 2472 |
} |
| 2473 |
|
| 2474 |
static void FVMenuCorrectRefs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2475 |
FontViewBase *fv = (FontViewBase *) GDrawGetUserData(gw); |
| 2476 |
|
| 2477 |
FVCorrectReferences(fv); |
| 2478 |
} |
| 2479 |
|
| 2480 |
static void FVMenuCharInfo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2481 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2482 |
int pos = FVAnyCharSelected(fv); |
| 2483 |
if ( pos<0 ) |
| 2484 |
return; |
| 2485 |
if ( fv->b.cidmaster!=NULL && |
| 2486 |
(fv->b.map->map[pos]==-1 || fv->b.sf->glyphs[fv->b.map->map[pos]]==NULL )) |
| 2487 |
return; |
| 2488 |
SCCharInfo(SFMakeChar(fv->b.sf,fv->b.map,pos),fv->b.active_layer,fv->b.map,pos); |
| 2489 |
} |
| 2490 |
|
| 2491 |
static void FVMenuBDFInfo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2492 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2493 |
if ( fv->b.sf->bitmaps==NULL ) |
| 2494 |
return; |
| 2495 |
if ( fv->show!=fv->filled ) |
| 2496 |
SFBdfProperties(fv->b.sf,fv->b.map,fv->show); |
| 2497 |
else |
| 2498 |
SFBdfProperties(fv->b.sf,fv->b.map,NULL); |
| 2499 |
} |
| 2500 |
|
| 2501 |
static void FVMenuBaseHoriz(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2502 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2503 |
SplineFont *sf = fv->b.cidmaster == NULL ? fv->b.sf : fv->b.cidmaster; |
| 2504 |
sf->horiz_base = SFBaselines(sf,sf->horiz_base,false); |
| 2505 |
SFBaseSort(sf); |
| 2506 |
} |
| 2507 |
|
| 2508 |
static void FVMenuBaseVert(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2509 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2510 |
SplineFont *sf = fv->b.cidmaster == NULL ? fv->b.sf : fv->b.cidmaster; |
| 2511 |
sf->vert_base = SFBaselines(sf,sf->vert_base,true); |
| 2512 |
SFBaseSort(sf); |
| 2513 |
} |
| 2514 |
|
| 2515 |
static void FVMenuJustify(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2516 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2517 |
SplineFont *sf = fv->b.cidmaster == NULL ? fv->b.sf : fv->b.cidmaster; |
| 2518 |
JustifyDlg(sf); |
| 2519 |
} |
| 2520 |
|
| 2521 |
static void FVMenuMassRename(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2522 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2523 |
FVMassGlyphRename(fv); |
| 2524 |
} |
| 2525 |
|
| 2526 |
static void FVSetColor(FontView *fv, uint32_t col) { |
| 2527 |
int i; |
| 2528 |
|
| 2529 |
for ( i=0; i<fv->b.map->enccount; ++i ) if ( fv->b.selected[i] ) { |
| 2530 |
SplineChar *sc = SFMakeChar(fv->b.sf,fv->b.map,i); |
| 2531 |
sc->color = col; |
| 2532 |
} |
| 2533 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2534 |
} |
| 2535 |
|
| 2536 |
static void FVMenuSetColor(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 2537 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2538 |
Color col = (Color) (intptr_t) (mi->ti.userdata); |
| 2539 |
if ( (intptr_t) mi->ti.userdata == (intptr_t) -10 ) { |
| 2540 |
struct hslrgb retcol, font_cols[6]; |
| 2541 |
retcol = GWidgetColor(_("Pick a color"),NULL,SFFontCols(fv->b.sf,font_cols)); |
| 2542 |
if ( !retcol.rgb ) |
| 2543 |
return; |
| 2544 |
col = (((int) rint(255.*retcol.r))<<16 ) | |
| 2545 |
(((int) rint(255.*retcol.g))<<8 ) | |
| 2546 |
(((int) rint(255.*retcol.b)) ); |
| 2547 |
} |
| 2548 |
FVSetColor(fv,col); |
| 2549 |
} |
| 2550 |
|
| 2551 |
static void FVMenuShowDependentRefs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2552 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2553 |
int pos = FVAnyCharSelected(fv); |
| 2554 |
SplineChar *sc; |
| 2555 |
|
| 2556 |
if ( pos<0 || fv->b.map->map[pos]==-1 ) |
| 2557 |
return; |
| 2558 |
sc = fv->b.sf->glyphs[fv->b.map->map[pos]]; |
| 2559 |
if ( sc==NULL || sc->dependents==NULL ) |
| 2560 |
return; |
| 2561 |
SCRefBy(sc); |
| 2562 |
} |
| 2563 |
|
| 2564 |
static void FVMenuShowDependentSubs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2565 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2566 |
int pos = FVAnyCharSelected(fv); |
| 2567 |
SplineChar *sc; |
| 2568 |
|
| 2569 |
if ( pos<0 || fv->b.map->map[pos]==-1 ) |
| 2570 |
return; |
| 2571 |
sc = fv->b.sf->glyphs[fv->b.map->map[pos]]; |
| 2572 |
if ( sc==NULL ) |
| 2573 |
return; |
| 2574 |
SCSubBy(sc); |
| 2575 |
} |
| 2576 |
|
| 2577 |
static int getorigin(void *UNUSED(d), BasePoint *base, int index) { |
| 2578 |
|
| 2579 |
|
| 2580 |
base->x = base->y = 0; |
| 2581 |
switch ( index ) { |
| 2582 |
case 0: |
| 2583 |
|
| 2584 |
break; |
| 2585 |
case 1: |
| 2586 |
|
| 2587 |
break; |
| 2588 |
default: |
| 2589 |
return( false ); |
| 2590 |
} |
| 2591 |
return( true ); |
| 2592 |
} |
| 2593 |
|
| 2594 |
static void FVDoTransform(FontView *fv) { |
| 2595 |
enum transdlg_flags flags=tdf_enableback|tdf_enablekerns; |
| 2596 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 2597 |
return; |
| 2598 |
if ( FVAllSelected(fv)) |
| 2599 |
flags=tdf_enableback|tdf_enablekerns|tdf_defaultkerns; |
| 2600 |
TransformDlgCreate(fv,FVTransFunc,getorigin,flags,cvt_none); |
| 2601 |
} |
| 2602 |
|
| 2603 |
static void FVMenuTransform(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2604 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2605 |
FVDoTransform(fv); |
| 2606 |
} |
| 2607 |
|
| 2608 |
static void FVMenuPOV(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2609 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2610 |
struct pov_data pov_data; |
| 2611 |
if ( FVAnyCharSelected(fv)==-1 || fv->b.sf->onlybitmaps ) |
| 2612 |
return; |
| 2613 |
if ( PointOfViewDlg(&pov_data,fv->b.sf,false)==-1 ) |
| 2614 |
return; |
| 2615 |
FVPointOfView((FontViewBase *) fv,&pov_data); |
| 2616 |
} |
| 2617 |
|
| 2618 |
static void FVMenuNLTransform(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2619 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2620 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 2621 |
return; |
| 2622 |
NonLinearDlg(fv,NULL); |
| 2623 |
} |
| 2624 |
|
| 2625 |
static void FVMenuBitmaps(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 2626 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2627 |
BitmapDlg(&fv->b,gw,NULL,mi->mid==FV_MID_RemoveBitmaps?-1:(mi->mid==FV_MID_AvailBitmaps) ); |
| 2628 |
} |
| 2629 |
|
| 2630 |
static void FVMenuStroke(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2631 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2632 |
FVStroke(fv); |
| 2633 |
} |
| 2634 |
|
| 2635 |
# ifdef FONTFORGE_CONFIG_TILEPATH |
| 2636 |
static void FVMenuTilePath(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2637 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2638 |
FVTile(fv); |
| 2639 |
} |
| 2640 |
|
| 2641 |
static void FVMenuPatternTile(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2642 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2643 |
FVPatternTile(fv); |
| 2644 |
} |
| 2645 |
#endif |
| 2646 |
|
| 2647 |
static void FVMenuOverlap(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 2648 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2649 |
|
| 2650 |
if ( fv->b.sf->onlybitmaps ) |
| 2651 |
return; |
| 2652 |
|
| 2653 |
|
| 2654 |
|
| 2655 |
DoAutoSaves(); |
| 2656 |
|
| 2657 |
FVOverlap(&fv->b,mi->mid==FV_MID_RmOverlap ? over_remove : |
| 2658 |
mi->mid==FV_MID_Intersection ? over_intersect : |
| 2659 |
over_findinter); |
| 2660 |
} |
| 2661 |
|
| 2662 |
static void FVMenuInline(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2663 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2664 |
|
| 2665 |
OutlineDlg(fv,NULL,NULL,true); |
| 2666 |
} |
| 2667 |
|
| 2668 |
static void FVMenuOutline(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2669 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2670 |
|
| 2671 |
OutlineDlg(fv,NULL,NULL,false); |
| 2672 |
} |
| 2673 |
|
| 2674 |
static void FVMenuShadow(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2675 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2676 |
|
| 2677 |
ShadowDlg(fv,NULL,NULL,false); |
| 2678 |
} |
| 2679 |
|
| 2680 |
static void FVMenuWireframe(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2681 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2682 |
|
| 2683 |
ShadowDlg(fv,NULL,NULL,true); |
| 2684 |
} |
| 2685 |
|
| 2686 |
static void FVSimplify(FontView *fv,int type) { |
| 2687 |
static struct simplifyinfo smpls[] = { |
| 2688 |
{ sf_normal, 0, 0, 0, 0, 0, 0 }, |
| 2689 |
{ sf_normal,.75,.05,0,-1, 0, 0 }, |
| 2690 |
{ sf_normal,.75,.05,0,-1, 0, 0 }}; |
| 2691 |
struct simplifyinfo *smpl = &smpls[type+1]; |
| 2692 |
|
| 2693 |
if ( smpl->linelenmax==-1 || (type==0 && !smpl->set_as_default)) { |
| 2694 |
smpl->err = (fv->b.sf->ascent+fv->b.sf->descent)/1000.; |
| 2695 |
smpl->linelenmax = (fv->b.sf->ascent+fv->b.sf->descent)/100.; |
| 2696 |
} |
| 2697 |
|
| 2698 |
if ( type==1 ) { |
| 2699 |
if ( !SimplifyDlg(fv->b.sf,smpl)) |
| 2700 |
return; |
| 2701 |
if ( smpl->set_as_default ) |
| 2702 |
smpls[1] = *smpl; |
| 2703 |
} |
| 2704 |
_FVSimplify((FontViewBase *) fv,smpl); |
| 2705 |
} |
| 2706 |
|
| 2707 |
static void FVMenuSimplify(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2708 |
FVSimplify( (FontView *) GDrawGetUserData(gw),false ); |
| 2709 |
} |
| 2710 |
|
| 2711 |
static void FVMenuSimplifyMore(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2712 |
FVSimplify( (FontView *) GDrawGetUserData(gw),true ); |
| 2713 |
} |
| 2714 |
|
| 2715 |
static void FVMenuCleanup(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2716 |
FVSimplify( (FontView *) GDrawGetUserData(gw),-1 ); |
| 2717 |
} |
| 2718 |
|
| 2719 |
static void FVMenuCanonicalStart(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2720 |
FVCanonicalStart( (FontViewBase *) GDrawGetUserData(gw) ); |
| 2721 |
} |
| 2722 |
|
| 2723 |
static void FVMenuCanonicalContours(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2724 |
FVCanonicalContours( (FontViewBase *) GDrawGetUserData(gw) ); |
| 2725 |
} |
| 2726 |
|
| 2727 |
static void FVMenuAddExtrema(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2728 |
FVAddExtrema( (FontViewBase *) GDrawGetUserData(gw) , false); |
| 2729 |
} |
| 2730 |
|
| 2731 |
static void FVMenuAddInflections(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2732 |
FVAddInflections( (FontViewBase *) GDrawGetUserData(gw) , false ); |
| 2733 |
} |
| 2734 |
|
| 2735 |
static void FVMenuBalance(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2736 |
FVBalance( (FontViewBase *) GDrawGetUserData(gw) , false ); |
| 2737 |
} |
| 2738 |
|
| 2739 |
static void FVMenuHarmonize(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2740 |
FVHarmonize( (FontViewBase *) GDrawGetUserData(gw) , false ); |
| 2741 |
} |
| 2742 |
|
| 2743 |
static void FVMenuCorrectDir(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2744 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2745 |
FVCorrectDir((FontViewBase *) fv); |
| 2746 |
} |
| 2747 |
|
| 2748 |
static void FVMenuRound2Int(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2749 |
FVRound2Int( (FontViewBase *) GDrawGetUserData(gw), 1.0 ); |
| 2750 |
} |
| 2751 |
|
| 2752 |
static void FVMenuRound2Hundredths(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2753 |
FVRound2Int( (FontViewBase *) GDrawGetUserData(gw),100.0 ); |
| 2754 |
} |
| 2755 |
|
| 2756 |
static void FVMenuCluster(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2757 |
FVCluster( (FontViewBase *) GDrawGetUserData(gw)); |
| 2758 |
} |
| 2759 |
|
| 2760 |
static void FVMenuAutotrace(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *e) { |
| 2761 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2762 |
GCursor ct=0; |
| 2763 |
|
| 2764 |
if ( fv->v!=NULL ) { |
| 2765 |
ct = GDrawGetCursor(fv->v); |
| 2766 |
GDrawSetCursor(fv->v,ct_watch); |
| 2767 |
GDrawSync(NULL); |
| 2768 |
GDrawProcessPendingEvents(NULL); |
| 2769 |
} |
| 2770 |
FVAutoTrace(&fv->b,e!=NULL && (e->u.mouse.state&ksm_shift)); |
| 2771 |
if ( fv->v!=NULL ) |
| 2772 |
GDrawSetCursor(fv->v,ct); |
| 2773 |
} |
| 2774 |
|
| 2775 |
static void FVMenuBuildAccent(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2776 |
FVBuildAccent( (FontViewBase *) GDrawGetUserData(gw), true ); |
| 2777 |
} |
| 2778 |
|
| 2779 |
static void FVMenuBuildComposite(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2780 |
FVBuildAccent( (FontViewBase *) GDrawGetUserData(gw), false ); |
| 2781 |
} |
| 2782 |
|
| 2783 |
static void FVMenuBuildDuplicate(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2784 |
FVBuildDuplicate( (FontViewBase *) GDrawGetUserData(gw)); |
| 2785 |
} |
| 2786 |
|
| 2787 |
#ifdef KOREAN |
| 2788 |
static void FVMenuShowGroup(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2789 |
ShowGroup( ((FontView *) GDrawGetUserData(gw))->sf ); |
| 2790 |
} |
| 2791 |
#endif |
| 2792 |
|
| 2793 |
#if HANYANG |
| 2794 |
static void FVMenuModifyComposition(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2795 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2796 |
if ( fv->b.sf->rules!=NULL ) |
| 2797 |
SFModifyComposition(fv->b.sf); |
| 2798 |
} |
| 2799 |
|
| 2800 |
static void FVMenuBuildSyllables(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2801 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2802 |
if ( fv->b.sf->rules!=NULL ) |
| 2803 |
SFBuildSyllables(fv->b.sf); |
| 2804 |
} |
| 2805 |
#endif |
| 2806 |
|
| 2807 |
static void FVMenuCompareFonts(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2808 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2809 |
FontCompareDlg(fv); |
| 2810 |
} |
| 2811 |
|
| 2812 |
static void FVMenuMergeFonts(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2813 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2814 |
FVMergeFonts(fv); |
| 2815 |
} |
| 2816 |
|
| 2817 |
static void FVMenuInterpFonts(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2818 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2819 |
FVInterpolateFonts(fv); |
| 2820 |
} |
| 2821 |
|
| 2822 |
static void FVShowInfo(FontView *fv); |
| 2823 |
|
| 2824 |
void FVChangeChar(FontView *fv,int i) { |
| 2825 |
|
| 2826 |
if ( i!=-1 ) { |
| 2827 |
FVDeselectAll(fv); |
| 2828 |
fv->b.selected[i] = true; |
| 2829 |
fv->sel_index = 1; |
| 2830 |
fv->end_pos = fv->pressed_pos = i; |
| 2831 |
FVToggleCharSelected(fv,i); |
| 2832 |
FVScrollToChar(fv,i); |
| 2833 |
FVShowInfo(fv); |
| 2834 |
} |
| 2835 |
} |
| 2836 |
|
| 2837 |
void FVScrollToChar(FontView *fv,int i) { |
| 2838 |
|
| 2839 |
if ( fv->v==NULL || fv->colcnt==0 ) |
| 2840 |
return; |
| 2841 |
|
| 2842 |
if ( i!=-1 ) { |
| 2843 |
if ( i/fv->colcnt<fv->rowoff || i/fv->colcnt >= fv->rowoff+fv->rowcnt ) { |
| 2844 |
fv->rowoff = i/fv->colcnt; |
| 2845 |
if ( fv->rowcnt>= 3 ) |
| 2846 |
--fv->rowoff; |
| 2847 |
if ( fv->rowoff+fv->rowcnt>=fv->rowltot ) |
| 2848 |
fv->rowoff = fv->rowltot-fv->rowcnt; |
| 2849 |
if ( fv->rowoff<0 ) fv->rowoff = 0; |
| 2850 |
GScrollBarSetPos(fv->vsb,fv->rowoff); |
| 2851 |
GDrawRequestExpose(fv->v,NULL,false); |
| 2852 |
} |
| 2853 |
} |
| 2854 |
} |
| 2855 |
|
| 2856 |
static void FVScrollToGID(FontView *fv,int gid) { |
| 2857 |
FVScrollToChar(fv,fv->b.map->backmap[gid]); |
| 2858 |
} |
| 2859 |
|
| 2860 |
static void FV_ChangeGID(FontView *fv,int gid) { |
| 2861 |
FVChangeChar(fv,fv->b.map->backmap[gid]); |
| 2862 |
} |
| 2863 |
|
| 2864 |
static void _FVMenuChangeChar(FontView *fv,int mid ) { |
| 2865 |
SplineFont *sf = fv->b.sf; |
| 2866 |
EncMap *map = fv->b.map; |
| 2867 |
int pos = FVAnyCharSelected(fv); |
| 2868 |
|
| 2869 |
if ( pos>=0 ) { |
| 2870 |
if ( mid==FV_MID_Next ) |
| 2871 |
++pos; |
| 2872 |
else if ( mid==FV_MID_Prev ) |
| 2873 |
--pos; |
| 2874 |
else if ( mid==FV_MID_NextDef ) { |
| 2875 |
for ( ++pos; pos<map->enccount && |
| 2876 |
(map->map[pos]==-1 || !SCWorthOutputting(sf->glyphs[map->map[pos]]) || |
| 2877 |
(fv->show!=fv->filled && fv->show->glyphs[map->map[pos]]==NULL )); |
| 2878 |
++pos ); |
| 2879 |
if ( pos>=map->enccount ) { |
| 2880 |
int selpos = FVAnyCharSelected(fv); |
| 2881 |
char *iconv_name = map->enc->iconv_name ? map->enc->iconv_name : |
| 2882 |
map->enc->enc_name; |
| 2883 |
if ( strstr(iconv_name,"2022")!=NULL && selpos<0x2121 ) |
| 2884 |
pos = 0x2121; |
| 2885 |
else if ( strstr(iconv_name,"EUC")!=NULL && selpos<0xa1a1 ) |
| 2886 |
pos = 0xa1a1; |
| 2887 |
else if ( map->enc->is_tradchinese ) { |
| 2888 |
if ( strstrmatch(map->enc->enc_name,"HK")!=NULL && |
| 2889 |
selpos<0x8140 ) |
| 2890 |
pos = 0x8140; |
| 2891 |
else |
| 2892 |
pos = 0xa140; |
| 2893 |
} else if ( map->enc->is_japanese ) { |
| 2894 |
if ( strstrmatch(iconv_name,"SJIS")!=NULL || |
| 2895 |
(strstrmatch(iconv_name,"JIS")!=NULL && strstrmatch(iconv_name,"SHIFT")!=NULL )) { |
| 2896 |
if ( selpos<0x8100 ) |
| 2897 |
pos = 0x8100; |
| 2898 |
else if ( selpos<0xb000 ) |
| 2899 |
pos = 0xb000; |
| 2900 |
} |
| 2901 |
} else if ( map->enc->is_korean ) { |
| 2902 |
if ( strstrmatch(iconv_name,"JOHAB")!=NULL ) { |
| 2903 |
if ( selpos<0x8431 ) |
| 2904 |
pos = 0x8431; |
| 2905 |
} else { |
| 2906 |
if ( selpos<0xa1a1 ) |
| 2907 |
pos = 0xa1a1; |
| 2908 |
} |
| 2909 |
} else if ( map->enc->is_simplechinese ) { |
| 2910 |
if ( strmatch(iconv_name,"EUC-CN")==0 && selpos<0xa1a1 ) |
| 2911 |
pos = 0xa1a1; |
| 2912 |
} |
| 2913 |
if ( pos>=map->enccount ) |
| 2914 |
return; |
| 2915 |
} |
| 2916 |
} else if ( mid==FV_MID_PrevDef ) { |
| 2917 |
for ( --pos; pos>=0 && |
| 2918 |
(map->map[pos]==-1 || !SCWorthOutputting(sf->glyphs[map->map[pos]]) || |
| 2919 |
(fv->show!=fv->filled && fv->show->glyphs[map->map[pos]]==NULL )); |
| 2920 |
--pos ); |
| 2921 |
if ( pos<0 ) |
| 2922 |
return; |
| 2923 |
} |
| 2924 |
} |
| 2925 |
if ( pos<0 ) pos = map->enccount-1; |
| 2926 |
else if ( pos>= map->enccount ) pos = 0; |
| 2927 |
if ( pos>=0 && pos<map->enccount ) |
| 2928 |
FVChangeChar(fv,pos); |
| 2929 |
} |
| 2930 |
|
| 2931 |
static void FVMenuChangeChar(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 2932 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2933 |
_FVMenuChangeChar(fv,mi->mid); |
| 2934 |
} |
| 2935 |
|
| 2936 |
static void FVShowSubFont(FontView *fv,SplineFont *new) { |
| 2937 |
MetricsView *mv, *mvnext; |
| 2938 |
BDFFont *newbdf; |
| 2939 |
int wascompact = fv->b.normal!=NULL; |
| 2940 |
extern int use_freetype_to_rasterize_fv; |
| 2941 |
|
| 2942 |
for ( mv=fv->b.sf->metrics; mv!=NULL; mv = mvnext ) { |
| 2943 |
|
| 2944 |
mvnext = mv->next; |
| 2945 |
GDrawDestroyWindow(mv->gw); |
| 2946 |
} |
| 2947 |
if ( wascompact ) { |
| 2948 |
EncMapFree(fv->b.map); |
| 2949 |
if (fv->b.map == fv->b.sf->map) { fv->b.sf->map = fv->b.normal; } |
| 2950 |
fv->b.map = fv->b.normal; |
| 2951 |
fv->b.normal = NULL; |
| 2952 |
fv->b.selected = realloc(fv->b.selected,fv->b.map->enccount); |
| 2953 |
memset(fv->b.selected,0,fv->b.map->enccount); |
| 2954 |
} |
| 2955 |
CIDSetEncMap((FontViewBase *) fv,new); |
| 2956 |
if ( wascompact ) { |
| 2957 |
fv->b.normal = EncMapCopy(fv->b.map); |
| 2958 |
CompactEncMap(fv->b.map,fv->b.sf); |
| 2959 |
FontViewReformatOne(&fv->b); |
| 2960 |
FVSetTitle(&fv->b); |
| 2961 |
} |
| 2962 |
newbdf = FVSplineFontPieceMeal(fv->b.sf,fv->b.active_layer,fv->filled->pixelsize,72, |
| 2963 |
(fv->antialias?pf_antialias:0)|(fv->bbsized?pf_bbsized:0)| |
| 2964 |
(use_freetype_to_rasterize_fv && !fv->b.sf->strokedfont && !fv->b.sf->multilayer?pf_ft_nohints:0), |
| 2965 |
NULL); |
| 2966 |
BDFFontFree(fv->filled); |
| 2967 |
if ( fv->filled == fv->show ) |
| 2968 |
fv->show = newbdf; |
| 2969 |
fv->filled = newbdf; |
| 2970 |
GDrawRequestExpose(fv->v,NULL,true); |
| 2971 |
} |
| 2972 |
|
| 2973 |
static void FVMenuGotoChar(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 2974 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 2975 |
int merge_with_selection = false; |
| 2976 |
int pos = GotoChar(fv->b.sf,fv->b.map,&merge_with_selection); |
| 2977 |
if ( fv->b.cidmaster!=NULL && pos!=-1 && !fv->b.map->enc->is_compact ) { |
| 2978 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 2979 |
int k, hadk= cidmaster->subfontcnt; |
| 2980 |
for ( k=0; k<cidmaster->subfontcnt; ++k ) { |
| 2981 |
SplineFont *sf = cidmaster->subfonts[k]; |
| 2982 |
if ( pos<sf->glyphcnt && sf->glyphs[pos]!=NULL ) |
| 2983 |
break; |
| 2984 |
if ( pos<sf->glyphcnt ) |
| 2985 |
hadk = k; |
| 2986 |
} |
| 2987 |
if ( k==cidmaster->subfontcnt && pos>=fv->b.sf->glyphcnt ) |
| 2988 |
k = hadk; |
| 2989 |
if ( k!=cidmaster->subfontcnt && cidmaster->subfonts[k] != fv->b.sf ) |
| 2990 |
FVShowSubFont(fv,cidmaster->subfonts[k]); |
| 2991 |
if ( pos>=fv->b.sf->glyphcnt ) |
| 2992 |
pos = -1; |
| 2993 |
} |
| 2994 |
if ( !merge_with_selection ) |
| 2995 |
FVChangeChar(fv,pos); |
| 2996 |
else { |
| 2997 |
if ( !fv->b.selected[pos] ) { |
| 2998 |
fv->b.selected[pos] = ++fv->sel_index; |
| 2999 |
FVToggleCharSelected(fv,pos); |
| 3000 |
} |
| 3001 |
fv->end_pos = fv->pressed_pos = pos; |
| 3002 |
FVScrollToChar(fv,pos); |
| 3003 |
FVShowInfo(fv); |
| 3004 |
} |
| 3005 |
} |
| 3006 |
|
| 3007 |
static void FVMenuLigatures(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3008 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3009 |
SFShowLigatures(fv->b.sf,NULL); |
| 3010 |
} |
| 3011 |
|
| 3012 |
static void FVMenuKernPairs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3013 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3014 |
SFKernClassTempDecompose(fv->b.sf,false); |
| 3015 |
SFShowKernPairs(fv->b.sf,NULL,NULL,fv->b.active_layer); |
| 3016 |
SFKernCleanup(fv->b.sf,false); |
| 3017 |
} |
| 3018 |
|
| 3019 |
static void FVMenuAnchorPairs(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3020 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3021 |
SFShowKernPairs(fv->b.sf,NULL,mi->ti.userdata,fv->b.active_layer); |
| 3022 |
} |
| 3023 |
|
| 3024 |
static void FVMenuShowAtt(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3025 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3026 |
ShowAtt(fv->b.sf,fv->b.active_layer); |
| 3027 |
} |
| 3028 |
|
| 3029 |
static void FVMenuDisplaySubs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3030 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3031 |
|
| 3032 |
if ( fv->cur_subtable!=0 ) { |
| 3033 |
fv->cur_subtable = NULL; |
| 3034 |
} else { |
| 3035 |
SplineFont *sf = fv->b.sf; |
| 3036 |
OTLookup *otf; |
| 3037 |
struct lookup_subtable *sub; |
| 3038 |
int cnt, k; |
| 3039 |
char **names = NULL; |
| 3040 |
if ( sf->cidmaster ) sf=sf->cidmaster; |
| 3041 |
for ( k=0; k<2; ++k ) { |
| 3042 |
cnt = 0; |
| 3043 |
for ( otf = sf->gsub_lookups; otf!=NULL; otf=otf->next ) { |
| 3044 |
if ( otf->lookup_type==gsub_single ) { |
| 3045 |
for ( sub=otf->subtables; sub!=NULL; sub=sub->next ) { |
| 3046 |
if ( names ) |
| 3047 |
names[cnt] = sub->subtable_name; |
| 3048 |
++cnt; |
| 3049 |
} |
| 3050 |
} |
| 3051 |
} |
| 3052 |
if ( cnt==0 ) |
| 3053 |
break; |
| 3054 |
if ( names==NULL ) |
| 3055 |
names = malloc((cnt+3) * sizeof(char *)); |
| 3056 |
else { |
| 3057 |
names[cnt++] = "-"; |
| 3058 |
names[cnt++] = _("New Lookup Subtable..."); |
| 3059 |
names[cnt] = NULL; |
| 3060 |
} |
| 3061 |
} |
| 3062 |
sub = NULL; |
| 3063 |
if ( names!=NULL ) { |
| 3064 |
int ret = gwwv_choose(_("Display Substitution..."), (const char **) names, cnt, 0, |
| 3065 |
_("Pick a substitution to display in the window.")); |
| 3066 |
if ( ret!=-1 ) |
| 3067 |
sub = SFFindLookupSubtable(sf,names[ret]); |
| 3068 |
free(names); |
| 3069 |
if ( ret==-1 ) |
| 3070 |
return; |
| 3071 |
} |
| 3072 |
if ( sub==NULL ) |
| 3073 |
sub = SFNewLookupSubtableOfType(sf,gsub_single,NULL,fv->b.active_layer); |
| 3074 |
if ( sub!=NULL ) |
| 3075 |
fv->cur_subtable = sub; |
| 3076 |
} |
| 3077 |
GDrawRequestExpose(fv->v,NULL,false); |
| 3078 |
} |
| 3079 |
|
| 3080 |
static void FVChangeDisplayFont(FontView *fv,BDFFont *bdf) { |
| 3081 |
int samesize=0; |
| 3082 |
int rcnt, ccnt; |
| 3083 |
int oldr, oldc; |
| 3084 |
int first_time = fv->show==NULL; |
| 3085 |
|
| 3086 |
if ( fv->v==NULL ) |
| 3087 |
return; |
| 3088 |
|
| 3089 |
if ( fv->show!=bdf ) { |
| 3090 |
oldc = fv->cbw*fv->colcnt; |
| 3091 |
oldr = fv->cbh*fv->rowcnt; |
| 3092 |
|
| 3093 |
fv->show = bdf; |
| 3094 |
fv->b.active_bitmap = bdf==fv->filled ? NULL : bdf; |
| 3095 |
if ( fv->user_requested_magnify!=-1 ) |
| 3096 |
fv->magnify=fv->user_requested_magnify; |
| 3097 |
else if ( bdf->pixelsize<20 ) { |
| 3098 |
if ( bdf->pixelsize<=9 ) |
| 3099 |
fv->magnify = 3; |
| 3100 |
else |
| 3101 |
fv->magnify = 2; |
| 3102 |
samesize = ( fv->show && fv->cbw == (bdf->pixelsize*fv->magnify)+1 ); |
| 3103 |
} else |
| 3104 |
fv->magnify = 1; |
| 3105 |
if ( !first_time && fv->cbw == fv->magnify*bdf->pixelsize+1 ) |
| 3106 |
samesize = true; |
| 3107 |
fv->cbw = (bdf->pixelsize*fv->magnify)+1; |
| 3108 |
fv->cbh = (bdf->pixelsize*fv->magnify)+1+fv->lab_height+1; |
| 3109 |
fv->resize_expected = !samesize; |
| 3110 |
ccnt = fv->b.sf->desired_col_cnt; |
| 3111 |
rcnt = fv->b.sf->desired_row_cnt; |
| 3112 |
if ((( bdf->pixelsize<=fv->b.sf->display_size || bdf->pixelsize<=-fv->b.sf->display_size ) && |
| 3113 |
fv->b.sf->top_enc!=-1 ) || |
| 3114 |
bdf->pixelsize<=48 ) { |
| 3115 |
|
| 3116 |
} else { |
| 3117 |
if ( bdf->pixelsize>48 ) { |
| 3118 |
ccnt = 8; |
| 3119 |
rcnt = 2; |
| 3120 |
} else if ( bdf->pixelsize>=96 ) { |
| 3121 |
ccnt = 4; |
| 3122 |
rcnt = 1; |
| 3123 |
} |
| 3124 |
if ( !first_time ) { |
| 3125 |
if ( ccnt < oldc/fv->cbw ) |
| 3126 |
ccnt = oldc/fv->cbw; |
| 3127 |
if ( rcnt < oldr/fv->cbh ) |
| 3128 |
rcnt = oldr/fv->cbh; |
| 3129 |
} |
| 3130 |
} |
| 3131 |
if ( samesize ) { |
| 3132 |
GDrawRequestExpose(fv->v,NULL,false); |
| 3133 |
} else if ( fv->b.container!=NULL && fv->b.container->funcs->doResize!=NULL ) { |
| 3134 |
(fv->b.container->funcs->doResize)(fv->b.container,&fv->b, |
| 3135 |
ccnt*fv->cbw+1+GDrawPointsToPixels(fv->gw,_GScrollBar_Width), |
| 3136 |
rcnt*fv->cbh+1+fv->mbh+fv->infoh); |
| 3137 |
} else { |
| 3138 |
GDrawResize(fv->gw, |
| 3139 |
ccnt*fv->cbw+1+GDrawPointsToPixels(fv->gw,_GScrollBar_Width), |
| 3140 |
rcnt*fv->cbh+1+fv->mbh+fv->infoh); |
| 3141 |
} |
| 3142 |
} |
| 3143 |
} |
| 3144 |
|
| 3145 |
struct md_data { |
| 3146 |
int done; |
| 3147 |
int ish; |
| 3148 |
FontView *fv; |
| 3149 |
}; |
| 3150 |
|
| 3151 |
static int md_e_h(GWindow gw, GEvent *e) { |
| 3152 |
if ( e->type==et_close ) { |
| 3153 |
struct md_data *d = GDrawGetUserData(gw); |
| 3154 |
d->done = true; |
| 3155 |
} else if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { |
| 3156 |
struct md_data *d = GDrawGetUserData(gw); |
| 3157 |
static int masks[] = { fvm_baseline, fvm_origin, fvm_advanceat, fvm_advanceto, fvm_contour, -1 }; |
| 3158 |
int i, metrics; |
| 3159 |
if ( GGadgetGetCid(e->u.control.g)==10 ) { |
| 3160 |
metrics = 0; |
| 3161 |
for ( i=0; masks[i]!=-1 ; ++i ) |
| 3162 |
if ( GGadgetIsChecked(GWidgetGetControl(gw,masks[i]))) |
| 3163 |
metrics |= masks[i]; |
| 3164 |
if ( d->ish ) |
| 3165 |
default_fv_showhmetrics = d->fv->showhmetrics = metrics; |
| 3166 |
else |
| 3167 |
default_fv_showvmetrics = d->fv->showvmetrics = metrics; |
| 3168 |
} |
| 3169 |
d->done = true; |
| 3170 |
} else if ( e->type==et_char ) { |
| 3171 |
return( false ); |
| 3172 |
} |
| 3173 |
return( true ); |
| 3174 |
} |
| 3175 |
|
| 3176 |
static void FVMenuShowMetrics(GWindow fvgw,struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3177 |
FontView *fv = (FontView *) GDrawGetUserData(fvgw); |
| 3178 |
GRect pos; |
| 3179 |
GWindow gw; |
| 3180 |
GWindowAttrs wattrs; |
| 3181 |
struct md_data d; |
| 3182 |
GGadgetCreateData gcd[8]; |
| 3183 |
GTextInfo label[7]; |
| 3184 |
int metrics = mi->mid==FV_MID_ShowHMetrics ? fv->showhmetrics : fv->showvmetrics; |
| 3185 |
|
| 3186 |
d.fv = fv; |
| 3187 |
d.done = 0; |
| 3188 |
d.ish = mi->mid==FV_MID_ShowHMetrics; |
| 3189 |
|
| 3190 |
memset(&wattrs,0,sizeof(wattrs)); |
| 3191 |
wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_restrict; |
| 3192 |
wattrs.event_masks = ~(1<<et_charup); |
| 3193 |
wattrs.restrict_input_to_me = 1; |
| 3194 |
wattrs.undercursor = 1; |
| 3195 |
wattrs.cursor = ct_pointer; |
| 3196 |
wattrs.utf8_window_title = d.ish?_("Show H. Metrics"):_("Show V. Metrics"); |
| 3197 |
pos.x = pos.y = 0; |
| 3198 |
pos.width =GDrawPointsToPixels(NULL,GGadgetScale(170)); |
| 3199 |
pos.height = GDrawPointsToPixels(NULL,130); |
| 3200 |
gw = GDrawCreateTopWindow(NULL,&pos,md_e_h,&d,&wattrs); |
| 3201 |
|
| 3202 |
memset(&label,0,sizeof(label)); |
| 3203 |
memset(&gcd,0,sizeof(gcd)); |
| 3204 |
|
| 3205 |
label[0].text = (unichar_t *) _("Baseline"); |
| 3206 |
label[0].text_is_1byte = true; |
| 3207 |
gcd[0].gd.label = &label[0]; |
| 3208 |
gcd[0].gd.pos.x = 8; gcd[0].gd.pos.y = 8; |
| 3209 |
gcd[0].gd.flags = gg_enabled|gg_visible|(metrics&fvm_baseline?gg_cb_on:0); |
| 3210 |
gcd[0].gd.cid = fvm_baseline; |
| 3211 |
gcd[0].creator = GCheckBoxCreate; |
| 3212 |
|
| 3213 |
label[1].text = (unichar_t *) _("Origin"); |
| 3214 |
label[1].text_is_1byte = true; |
| 3215 |
gcd[1].gd.label = &label[1]; |
| 3216 |
gcd[1].gd.pos.x = 8; gcd[1].gd.pos.y = gcd[0].gd.pos.y+16; |
| 3217 |
gcd[1].gd.flags = gg_enabled|gg_visible|(metrics&fvm_origin?gg_cb_on:0); |
| 3218 |
gcd[1].gd.cid = fvm_origin; |
| 3219 |
gcd[1].creator = GCheckBoxCreate; |
| 3220 |
|
| 3221 |
label[2].text = (unichar_t *) _("Advance Width as a Line"); |
| 3222 |
label[2].text_is_1byte = true; |
| 3223 |
gcd[2].gd.label = &label[2]; |
| 3224 |
gcd[2].gd.pos.x = 8; gcd[2].gd.pos.y = gcd[1].gd.pos.y+16; |
| 3225 |
gcd[2].gd.flags = gg_enabled|gg_visible|(metrics&fvm_advanceat?gg_cb_on:0); |
| 3226 |
gcd[2].gd.cid = fvm_advanceat; |
| 3227 |
gcd[2].gd.popup_msg = _("Display the advance width as a line\nperpendicular to the advance direction"); |
| 3228 |
gcd[2].creator = GCheckBoxCreate; |
| 3229 |
|
| 3230 |
label[3].text = (unichar_t *) _("Advance Width as a Bar"); |
| 3231 |
label[3].text_is_1byte = true; |
| 3232 |
gcd[3].gd.label = &label[3]; |
| 3233 |
gcd[3].gd.pos.x = 8; gcd[3].gd.pos.y = gcd[2].gd.pos.y+16; |
| 3234 |
gcd[3].gd.flags = gg_enabled|gg_visible|(metrics&fvm_advanceto?gg_cb_on:0); |
| 3235 |
gcd[3].gd.cid = fvm_advanceto; |
| 3236 |
gcd[3].gd.popup_msg = _("Display the advance width as a bar under the glyph\nshowing the extent of the advance"); |
| 3237 |
gcd[3].creator = GCheckBoxCreate; |
| 3238 |
|
| 3239 |
label[4].text = (unichar_t *) _("Draw a glyph contour"); |
| 3240 |
label[4].text_is_1byte = true; |
| 3241 |
gcd[4].gd.label = &label[4]; |
| 3242 |
gcd[4].gd.pos.x = 8; gcd[4].gd.pos.y = gcd[3].gd.pos.y+16; |
| 3243 |
gcd[4].gd.flags = gg_enabled|gg_visible|(metrics&fvm_contour?gg_cb_on:0); |
| 3244 |
gcd[4].gd.cid = fvm_contour; |
| 3245 |
gcd[4].gd.popup_msg = _("Display a glyph contour"); |
| 3246 |
gcd[4].creator = GCheckBoxCreate; |
| 3247 |
|
| 3248 |
label[5].text = (unichar_t *) _("_OK"); |
| 3249 |
label[5].text_is_1byte = true; |
| 3250 |
label[5].text_in_resource = true; |
| 3251 |
gcd[5].gd.label = &label[5]; |
| 3252 |
gcd[5].gd.pos.x = 20-3; gcd[5].gd.pos.y = GDrawPixelsToPoints(NULL,pos.height)-35-3; |
| 3253 |
gcd[5].gd.pos.width = -1; gcd[5].gd.pos.height = 0; |
| 3254 |
gcd[5].gd.flags = gg_visible | gg_enabled | gg_but_default; |
| 3255 |
gcd[5].gd.cid = 10; |
| 3256 |
gcd[5].creator = GButtonCreate; |
| 3257 |
|
| 3258 |
label[6].text = (unichar_t *) _("_Cancel"); |
| 3259 |
label[6].text_is_1byte = true; |
| 3260 |
label[6].text_in_resource = true; |
| 3261 |
gcd[6].gd.label = &label[6]; |
| 3262 |
gcd[6].gd.pos.x = -20; gcd[6].gd.pos.y = gcd[5].gd.pos.y+3; |
| 3263 |
gcd[6].gd.pos.width = -1; gcd[6].gd.pos.height = 0; |
| 3264 |
gcd[6].gd.flags = gg_visible | gg_enabled | gg_but_cancel; |
| 3265 |
gcd[6].creator = GButtonCreate; |
| 3266 |
|
| 3267 |
GGadgetsCreate(gw,gcd); |
| 3268 |
|
| 3269 |
GDrawSetVisible(gw,true); |
| 3270 |
while ( !d.done ) |
| 3271 |
GDrawProcessOneEvent(NULL); |
| 3272 |
GDrawDestroyWindow(gw); |
| 3273 |
|
| 3274 |
SavePrefs(true); |
| 3275 |
GDrawRequestExpose(fv->v,NULL,false); |
| 3276 |
} |
| 3277 |
|
| 3278 |
static void FV_ChangeDisplayBitmap(FontView *fv,BDFFont *bdf) { |
| 3279 |
FVChangeDisplayFont(fv,bdf); |
| 3280 |
if (fv->show != NULL) { |
| 3281 |
fv->b.sf->display_size = fv->show->pixelsize; |
| 3282 |
} else { |
| 3283 |
fv->b.sf->display_size = 1; |
| 3284 |
} |
| 3285 |
} |
| 3286 |
|
| 3287 |
static void FVMenuSize(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3288 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3289 |
int dspsize = fv->filled->pixelsize; |
| 3290 |
int changedmodifier = false; |
| 3291 |
extern int use_freetype_to_rasterize_fv; |
| 3292 |
|
| 3293 |
fv->magnify = 1; |
| 3294 |
fv->user_requested_magnify = -1; |
| 3295 |
if ( mi->mid == FV_MID_24 ) |
| 3296 |
default_fv_font_size = dspsize = 24; |
| 3297 |
else if ( mi->mid == FV_MID_36 ) |
| 3298 |
default_fv_font_size = dspsize = 36; |
| 3299 |
else if ( mi->mid == FV_MID_48 ) |
| 3300 |
default_fv_font_size = dspsize = 48; |
| 3301 |
else if ( mi->mid == FV_MID_72 ) |
| 3302 |
default_fv_font_size = dspsize = 72; |
| 3303 |
else if ( mi->mid == FV_MID_96 ) |
| 3304 |
default_fv_font_size = dspsize = 96; |
| 3305 |
else if ( mi->mid == FV_MID_128 ) |
| 3306 |
default_fv_font_size = dspsize = 128; |
| 3307 |
else if ( mi->mid == FV_MID_FitToBbox ) { |
| 3308 |
default_fv_bbsized = fv->bbsized = !fv->bbsized; |
| 3309 |
fv->b.sf->display_bbsized = fv->bbsized; |
| 3310 |
changedmodifier = true; |
| 3311 |
} else { |
| 3312 |
default_fv_antialias = fv->antialias = !fv->antialias; |
| 3313 |
fv->b.sf->display_antialias = fv->antialias; |
| 3314 |
changedmodifier = true; |
| 3315 |
} |
| 3316 |
|
| 3317 |
SavePrefs(true); |
| 3318 |
if ( fv->filled!=fv->show || fv->filled->pixelsize != dspsize || changedmodifier ) { |
| 3319 |
BDFFont *new, *old; |
| 3320 |
old = fv->filled; |
| 3321 |
new = FVSplineFontPieceMeal(fv->b.sf,fv->b.active_layer,dspsize,72, |
| 3322 |
(fv->antialias?pf_antialias:0)|(fv->bbsized?pf_bbsized:0)| |
| 3323 |
(use_freetype_to_rasterize_fv && !fv->b.sf->strokedfont && !fv->b.sf->multilayer?pf_ft_nohints:0), |
| 3324 |
NULL); |
| 3325 |
fv->filled = new; |
| 3326 |
FVChangeDisplayFont(fv,new); |
| 3327 |
BDFFontFree(old); |
| 3328 |
fv->b.sf->display_size = -dspsize; |
| 3329 |
if ( fv->b.cidmaster!=NULL ) { |
| 3330 |
int i; |
| 3331 |
for ( i=0; i<fv->b.cidmaster->subfontcnt; ++i ) |
| 3332 |
fv->b.cidmaster->subfonts[i]->display_size = -dspsize; |
| 3333 |
} |
| 3334 |
} |
| 3335 |
} |
| 3336 |
|
| 3337 |
void FVSetUIToMatch(FontView *destfv,FontView *srcfv) { |
| 3338 |
extern int use_freetype_to_rasterize_fv; |
| 3339 |
|
| 3340 |
if ( destfv->filled==NULL || srcfv->filled==NULL ) |
| 3341 |
return; |
| 3342 |
if ( destfv->magnify!=srcfv->magnify || |
| 3343 |
destfv->user_requested_magnify!=srcfv->user_requested_magnify || |
| 3344 |
destfv->bbsized!=srcfv->bbsized || |
| 3345 |
destfv->antialias!=srcfv->antialias || |
| 3346 |
destfv->filled->pixelsize != srcfv->filled->pixelsize ) { |
| 3347 |
BDFFont *new, *old; |
| 3348 |
destfv->magnify = srcfv->magnify; |
| 3349 |
destfv->user_requested_magnify = srcfv->user_requested_magnify; |
| 3350 |
destfv->bbsized = srcfv->bbsized; |
| 3351 |
destfv->antialias = srcfv->antialias; |
| 3352 |
old = destfv->filled; |
| 3353 |
new = FVSplineFontPieceMeal(destfv->b.sf,destfv->b.active_layer,srcfv->filled->pixelsize,72, |
| 3354 |
(destfv->antialias?pf_antialias:0)|(destfv->bbsized?pf_bbsized:0)| |
| 3355 |
(use_freetype_to_rasterize_fv && !destfv->b.sf->strokedfont && !destfv->b.sf->multilayer?pf_ft_nohints:0), |
| 3356 |
NULL); |
| 3357 |
destfv->filled = new; |
| 3358 |
FVChangeDisplayFont(destfv,new); |
| 3359 |
BDFFontFree(old); |
| 3360 |
} |
| 3361 |
} |
| 3362 |
|
| 3363 |
static void FV_LayerChanged( FontView *fv ) { |
| 3364 |
extern int use_freetype_to_rasterize_fv; |
| 3365 |
BDFFont *new, *old; |
| 3366 |
|
| 3367 |
fv->magnify = 1; |
| 3368 |
fv->user_requested_magnify = -1; |
| 3369 |
|
| 3370 |
old = fv->filled; |
| 3371 |
new = FVSplineFontPieceMeal(fv->b.sf,fv->b.active_layer,fv->filled->pixelsize,72, |
| 3372 |
(fv->antialias?pf_antialias:0)|(fv->bbsized?pf_bbsized:0)| |
| 3373 |
(use_freetype_to_rasterize_fv && !fv->b.sf->strokedfont && !fv->b.sf->multilayer?pf_ft_nohints:0), |
| 3374 |
NULL); |
| 3375 |
fv->filled = new; |
| 3376 |
FVChangeDisplayFont(fv,new); |
| 3377 |
fv->b.sf->display_size = -fv->filled->pixelsize; |
| 3378 |
BDFFontFree(old); |
| 3379 |
} |
| 3380 |
|
| 3381 |
static void FVMenuChangeLayer(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3382 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3383 |
|
| 3384 |
fv->b.active_layer = mi->mid; |
| 3385 |
fv->b.sf->display_layer = mi->mid; |
| 3386 |
FV_LayerChanged(fv); |
| 3387 |
} |
| 3388 |
|
| 3389 |
static void FVMenuMagnify(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3390 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3391 |
int magnify = fv->user_requested_magnify!=-1 ? fv->user_requested_magnify : fv->magnify; |
| 3392 |
char def[20], *end, *ret; |
| 3393 |
int val; |
| 3394 |
BDFFont *show = fv->show; |
| 3395 |
|
| 3396 |
sprintf( def, "%d", magnify ); |
| 3397 |
ret = gwwv_ask_string(_("Bitmap Magnification..."),def,_("Please specify a bitmap magnification factor.")); |
| 3398 |
if ( ret==NULL ) |
| 3399 |
return; |
| 3400 |
val = strtol(ret,&end,10); |
| 3401 |
if ( val<1 || val>30 || *end!='\0' ) |
| 3402 |
ff_post_error( _("Bad Number"),_("Bad Number") ); |
| 3403 |
else { |
| 3404 |
fv->user_requested_magnify = val; |
| 3405 |
fv->show = fv->filled; |
| 3406 |
fv->b.active_bitmap = NULL; |
| 3407 |
FVChangeDisplayFont(fv,show); |
| 3408 |
} |
| 3409 |
free(ret); |
| 3410 |
} |
| 3411 |
|
| 3412 |
static void FVMenuWSize(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3413 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3414 |
int h,v; |
| 3415 |
extern int default_fv_col_count, default_fv_row_count; |
| 3416 |
|
| 3417 |
if ( mi->mid == FV_MID_32x8 ) { |
| 3418 |
h = 32; v=8; |
| 3419 |
} else if ( mi->mid == FV_MID_16x4 ) { |
| 3420 |
h = 16; v=4; |
| 3421 |
} else { |
| 3422 |
h = 8; v=2; |
| 3423 |
} |
| 3424 |
GDrawResize(fv->gw, |
| 3425 |
h*fv->cbw+1+GDrawPointsToPixels(fv->gw,_GScrollBar_Width), |
| 3426 |
v*fv->cbh+1+fv->mbh+fv->infoh); |
| 3427 |
fv->b.sf->desired_col_cnt = default_fv_col_count = h; |
| 3428 |
fv->b.sf->desired_row_cnt = default_fv_row_count = v; |
| 3429 |
|
| 3430 |
SavePrefs(true); |
| 3431 |
} |
| 3432 |
|
| 3433 |
static void FVMenuGlyphLabel(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3434 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3435 |
|
| 3436 |
default_fv_glyphlabel = fv->glyphlabel = mi->mid; |
| 3437 |
|
| 3438 |
GDrawRequestExpose(fv->v,NULL,false); |
| 3439 |
|
| 3440 |
SavePrefs(true); |
| 3441 |
} |
| 3442 |
|
| 3443 |
static void FVMenuShowBitmap(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3444 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3445 |
BDFFont *bdf = mi->ti.userdata; |
| 3446 |
|
| 3447 |
FV_ChangeDisplayBitmap(fv,bdf); |
| 3448 |
} |
| 3449 |
|
| 3450 |
static void FV_ShowFilled(FontView *fv) { |
| 3451 |
|
| 3452 |
fv->magnify = 1; |
| 3453 |
fv->user_requested_magnify = 1; |
| 3454 |
if ( fv->show!=fv->filled ) |
| 3455 |
FVChangeDisplayFont(fv,fv->filled); |
| 3456 |
fv->b.sf->display_size = -fv->filled->pixelsize; |
| 3457 |
fv->b.active_bitmap = NULL; |
| 3458 |
} |
| 3459 |
|
| 3460 |
static void FVMenuCenter(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3461 |
FontViewBase *fv = (FontViewBase *) GDrawGetUserData(gw); |
| 3462 |
FVMetricsCenter(fv,mi->mid==FV_MID_Center); |
| 3463 |
} |
| 3464 |
|
| 3465 |
static void FVMenuSetWidth(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3466 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3467 |
|
| 3468 |
if ( FVAnyCharSelected(fv)==-1 ) |
| 3469 |
return; |
| 3470 |
if ( mi->mid == FV_MID_SetVWidth && !fv->b.sf->hasvmetrics ) |
| 3471 |
return; |
| 3472 |
FVSetWidth(fv,mi->mid==FV_MID_SetWidth ?wt_width: |
| 3473 |
mi->mid==FV_MID_SetLBearing?wt_lbearing: |
| 3474 |
mi->mid==FV_MID_SetRBearing?wt_rbearing: |
| 3475 |
mi->mid==FV_MID_SetBearings?wt_bearings: |
| 3476 |
wt_vwidth); |
| 3477 |
} |
| 3478 |
|
| 3479 |
static void FVMenuAutoWidth(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3480 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3481 |
|
| 3482 |
FVAutoWidth2(fv); |
| 3483 |
} |
| 3484 |
|
| 3485 |
static void FVMenuKernByClasses(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3486 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3487 |
|
| 3488 |
ShowKernClasses(fv->b.sf,NULL,fv->b.active_layer,false); |
| 3489 |
} |
| 3490 |
|
| 3491 |
static void FVMenuVKernByClasses(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3492 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3493 |
|
| 3494 |
ShowKernClasses(fv->b.sf,NULL,fv->b.active_layer,true); |
| 3495 |
} |
| 3496 |
|
| 3497 |
static void FVMenuRemoveKern(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3498 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3499 |
|
| 3500 |
FVRemoveKerns(&fv->b); |
| 3501 |
} |
| 3502 |
|
| 3503 |
static void FVMenuRemoveVKern(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3504 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3505 |
|
| 3506 |
FVRemoveVKerns(&fv->b); |
| 3507 |
} |
| 3508 |
|
| 3509 |
static void FVMenuKPCloseup(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3510 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3511 |
int i; |
| 3512 |
|
| 3513 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 3514 |
if ( fv->b.selected[i] ) |
| 3515 |
break; |
| 3516 |
KernPairD(fv->b.sf,i==fv->b.map->enccount?NULL: |
| 3517 |
fv->b.map->map[i]==-1?NULL: |
| 3518 |
fv->b.sf->glyphs[fv->b.map->map[i]],NULL,fv->b.active_layer, |
| 3519 |
false); |
| 3520 |
} |
| 3521 |
|
| 3522 |
static void FVMenuVKernFromHKern(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3523 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3524 |
|
| 3525 |
FVVKernFromHKern(&fv->b); |
| 3526 |
} |
| 3527 |
|
| 3528 |
static void FVMenuAutoHint(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3529 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3530 |
FVAutoHint( &fv->b ); |
| 3531 |
} |
| 3532 |
|
| 3533 |
static void FVMenuAutoHintSubs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3534 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3535 |
FVAutoHintSubs( &fv->b ); |
| 3536 |
} |
| 3537 |
|
| 3538 |
static void FVMenuAutoCounter(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3539 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3540 |
FVAutoCounter( &fv->b ); |
| 3541 |
} |
| 3542 |
|
| 3543 |
static void FVMenuDontAutoHint(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3544 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3545 |
FVDontAutoHint( &fv->b ); |
| 3546 |
} |
| 3547 |
|
| 3548 |
static void FVMenuDeltas(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3549 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3550 |
|
| 3551 |
if ( !hasFreeTypeDebugger()) |
| 3552 |
return; |
| 3553 |
DeltaSuggestionDlg(fv,NULL); |
| 3554 |
} |
| 3555 |
|
| 3556 |
static void FVMenuAutoInstr(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3557 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3558 |
FVAutoInstr( &fv->b ); |
| 3559 |
} |
| 3560 |
|
| 3561 |
static void FVMenuEditInstrs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3562 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3563 |
int index = FVAnyCharSelected(fv); |
| 3564 |
SplineChar *sc; |
| 3565 |
if ( index<0 ) |
| 3566 |
return; |
| 3567 |
sc = SFMakeChar(fv->b.sf,fv->b.map,index); |
| 3568 |
SCEditInstructions(sc); |
| 3569 |
} |
| 3570 |
|
| 3571 |
static void FVMenuEditTable(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3572 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3573 |
SFEditTable(fv->b.sf, |
| 3574 |
mi->mid==FV_MID_Editprep?CHR('p','r','e','p'): |
| 3575 |
mi->mid==FV_MID_Editfpgm?CHR('f','p','g','m'): |
| 3576 |
mi->mid==FV_MID_Editmaxp?CHR('m','a','x','p'): |
| 3577 |
CHR('c','v','t',' ')); |
| 3578 |
} |
| 3579 |
|
| 3580 |
static void FVMenuRmInstrTables(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3581 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3582 |
TtfTablesFree(fv->b.sf->ttf_tables); |
| 3583 |
fv->b.sf->ttf_tables = NULL; |
| 3584 |
if ( !fv->b.sf->changed ) { |
| 3585 |
fv->b.sf->changed = true; |
| 3586 |
FVSetTitles(fv->b.sf); |
| 3587 |
} |
| 3588 |
} |
| 3589 |
|
| 3590 |
static void FVMenuClearInstrs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3591 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3592 |
FVClearInstrs(&fv->b); |
| 3593 |
} |
| 3594 |
|
| 3595 |
static void FVMenuClearHints(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3596 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3597 |
FVClearHints(&fv->b); |
| 3598 |
} |
| 3599 |
|
| 3600 |
static void FVMenuHistograms(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3601 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3602 |
SFHistogram(gw, fv->b.sf, fv->b.active_layer, NULL, |
| 3603 |
FVAnyCharSelected(fv)!=-1?fv->b.selected:NULL, |
| 3604 |
fv->b.map, |
| 3605 |
mi->mid==FV_MID_HStemHist ? hist_hstem : |
| 3606 |
mi->mid==FV_MID_VStemHist ? hist_vstem : |
| 3607 |
hist_blues); |
| 3608 |
} |
| 3609 |
|
| 3610 |
|
| 3611 |
static void FontViewSetTitle(FontView *fv) { |
| 3612 |
char *title; |
| 3613 |
char *file=NULL; |
| 3614 |
char *enc; |
| 3615 |
int len; |
| 3616 |
|
| 3617 |
if ( fv->gw==NULL ) |
| 3618 |
return; |
| 3619 |
|
| 3620 |
enc = SFEncodingName(fv->b.sf,fv->b.normal?fv->b.normal:fv->b.map); |
| 3621 |
len = strlen(fv->b.sf->fontname)+1 + strlen(enc)+6; |
| 3622 |
if ( fv->b.normal ) len += strlen(_("Compact"))+1; |
| 3623 |
if ( fv->b.cidmaster!=NULL ) { |
| 3624 |
if ( (file = fv->b.cidmaster->filename)==NULL ) |
| 3625 |
file = fv->b.cidmaster->origname; |
| 3626 |
} else { |
| 3627 |
if ( (file = fv->b.sf->filename)==NULL ) |
| 3628 |
file = fv->b.sf->origname; |
| 3629 |
} |
| 3630 |
if ( file!=NULL ) |
| 3631 |
len += 2+strlen(file); |
| 3632 |
title = malloc((len+1)*sizeof(char)); |
| 3633 |
strcpy(title,fv->b.sf->fontname); |
| 3634 |
if ( fv->b.sf->changed ) |
| 3635 |
strcat(title,"*"); |
| 3636 |
if ( file!=NULL ) { |
| 3637 |
strcat(title," "); |
| 3638 |
strcat(title, GFileNameTail(file)); |
| 3639 |
} |
| 3640 |
strcat(title, " (" ); |
| 3641 |
if ( fv->b.normal ) { strcat(title,_("Compact")); strcat(title," "); } |
| 3642 |
strcat(title,enc); |
| 3643 |
strcat(title, ")" ); |
| 3644 |
free(enc); |
| 3645 |
|
| 3646 |
GDrawSetWindowTitles8(fv->gw,title,fv->b.sf->fontname); |
| 3647 |
free(title); |
| 3648 |
} |
| 3649 |
|
| 3650 |
void FVTitleUpdate(FontViewBase *fv) |
| 3651 |
{ |
| 3652 |
FontViewSetTitle( (FontView*)fv ); |
| 3653 |
} |
| 3654 |
|
| 3655 |
static void FontViewSetTitles(SplineFont *sf) { |
| 3656 |
FontView *fv; |
| 3657 |
|
| 3658 |
for ( fv = (FontView *) (sf->fv); fv!=NULL; fv=(FontView *) (fv->b.nextsame)) |
| 3659 |
FontViewSetTitle(fv); |
| 3660 |
} |
| 3661 |
|
| 3662 |
static void FVMenuShowSubFont(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3663 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3664 |
SplineFont *new = mi->ti.userdata; |
| 3665 |
FVShowSubFont(fv,new); |
| 3666 |
} |
| 3667 |
|
| 3668 |
static void FVMenuConvert2CID(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3669 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3670 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 3671 |
struct cidmap *cidmap; |
| 3672 |
|
| 3673 |
if ( cidmaster!=NULL ) |
| 3674 |
return; |
| 3675 |
SFFindNearTop(fv->b.sf); |
| 3676 |
cidmap = AskUserForCIDMap(); |
| 3677 |
if ( cidmap==NULL ) |
| 3678 |
return; |
| 3679 |
MakeCIDMaster(fv->b.sf,fv->b.map,false,NULL,cidmap); |
| 3680 |
SFRestoreNearTop(fv->b.sf); |
| 3681 |
} |
| 3682 |
|
| 3683 |
static enum fchooserret CMapFilter(GGadget *g,const struct gdirentry *ent, |
| 3684 |
const char *dir) { |
| 3685 |
enum fchooserret ret = GFileChooserDefFilter(g,ent,dir); |
| 3686 |
char buf2[256]; |
| 3687 |
FILE *file; |
| 3688 |
static char *cmapflag = "%!PS-Adobe-3.0 Resource-CMap"; |
| 3689 |
|
| 3690 |
if ( ret==fc_show && !ent->isdir ) { |
| 3691 |
file = fopen(ent->fullpath,"r"); |
| 3692 |
if ( file==NULL ) |
| 3693 |
ret = fc_hide; |
| 3694 |
else { |
| 3695 |
if ( fgets(buf2,sizeof(buf2),file)==NULL || |
| 3696 |
strncmp(buf2,cmapflag,strlen(cmapflag))!=0 ) |
| 3697 |
ret = fc_hide; |
| 3698 |
fclose(file); |
| 3699 |
} |
| 3700 |
} |
| 3701 |
return( ret ); |
| 3702 |
} |
| 3703 |
|
| 3704 |
static void FVMenuConvertByCMap(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3705 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3706 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 3707 |
char *cmapfilename; |
| 3708 |
|
| 3709 |
if ( cidmaster!=NULL ) |
| 3710 |
return; |
| 3711 |
cmapfilename = gwwv_open_filename(_("Find an adobe CMap file..."),NULL,NULL,CMapFilter); |
| 3712 |
if ( cmapfilename==NULL ) |
| 3713 |
return; |
| 3714 |
MakeCIDMaster(fv->b.sf,fv->b.map,true,cmapfilename,NULL); |
| 3715 |
free(cmapfilename); |
| 3716 |
} |
| 3717 |
|
| 3718 |
static void FVMenuFlatten(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3719 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3720 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 3721 |
|
| 3722 |
if ( cidmaster==NULL ) |
| 3723 |
return; |
| 3724 |
SFFlatten(&cidmaster); |
| 3725 |
} |
| 3726 |
|
| 3727 |
static void FVMenuFlattenByCMap(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3728 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3729 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 3730 |
char *cmapname; |
| 3731 |
|
| 3732 |
if ( cidmaster==NULL ) |
| 3733 |
return; |
| 3734 |
cmapname = gwwv_open_filename(_("Find an adobe CMap file..."),NULL,NULL,CMapFilter); |
| 3735 |
if ( cmapname==NULL ) |
| 3736 |
return; |
| 3737 |
SFFindNearTop(fv->b.sf); |
| 3738 |
SFFlattenByCMap(&cidmaster,cmapname); |
| 3739 |
SFRestoreNearTop(fv->b.sf); |
| 3740 |
free(cmapname); |
| 3741 |
} |
| 3742 |
|
| 3743 |
static void FVMenuInsertFont(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3744 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3745 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 3746 |
SplineFont *new; |
| 3747 |
struct cidmap *map; |
| 3748 |
char *filename; |
| 3749 |
extern NameList *force_names_when_opening; |
| 3750 |
|
| 3751 |
if ( cidmaster==NULL || cidmaster->subfontcnt>=255 ) |
| 3752 |
return; |
| 3753 |
|
| 3754 |
filename = GetPostScriptFontName(NULL,false,true); |
| 3755 |
if ( filename==NULL ) |
| 3756 |
return; |
| 3757 |
new = LoadSplineFont(filename,0); |
| 3758 |
free(filename); |
| 3759 |
if ( new==NULL ) |
| 3760 |
return; |
| 3761 |
if ( new->fv == &fv->b ) |
| 3762 |
return; |
| 3763 |
if ( new->fv != NULL ) { |
| 3764 |
if ( ((FontView *) (new->fv))->gw!=NULL ) |
| 3765 |
GDrawRaise( ((FontView *) (new->fv))->gw); |
| 3766 |
ff_post_error(_("Please close font"),_("Please close %s before inserting it into a CID font"),new->origname); |
| 3767 |
return; |
| 3768 |
} |
| 3769 |
EncMapFree(new->map); |
| 3770 |
if ( force_names_when_opening!=NULL ) |
| 3771 |
SFRenameGlyphsToNamelist(new,force_names_when_opening ); |
| 3772 |
|
| 3773 |
map = FindCidMap(cidmaster->cidregistry,cidmaster->ordering,cidmaster->supplement,cidmaster); |
| 3774 |
SFEncodeToMap(new,map); |
| 3775 |
if ( !PSDictHasEntry(new->private_dict,"lenIV")) |
| 3776 |
PSDictChangeEntry(new->private_dict,"lenIV","1"); |
| 3777 |
new->display_antialias = fv->b.sf->display_antialias; |
| 3778 |
new->display_bbsized = fv->b.sf->display_bbsized; |
| 3779 |
new->display_size = fv->b.sf->display_size; |
| 3780 |
FVInsertInCID((FontViewBase *) fv,new); |
| 3781 |
CIDMasterAsDes(new); |
| 3782 |
} |
| 3783 |
|
| 3784 |
static void FVMenuInsertBlank(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3785 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3786 |
SplineFont *cidmaster = fv->b.cidmaster, *sf; |
| 3787 |
struct cidmap *map; |
| 3788 |
|
| 3789 |
if ( cidmaster==NULL || cidmaster->subfontcnt>=255 ) |
| 3790 |
return; |
| 3791 |
map = FindCidMap(cidmaster->cidregistry,cidmaster->ordering,cidmaster->supplement,cidmaster); |
| 3792 |
sf = SplineFontBlank(MaxCID(map)); |
| 3793 |
sf->glyphcnt = sf->glyphmax; |
| 3794 |
sf->cidmaster = cidmaster; |
| 3795 |
sf->display_antialias = fv->b.sf->display_antialias; |
| 3796 |
sf->display_bbsized = fv->b.sf->display_bbsized; |
| 3797 |
sf->display_size = fv->b.sf->display_size; |
| 3798 |
sf->private_dict = calloc(1,sizeof(struct psdict)); |
| 3799 |
PSDictChangeEntry(sf->private_dict,"lenIV","1"); |
| 3800 |
FVInsertInCID((FontViewBase *) fv,sf); |
| 3801 |
} |
| 3802 |
|
| 3803 |
static void FVMenuRemoveFontFromCID(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3804 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3805 |
char *buts[3]; |
| 3806 |
SplineFont *cidmaster = fv->b.cidmaster, *sf = fv->b.sf, *replace; |
| 3807 |
int i; |
| 3808 |
MetricsView *mv, *mnext; |
| 3809 |
FontView *fvs; |
| 3810 |
|
| 3811 |
if ( cidmaster==NULL || cidmaster->subfontcnt<=1 ) |
| 3812 |
return; |
| 3813 |
buts[0] = _("_Remove"); buts[1] = _("_Cancel"); buts[2] = NULL; |
| 3814 |
if ( gwwv_ask(_("_Remove Font"),(const char **) buts,0,1,_("Are you sure you wish to remove sub-font %1$.40s from the CID font %2$.40s"), |
| 3815 |
sf->fontname,cidmaster->fontname)==1 ) |
| 3816 |
return; |
| 3817 |
|
| 3818 |
for ( i=0; i<sf->glyphcnt; ++i ) if ( sf->glyphs[i]!=NULL ) { |
| 3819 |
CharView *cv, *next; |
| 3820 |
for ( cv = (CharView *) (sf->glyphs[i]->views); cv!=NULL; cv = next ) { |
| 3821 |
next = (CharView *) (cv->b.next); |
| 3822 |
GDrawDestroyWindow(cv->gw); |
| 3823 |
} |
| 3824 |
} |
| 3825 |
GDrawProcessPendingEvents(NULL); |
| 3826 |
for ( mv=fv->b.sf->metrics; mv!=NULL; mv = mnext ) { |
| 3827 |
mnext = mv->next; |
| 3828 |
GDrawDestroyWindow(mv->gw); |
| 3829 |
} |
| 3830 |
GDrawSync(NULL); |
| 3831 |
GDrawProcessPendingEvents(NULL); |
| 3832 |
|
| 3833 |
GDrawSync(NULL); |
| 3834 |
GDrawProcessPendingEvents(NULL); |
| 3835 |
|
| 3836 |
for ( i=0; i<cidmaster->subfontcnt; ++i ) |
| 3837 |
if ( cidmaster->subfonts[i]==sf ) |
| 3838 |
break; |
| 3839 |
replace = i==0?cidmaster->subfonts[1]:cidmaster->subfonts[i-1]; |
| 3840 |
while ( i<cidmaster->subfontcnt-1 ) { |
| 3841 |
cidmaster->subfonts[i] = cidmaster->subfonts[i+1]; |
| 3842 |
++i; |
| 3843 |
} |
| 3844 |
--cidmaster->subfontcnt; |
| 3845 |
|
| 3846 |
for ( fvs=(FontView *) (fv->b.sf->fv); fvs!=NULL; fvs=(FontView *) (fvs->b.nextsame) ) { |
| 3847 |
if ( fvs->b.sf==sf ) |
| 3848 |
CIDSetEncMap((FontViewBase *) fvs,replace); |
| 3849 |
} |
| 3850 |
FontViewReformatAll(fv->b.sf); |
| 3851 |
SplineFontFree(sf); |
| 3852 |
} |
| 3853 |
|
| 3854 |
static void FVMenuCIDFontInfo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3855 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3856 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 3857 |
|
| 3858 |
if ( cidmaster==NULL ) |
| 3859 |
return; |
| 3860 |
FontInfo(cidmaster,fv->b.active_layer,-1,false); |
| 3861 |
} |
| 3862 |
|
| 3863 |
static void FVMenuChangeSupplement(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3864 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3865 |
SplineFont *cidmaster = fv->b.cidmaster; |
| 3866 |
char buffer[20]; |
| 3867 |
char *ret, *end; |
| 3868 |
int supple; |
| 3869 |
|
| 3870 |
if ( cidmaster==NULL ) |
| 3871 |
return; |
| 3872 |
sprintf(buffer,"%d",cidmaster->supplement); |
| 3873 |
ret = gwwv_ask_string(_("Change Supplement..."),buffer,_("Please specify a new supplement for %.20s-%.20s"), |
| 3874 |
cidmaster->cidregistry,cidmaster->ordering); |
| 3875 |
if ( ret==NULL ) |
| 3876 |
return; |
| 3877 |
supple = strtol(ret,&end,10); |
| 3878 |
if ( *end!='\0' || supple<=0 ) { |
| 3879 |
free(ret); |
| 3880 |
ff_post_error( _("Bad Number"),_("Bad Number") ); |
| 3881 |
return; |
| 3882 |
} |
| 3883 |
free(ret); |
| 3884 |
if ( supple!=cidmaster->supplement ) { |
| 3885 |
|
| 3886 |
FindCidMap(cidmaster->cidregistry,cidmaster->ordering,supple,cidmaster); |
| 3887 |
cidmaster->supplement = supple; |
| 3888 |
FontViewSetTitle(fv); |
| 3889 |
} |
| 3890 |
} |
| 3891 |
|
| 3892 |
static SplineChar *FVFindACharInDisplay(FontView *fv) { |
| 3893 |
int start, end, enc, gid; |
| 3894 |
EncMap *map = fv->b.map; |
| 3895 |
SplineFont *sf = fv->b.sf; |
| 3896 |
SplineChar *sc; |
| 3897 |
|
| 3898 |
start = fv->rowoff*fv->colcnt; |
| 3899 |
end = start + fv->rowcnt*fv->colcnt; |
| 3900 |
for ( enc = start; enc<end && enc<map->enccount; ++enc ) { |
| 3901 |
if ( (gid=map->map[enc])!=-1 && (sc=sf->glyphs[gid])!=NULL ) |
| 3902 |
return( sc ); |
| 3903 |
} |
| 3904 |
return( NULL ); |
| 3905 |
} |
| 3906 |
|
| 3907 |
static void FVMenuReencode(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3908 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3909 |
Encoding *enc = NULL; |
| 3910 |
SplineChar *sc; |
| 3911 |
|
| 3912 |
sc = FVFindACharInDisplay(fv); |
| 3913 |
enc = FindOrMakeEncoding(mi->ti.userdata); |
| 3914 |
if ( enc==NULL ) { |
| 3915 |
IError("Known encoding could not be found"); |
| 3916 |
return; |
| 3917 |
} |
| 3918 |
FVReencode((FontViewBase *) fv,enc); |
| 3919 |
if ( sc!=NULL ) { |
| 3920 |
int enc = fv->b.map->backmap[sc->orig_pos]; |
| 3921 |
if ( enc!=-1 ) |
| 3922 |
FVScrollToChar(fv,enc); |
| 3923 |
} |
| 3924 |
} |
| 3925 |
|
| 3926 |
static void FVMenuForceEncode(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 3927 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3928 |
Encoding *enc = NULL; |
| 3929 |
int oldcnt = fv->b.map->enccount; |
| 3930 |
|
| 3931 |
enc = FindOrMakeEncoding(mi->ti.userdata); |
| 3932 |
if ( enc==NULL ) { |
| 3933 |
IError("Known encoding could not be found"); |
| 3934 |
return; |
| 3935 |
} |
| 3936 |
SFForceEncoding(fv->b.sf,fv->b.map,enc); |
| 3937 |
if ( oldcnt < fv->b.map->enccount ) { |
| 3938 |
fv->b.selected = realloc(fv->b.selected,fv->b.map->enccount); |
| 3939 |
memset(fv->b.selected+oldcnt,0,fv->b.map->enccount-oldcnt); |
| 3940 |
} |
| 3941 |
if ( fv->b.normal!=NULL ) { |
| 3942 |
EncMapFree(fv->b.normal); |
| 3943 |
if (fv->b.normal == fv->b.sf->map) { fv->b.sf->map = NULL; } |
| 3944 |
fv->b.normal = NULL; |
| 3945 |
} |
| 3946 |
SFReplaceEncodingBDFProps(fv->b.sf,fv->b.map); |
| 3947 |
FontViewSetTitle(fv); |
| 3948 |
FontViewReformatOne(&fv->b); |
| 3949 |
} |
| 3950 |
|
| 3951 |
static void FVMenuDisplayByGroups(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3952 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3953 |
|
| 3954 |
DisplayGroups(fv); |
| 3955 |
} |
| 3956 |
|
| 3957 |
static void FVMenuDefineGroups(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3958 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3959 |
|
| 3960 |
DefineGroups(fv); |
| 3961 |
} |
| 3962 |
|
| 3963 |
static void FVMenuMMValid(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3964 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3965 |
MMSet *mm = fv->b.sf->mm; |
| 3966 |
|
| 3967 |
if ( mm==NULL ) |
| 3968 |
return; |
| 3969 |
MMValid(mm,true); |
| 3970 |
} |
| 3971 |
|
| 3972 |
static void FVMenuCreateMM(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3973 |
MMWizard(NULL); |
| 3974 |
} |
| 3975 |
|
| 3976 |
static void FVMenuMMInfo(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3977 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3978 |
MMSet *mm = fv->b.sf->mm; |
| 3979 |
|
| 3980 |
if ( mm==NULL ) |
| 3981 |
return; |
| 3982 |
MMWizard(mm); |
| 3983 |
} |
| 3984 |
|
| 3985 |
static void FVMenuChangeMMBlend(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3986 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3987 |
MMSet *mm = fv->b.sf->mm; |
| 3988 |
|
| 3989 |
if ( mm==NULL || mm->apple ) |
| 3990 |
return; |
| 3991 |
MMChangeBlend(mm,fv,false); |
| 3992 |
} |
| 3993 |
|
| 3994 |
static void FVMenuBlendToNew(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 3995 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 3996 |
MMSet *mm = fv->b.sf->mm; |
| 3997 |
|
| 3998 |
if ( mm==NULL ) |
| 3999 |
return; |
| 4000 |
MMChangeBlend(mm,fv,true); |
| 4001 |
} |
| 4002 |
|
| 4003 |
static void cflistcheck(GWindow UNUSED(gw), struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4004 |
|
| 4005 |
|
| 4006 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4007 |
switch ( mi->mid ) { |
| 4008 |
case FV_MID_AllFonts: |
| 4009 |
mi->ti.checked = !onlycopydisplayed; |
| 4010 |
break; |
| 4011 |
case FV_MID_DisplayedFont: |
| 4012 |
mi->ti.checked = onlycopydisplayed; |
| 4013 |
break; |
| 4014 |
case FV_MID_CharName: |
| 4015 |
mi->ti.checked = copymetadata; |
| 4016 |
break; |
| 4017 |
case FV_MID_TTFInstr: |
| 4018 |
mi->ti.checked = copyttfinstr; |
| 4019 |
break; |
| 4020 |
} |
| 4021 |
} |
| 4022 |
} |
| 4023 |
|
| 4024 |
static void sllistcheck(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4025 |
} |
| 4026 |
|
| 4027 |
static void htlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4028 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4029 |
int anychars = FVAnyCharSelected(fv); |
| 4030 |
int multilayer = fv->b.sf->multilayer; |
| 4031 |
|
| 4032 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4033 |
switch ( mi->mid ) { |
| 4034 |
case FV_MID_AutoHint: |
| 4035 |
mi->ti.disabled = anychars==-1 || multilayer; |
| 4036 |
break; |
| 4037 |
case FV_MID_HintSubsPt: |
| 4038 |
mi->ti.disabled = fv->b.sf->layers[fv->b.active_layer].order2 || anychars==-1 || multilayer; |
| 4039 |
if ( fv->b.sf->mm!=NULL && fv->b.sf->mm->apple ) |
| 4040 |
mi->ti.disabled = true; |
| 4041 |
break; |
| 4042 |
case FV_MID_AutoCounter: case FV_MID_DontAutoHint: |
| 4043 |
mi->ti.disabled = fv->b.sf->layers[fv->b.active_layer].order2 || anychars==-1 || multilayer; |
| 4044 |
break; |
| 4045 |
case FV_MID_AutoInstr: case FV_MID_EditInstructions: case FV_MID_Deltas: |
| 4046 |
mi->ti.disabled = !fv->b.sf->layers[fv->b.active_layer].order2 || anychars==-1 || multilayer; |
| 4047 |
break; |
| 4048 |
case FV_MID_RmInstrTables: |
| 4049 |
mi->ti.disabled = fv->b.sf->ttf_tables==NULL; |
| 4050 |
break; |
| 4051 |
case FV_MID_Editfpgm: case FV_MID_Editprep: case FV_MID_Editcvt: case FV_MID_Editmaxp: |
| 4052 |
mi->ti.disabled = !fv->b.sf->layers[fv->b.active_layer].order2 || multilayer; |
| 4053 |
break; |
| 4054 |
case FV_MID_ClearHints: case FV_MID_ClearWidthMD: case FV_MID_ClearInstrs: |
| 4055 |
mi->ti.disabled = anychars==-1; |
| 4056 |
break; |
| 4057 |
} |
| 4058 |
} |
| 4059 |
} |
| 4060 |
|
| 4061 |
static void fllistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4062 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4063 |
int anychars = FVAnyCharSelected(fv); |
| 4064 |
FontView *fvs; |
| 4065 |
int in_modal = (fv->b.container!=NULL && fv->b.container->funcs->is_modal); |
| 4066 |
|
| 4067 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4068 |
switch ( mi->mid ) { |
| 4069 |
case FV_MID_GenerateTTC: |
| 4070 |
for ( fvs=fv_list; fvs!=NULL; fvs=(FontView *) (fvs->b.next) ) { |
| 4071 |
if ( fvs!=fv ) |
| 4072 |
break; |
| 4073 |
} |
| 4074 |
mi->ti.disabled = fvs==NULL; |
| 4075 |
break; |
| 4076 |
case FV_MID_Revert: |
| 4077 |
mi->ti.disabled = fv->b.sf->origname==NULL || fv->b.sf->isnew; |
| 4078 |
break; |
| 4079 |
case FV_MID_RevertToBackup: |
| 4080 |
|
| 4081 |
mi->ti.disabled = true; |
| 4082 |
if ( fv->b.sf->filename!=NULL ) { |
| 4083 |
if ( fv->b.sf->backedup == bs_dontknow ) { |
| 4084 |
char *buf = malloc(strlen(fv->b.sf->filename)+20); |
| 4085 |
strcpy(buf,fv->b.sf->filename); |
| 4086 |
if ( fv->b.sf->compression!=0 ) |
| 4087 |
strcat(buf,ff_compression_ext(ff_compression_from_legacy(fv->b.sf->compression))); |
| 4088 |
strcat(buf,"~"); |
| 4089 |
if ( access(buf,F_OK)==0 ) |
| 4090 |
fv->b.sf->backedup = bs_backedup; |
| 4091 |
else |
| 4092 |
fv->b.sf->backedup = bs_not; |
| 4093 |
free(buf); |
| 4094 |
} |
| 4095 |
if ( fv->b.sf->backedup == bs_backedup ) |
| 4096 |
mi->ti.disabled = false; |
| 4097 |
} |
| 4098 |
break; |
| 4099 |
case FV_MID_RevertGlyph: |
| 4100 |
mi->ti.disabled = fv->b.sf->origname==NULL || fv->b.sf->sfd_version<2 || anychars==-1 || fv->b.sf->compression!=0; |
| 4101 |
break; |
| 4102 |
case FV_MID_Recent: |
| 4103 |
mi->ti.disabled = !RecentFilesAny(); |
| 4104 |
break; |
| 4105 |
case FV_MID_ScriptMenu: |
| 4106 |
mi->ti.disabled = script_menu_names[0]==NULL; |
| 4107 |
break; |
| 4108 |
case FV_MID_Print: |
| 4109 |
mi->ti.disabled = fv->b.sf->onlybitmaps || in_modal; |
| 4110 |
break; |
| 4111 |
} |
| 4112 |
} |
| 4113 |
} |
| 4114 |
|
| 4115 |
static void edlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4116 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4117 |
int pos = FVAnyCharSelected(fv), i, gid; |
| 4118 |
int not_pasteable = pos==-1 || |
| 4119 |
(!CopyContainsSomething() && !SCClipboardHasPasteableContents()); |
| 4120 |
RefChar *base = CopyContainsRef(fv->b.sf); |
| 4121 |
int base_enc = base!=NULL ? fv->b.map->backmap[base->orig_pos] : -1; |
| 4122 |
|
| 4123 |
|
| 4124 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4125 |
switch ( mi->mid ) { |
| 4126 |
case FV_MID_Paste: case FV_MID_PasteInto: |
| 4127 |
mi->ti.disabled = not_pasteable; |
| 4128 |
break; |
| 4129 |
case FV_MID_PasteAfter: |
| 4130 |
mi->ti.disabled = not_pasteable || pos<0; |
| 4131 |
break; |
| 4132 |
case FV_MID_SameGlyphAs: |
| 4133 |
mi->ti.disabled = not_pasteable || base==NULL || fv->b.cidmaster!=NULL || |
| 4134 |
base_enc==-1 || |
| 4135 |
fv->b.selected[base_enc]; |
| 4136 |
break; |
| 4137 |
case FV_MID_Join: |
| 4138 |
case FV_MID_Cut: case FV_MID_Copy: case FV_MID_Clear: |
| 4139 |
case FV_MID_CopyWidth: case FV_MID_CopyLBearing: case FV_MID_CopyRBearing: |
| 4140 |
case FV_MID_CopyRef: case FV_MID_UnlinkRef: |
| 4141 |
case FV_MID_RemoveUndoes: case FV_MID_CopyFgToBg: case FV_MID_CopyL2L: |
| 4142 |
mi->ti.disabled = pos==-1; |
| 4143 |
break; |
| 4144 |
case FV_MID_RplRef: |
| 4145 |
case FV_MID_CorrectRefs: |
| 4146 |
mi->ti.disabled = pos==-1 || fv->b.cidmaster!=NULL || fv->b.sf->multilayer; |
| 4147 |
break; |
| 4148 |
case FV_MID_CopyLookupData: |
| 4149 |
mi->ti.disabled = pos==-1 || (fv->b.sf->gpos_lookups==NULL && fv->b.sf->gsub_lookups==NULL); |
| 4150 |
break; |
| 4151 |
case FV_MID_CopyVWidth: |
| 4152 |
mi->ti.disabled = pos==-1 || !fv->b.sf->hasvmetrics; |
| 4153 |
break; |
| 4154 |
case FV_MID_ClearBackground: |
| 4155 |
mi->ti.disabled = true; |
| 4156 |
if ( pos!=-1 && !( onlycopydisplayed && fv->filled!=fv->show )) { |
| 4157 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 4158 |
if ( fv->b.selected[i] && (gid = fv->b.map->map[i])!=-1 && |
| 4159 |
fv->b.sf->glyphs[gid]!=NULL ) |
| 4160 |
if ( fv->b.sf->glyphs[gid]->layers[ly_back].images!=NULL || |
| 4161 |
fv->b.sf->glyphs[gid]->layers[ly_back].splines!=NULL ) { |
| 4162 |
mi->ti.disabled = false; |
| 4163 |
break; |
| 4164 |
} |
| 4165 |
} |
| 4166 |
break; |
| 4167 |
case FV_MID_Undo: |
| 4168 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 4169 |
if ( fv->b.selected[i] && (gid = fv->b.map->map[i])!=-1 && |
| 4170 |
fv->b.sf->glyphs[gid]!=NULL ) |
| 4171 |
if ( fv->b.sf->glyphs[gid]->layers[fv->b.active_layer].undoes!=NULL ) |
| 4172 |
break; |
| 4173 |
mi->ti.disabled = i==fv->b.map->enccount; |
| 4174 |
break; |
| 4175 |
case FV_MID_Redo: |
| 4176 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 4177 |
if ( fv->b.selected[i] && (gid = fv->b.map->map[i])!=-1 && |
| 4178 |
fv->b.sf->glyphs[gid]!=NULL ) |
| 4179 |
if ( fv->b.sf->glyphs[gid]->layers[fv->b.active_layer].redoes!=NULL ) |
| 4180 |
break; |
| 4181 |
mi->ti.disabled = i==fv->b.map->enccount; |
| 4182 |
break; |
| 4183 |
case FV_MID_UndoFontLevel: |
| 4184 |
mi->ti.disabled = dlist_isempty( (struct dlistnode **)&fv->b.sf->undoes ); |
| 4185 |
break; |
| 4186 |
} |
| 4187 |
} |
| 4188 |
} |
| 4189 |
|
| 4190 |
static void trlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4191 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4192 |
int anychars = FVAnyCharSelected(fv); |
| 4193 |
|
| 4194 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4195 |
switch ( mi->mid ) { |
| 4196 |
case FV_MID_Transform: |
| 4197 |
mi->ti.disabled = anychars==-1; |
| 4198 |
break; |
| 4199 |
case FV_MID_NLTransform: case FV_MID_POV: |
| 4200 |
mi->ti.disabled = anychars==-1 || fv->b.sf->onlybitmaps; |
| 4201 |
break; |
| 4202 |
} |
| 4203 |
} |
| 4204 |
} |
| 4205 |
|
| 4206 |
static void validlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4207 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4208 |
int anychars = FVAnyCharSelected(fv); |
| 4209 |
|
| 4210 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4211 |
switch ( mi->mid ) { |
| 4212 |
case FV_MID_FindProblems: |
| 4213 |
mi->ti.disabled = anychars==-1; |
| 4214 |
break; |
| 4215 |
case FV_MID_Validate: |
| 4216 |
mi->ti.disabled = fv->b.sf->strokedfont || fv->b.sf->multilayer; |
| 4217 |
break; |
| 4218 |
} |
| 4219 |
} |
| 4220 |
} |
| 4221 |
|
| 4222 |
static void ellistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4223 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4224 |
int anychars = FVAnyCharSelected(fv), gid; |
| 4225 |
int anybuildable, anytraceable; |
| 4226 |
int in_modal = (fv->b.container!=NULL && fv->b.container->funcs->is_modal); |
| 4227 |
|
| 4228 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4229 |
switch ( mi->mid ) { |
| 4230 |
case FV_MID_FontInfo: |
| 4231 |
mi->ti.disabled = in_modal; |
| 4232 |
break; |
| 4233 |
case FV_MID_CharInfo: |
| 4234 |
mi->ti.disabled = anychars<0 || in_modal; |
| 4235 |
break; |
| 4236 |
case FV_MID_Transform: |
| 4237 |
mi->ti.disabled = anychars==-1; |
| 4238 |
|
| 4239 |
break; |
| 4240 |
case FV_MID_AddExtrema: case FV_MID_AddInflections: |
| 4241 |
case FV_MID_Harmonize: case FV_MID_Simplify: |
| 4242 |
case FV_MID_Stroke: case FV_MID_RmOverlap: case FV_MID_Styles: |
| 4243 |
case FV_MID_Round: case FV_MID_Correct: |
| 4244 |
mi->ti.disabled = anychars==-1 || fv->b.sf->onlybitmaps; |
| 4245 |
break; |
| 4246 |
case FV_MID_Balance: |
| 4247 |
mi->ti.disabled = anychars==-1 || fv->b.sf->onlybitmaps |
| 4248 |
|| fv->b.sf->layers[fv->b.active_layer].order2; |
| 4249 |
break; |
| 4250 |
#ifdef FONTFORGE_CONFIG_TILEPATH |
| 4251 |
case FV_MID_TilePath: |
| 4252 |
mi->ti.disabled = anychars==-1 || fv->b.sf->onlybitmaps; |
| 4253 |
break; |
| 4254 |
#endif |
| 4255 |
case FV_MID_AvailBitmaps: |
| 4256 |
mi->ti.disabled = fv->b.sf->mm!=NULL; |
| 4257 |
break; |
| 4258 |
case FV_MID_RegenBitmaps: case FV_MID_RemoveBitmaps: |
| 4259 |
mi->ti.disabled = fv->b.sf->bitmaps==NULL || fv->b.sf->onlybitmaps || |
| 4260 |
fv->b.sf->mm!=NULL; |
| 4261 |
break; |
| 4262 |
case FV_MID_BuildAccent: |
| 4263 |
anybuildable = false; |
| 4264 |
if ( anychars!=-1 ) { |
| 4265 |
int i; |
| 4266 |
for ( i=0; i<fv->b.map->enccount; ++i ) if ( fv->b.selected[i] ) { |
| 4267 |
SplineChar *sc=NULL, dummy; |
| 4268 |
gid = fv->b.map->map[i]; |
| 4269 |
if ( gid!=-1 ) |
| 4270 |
sc = fv->b.sf->glyphs[gid]; |
| 4271 |
if ( sc==NULL ) |
| 4272 |
sc = SCBuildDummy(&dummy,fv->b.sf,fv->b.map,i); |
| 4273 |
if ( SFIsSomethingBuildable(fv->b.sf,sc,fv->b.active_layer,false) || |
| 4274 |
SFIsDuplicatable(fv->b.sf,sc)) { |
| 4275 |
anybuildable = true; |
| 4276 |
break; |
| 4277 |
} |
| 4278 |
} |
| 4279 |
} |
| 4280 |
mi->ti.disabled = !anybuildable; |
| 4281 |
break; |
| 4282 |
case FV_MID_Autotrace: |
| 4283 |
anytraceable = false; |
| 4284 |
if ( FindAutoTraceName()!=NULL && anychars!=-1 ) { |
| 4285 |
int i; |
| 4286 |
for ( i=0; i<fv->b.map->enccount; ++i ) |
| 4287 |
if ( fv->b.selected[i] && (gid = fv->b.map->map[i])!=-1 && |
| 4288 |
fv->b.sf->glyphs[gid]!=NULL && |
| 4289 |
fv->b.sf->glyphs[gid]->layers[ly_back].images!=NULL ) { |
| 4290 |
anytraceable = true; |
| 4291 |
break; |
| 4292 |
} |
| 4293 |
} |
| 4294 |
mi->ti.disabled = !anytraceable; |
| 4295 |
break; |
| 4296 |
case FV_MID_MergeFonts: |
| 4297 |
mi->ti.disabled = fv->b.sf->bitmaps!=NULL && fv->b.sf->onlybitmaps; |
| 4298 |
break; |
| 4299 |
case FV_MID_FontCompare: |
| 4300 |
mi->ti.disabled = fv_list->b.next==NULL; |
| 4301 |
break; |
| 4302 |
case FV_MID_InterpolateFonts: |
| 4303 |
mi->ti.disabled = fv->b.sf->onlybitmaps; |
| 4304 |
break; |
| 4305 |
} |
| 4306 |
} |
| 4307 |
} |
| 4308 |
|
| 4309 |
static void mtlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4310 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4311 |
int anychars = FVAnyCharSelected(fv); |
| 4312 |
|
| 4313 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4314 |
switch ( mi->mid ) { |
| 4315 |
case FV_MID_Center: case FV_MID_Thirds: case FV_MID_SetWidth: |
| 4316 |
case FV_MID_SetLBearing: case FV_MID_SetRBearing: case FV_MID_SetBearings: |
| 4317 |
mi->ti.disabled = anychars==-1; |
| 4318 |
break; |
| 4319 |
case FV_MID_SetVWidth: |
| 4320 |
mi->ti.disabled = anychars==-1 || !fv->b.sf->hasvmetrics; |
| 4321 |
break; |
| 4322 |
case FV_MID_VKernByClass: |
| 4323 |
case FV_MID_VKernFromH: |
| 4324 |
case FV_MID_RmVKern: |
| 4325 |
mi->ti.disabled = !fv->b.sf->hasvmetrics; |
| 4326 |
break; |
| 4327 |
} |
| 4328 |
} |
| 4329 |
} |
| 4330 |
|
| 4331 |
#if HANYANG |
| 4332 |
static void hglistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4333 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4334 |
|
| 4335 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4336 |
if ( mi->mid==FV_MID_BuildSyllables || mi->mid==FV_MID_ModifyComposition ) |
| 4337 |
mi->ti.disabled = fv->b.sf->rules==NULL; |
| 4338 |
} |
| 4339 |
} |
| 4340 |
|
| 4341 |
static GMenuItem2 hglist[] = { |
| 4342 |
{ { (unichar_t *) N_("_New Composition..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'N' }, H_("New Composition...|No Shortcut"), NULL, NULL, MenuNewComposition }, |
| 4343 |
{ { (unichar_t *) N_("_Modify Composition..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("Modify Composition...|No Shortcut"), NULL, NULL, FVMenuModifyComposition, FV_MID_ModifyComposition }, |
| 4344 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, }}, |
| 4345 |
{ { (unichar_t *) N_("_Build Syllables"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Build Syllables|No Shortcut"), NULL, NULL, FVMenuBuildSyllables, FV_MID_BuildSyllables }, |
| 4346 |
{ NULL } |
| 4347 |
}; |
| 4348 |
#endif |
| 4349 |
|
| 4350 |
static void balistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4351 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4352 |
|
| 4353 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4354 |
if ( mi->mid==FV_MID_BuildAccent || mi->mid==FV_MID_BuildComposite ) { |
| 4355 |
int anybuildable = false; |
| 4356 |
int onlyaccents = mi->mid==FV_MID_BuildAccent; |
| 4357 |
int i, gid; |
| 4358 |
for ( i=0; i<fv->b.map->enccount; ++i ) if ( fv->b.selected[i] ) { |
| 4359 |
SplineChar *sc=NULL, dummy; |
| 4360 |
if ( (gid=fv->b.map->map[i])!=-1 ) |
| 4361 |
sc = fv->b.sf->glyphs[gid]; |
| 4362 |
if ( sc==NULL ) |
| 4363 |
sc = SCBuildDummy(&dummy,fv->b.sf,fv->b.map,i); |
| 4364 |
if ( SFIsSomethingBuildable(fv->b.sf,sc,fv->b.active_layer,onlyaccents)) { |
| 4365 |
anybuildable = true; |
| 4366 |
break; |
| 4367 |
} |
| 4368 |
} |
| 4369 |
mi->ti.disabled = !anybuildable; |
| 4370 |
} else if ( mi->mid==FV_MID_BuildDuplicates ) { |
| 4371 |
int anybuildable = false; |
| 4372 |
int i, gid; |
| 4373 |
for ( i=0; i<fv->b.map->enccount; ++i ) if ( fv->b.selected[i] ) { |
| 4374 |
SplineChar *sc=NULL, dummy; |
| 4375 |
if ( (gid=fv->b.map->map[i])!=-1 ) |
| 4376 |
sc = fv->b.sf->glyphs[gid]; |
| 4377 |
if ( sc==NULL ) |
| 4378 |
sc = SCBuildDummy(&dummy,fv->b.sf,fv->b.map,i); |
| 4379 |
if ( SFIsDuplicatable(fv->b.sf,sc)) { |
| 4380 |
anybuildable = true; |
| 4381 |
break; |
| 4382 |
} |
| 4383 |
} |
| 4384 |
mi->ti.disabled = !anybuildable; |
| 4385 |
} |
| 4386 |
} |
| 4387 |
} |
| 4388 |
|
| 4389 |
static void delistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4390 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4391 |
int i = FVAnyCharSelected(fv); |
| 4392 |
int gid = i<0 ? -1 : fv->b.map->map[i]; |
| 4393 |
|
| 4394 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4395 |
switch ( mi->mid ) { |
| 4396 |
case FV_MID_ShowDependentRefs: |
| 4397 |
mi->ti.disabled = gid<0 || fv->b.sf->glyphs[gid]==NULL || |
| 4398 |
fv->b.sf->glyphs[gid]->dependents == NULL; |
| 4399 |
break; |
| 4400 |
case FV_MID_ShowDependentSubs: |
| 4401 |
mi->ti.disabled = gid<0 || fv->b.sf->glyphs[gid]==NULL || |
| 4402 |
!SCUsedBySubs(fv->b.sf->glyphs[gid]); |
| 4403 |
break; |
| 4404 |
} |
| 4405 |
} |
| 4406 |
} |
| 4407 |
|
| 4408 |
static void infolistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4409 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4410 |
int anychars = FVAnyCharSelected(fv); |
| 4411 |
|
| 4412 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4413 |
switch ( mi->mid ) { |
| 4414 |
case FV_MID_StrikeInfo: |
| 4415 |
mi->ti.disabled = fv->b.sf->bitmaps==NULL; |
| 4416 |
break; |
| 4417 |
case FV_MID_MassRename: |
| 4418 |
mi->ti.disabled = anychars==-1; |
| 4419 |
break; |
| 4420 |
case FV_MID_SetColor: |
| 4421 |
mi->ti.disabled = anychars==-1; |
| 4422 |
break; |
| 4423 |
} |
| 4424 |
} |
| 4425 |
} |
| 4426 |
|
| 4427 |
static GMenuItem2 dummyitem[] = { |
| 4428 |
{ { (unichar_t *) N_("Font|_New"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'N' }, NULL, NULL, NULL, NULL, 0 }, |
| 4429 |
GMENUITEM2_EMPTY |
| 4430 |
}; |
| 4431 |
|
| 4432 |
static GMenuItem2 fllist[] = { |
| 4433 |
{ { (unichar_t *) N_("Font|_New"), (GImage *) "filenew.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'N' }, H_("New|No Shortcut"), NULL, NULL, MenuNew, 0 }, |
| 4434 |
#if HANYANG |
| 4435 |
{ { (unichar_t *) N_("_Hangul"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("Hangul|No Shortcut"), hglist, hglistcheck, NULL, 0 }, |
| 4436 |
#endif |
| 4437 |
{ { (unichar_t *) N_("_Open"), (GImage *) "fileopen.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'O' }, H_("Open|No Shortcut"), NULL, NULL, FVMenuOpen, 0 }, |
| 4438 |
{ { (unichar_t *) N_("Recen_t"), (GImage *) "filerecent.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 't' }, H_("Recent|No Shortcut"), dummyitem, MenuRecentBuild, NULL, FV_MID_Recent }, |
| 4439 |
{ { (unichar_t *) N_("_Close"), (GImage *) "fileclose.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Close|No Shortcut"), NULL, NULL, FVMenuClose, 0 }, |
| 4440 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4441 |
{ { (unichar_t *) N_("_Save"), (GImage *) "filesave.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Save|No Shortcut"), NULL, NULL, FVMenuSave, 0 }, |
| 4442 |
{ { (unichar_t *) N_("S_ave as..."), (GImage *) "filesaveas.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'a' }, H_("Save as...|No Shortcut"), NULL, NULL, FVMenuSaveAs, 0 }, |
| 4443 |
{ { (unichar_t *) N_("Save A_ll"), (GImage *) "filesaveall.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, H_("Save All|No Shortcut"), NULL, NULL, MenuSaveAll, 0 }, |
| 4444 |
{ { (unichar_t *) N_("_Generate Fonts..."), (GImage *) "filegenerate.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'G' }, H_("Generate Fonts...|No Shortcut"), NULL, NULL, FVMenuGenerate, 0 }, |
| 4445 |
{ { (unichar_t *) N_("Generate Mac _Family..."), (GImage *) "filegeneratefamily.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Generate Mac Family...|No Shortcut"), NULL, NULL, FVMenuGenerateFamily, 0 }, |
| 4446 |
{ { (unichar_t *) N_("Generate TTC..."), (GImage *) "filegeneratefamily.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Generate TTC...|No Shortcut"), NULL, NULL, FVMenuGenerateTTC, FV_MID_GenerateTTC }, |
| 4447 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4448 |
{ { (unichar_t *) N_("_Import..."), (GImage *) "fileimport.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Import...|No Shortcut"), NULL, NULL, FVMenuImport, 0 }, |
| 4449 |
{ { (unichar_t *) N_("_Merge Feature Info..."), (GImage *) "filemergefeature.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("Merge Feature Info...|No Shortcut"), NULL, NULL, FVMenuMergeKern, 0 }, |
| 4450 |
{ { (unichar_t *) N_("_Revert File"), (GImage *) "filerevert.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Revert File|No Shortcut"), NULL, NULL, FVMenuRevert, FV_MID_Revert }, |
| 4451 |
{ { (unichar_t *) N_("Revert To _Backup"), (GImage *) "filerevertbackup.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Revert To Backup|No Shortcut"), NULL, NULL, FVMenuRevertBackup, FV_MID_RevertToBackup }, |
| 4452 |
{ { (unichar_t *) N_("Revert Gl_yph"), (GImage *) "filerevertglyph.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Revert Glyph|No Shortcut"), NULL, NULL, FVMenuRevertGlyph, FV_MID_RevertGlyph }, |
| 4453 |
{ { (unichar_t *) N_("Clear Special Data"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Clear Special Data|No Shortcut"), NULL, NULL, FVMenuClearSpecialData, FV_MID_ClearSpecialData }, |
| 4454 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4455 |
{ { (unichar_t *) N_("_Print..."), (GImage *) "fileprint.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Print...|No Shortcut"), NULL, NULL, FVMenuPrint, FV_MID_Print }, |
| 4456 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4457 |
#if !defined(_NO_PYTHON) |
| 4458 |
{ { (unichar_t *) N_("E_xecute Script..."), (GImage *) "python.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'x' }, H_("Execute Script...|No Shortcut"), NULL, NULL, FVMenuExecute, 0 }, |
| 4459 |
#elif !defined(_NO_FFSCRIPT) |
| 4460 |
{ { (unichar_t *) N_("E_xecute Script..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'x' }, H_("Execute Script...|No Shortcut"), NULL, NULL, FVMenuExecute, 0 }, |
| 4461 |
#endif |
| 4462 |
#if !defined(_NO_FFSCRIPT) |
| 4463 |
{ { (unichar_t *) N_("Script Menu"), (GImage *) "fileexecute.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'r' }, H_("Script Menu|No Shortcut"), dummyitem, MenuScriptsBuild, NULL, FV_MID_ScriptMenu }, |
| 4464 |
#endif |
| 4465 |
#if !defined(_NO_FFSCRIPT) || !defined(_NO_PYTHON) |
| 4466 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4467 |
#endif |
| 4468 |
{ { (unichar_t *) N_("Pr_eferences..."), (GImage *) "fileprefs.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'e' }, H_("Preferences...|No Shortcut"), NULL, NULL, MenuPrefs, 0 }, |
| 4469 |
{ { (unichar_t *) N_("Appea_rance Editor..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'e' }, H_("Appearance Editor...|No Shortcut"), NULL, NULL, MenuXRes, 0 }, |
| 4470 |
#ifndef _NO_PYTHON |
| 4471 |
{ { (unichar_t *) N_("Config_ure Plugins..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'u' }, H_("Configure Plugins...|No Shortcut"), NULL, NULL, MenuPlug, 0 }, |
| 4472 |
#endif |
| 4473 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4474 |
{ { (unichar_t *) N_("_Quit"), (GImage *) "filequit.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'Q' }, H_("Quit|Ctl+Q"), |
| 4475 |
NULL, NULL, FVMenuExit, 0 }, |
| 4476 |
GMENUITEM2_EMPTY |
| 4477 |
}; |
| 4478 |
|
| 4479 |
static GMenuItem2 cflist[] = { |
| 4480 |
{ { (unichar_t *) N_("_All Fonts"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'A' }, H_("All Fonts|No Shortcut"), NULL, NULL, FVMenuCopyFrom, FV_MID_AllFonts }, |
| 4481 |
{ { (unichar_t *) N_("_Displayed Font"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'D' }, H_("Displayed Font|No Shortcut"), NULL, NULL, FVMenuCopyFrom, FV_MID_DisplayedFont }, |
| 4482 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4483 |
{ { (unichar_t *) N_("Glyph _Metadata"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'N' }, H_("Glyph Metadata|No Shortcut"), NULL, NULL, FVMenuCopyFrom, FV_MID_CharName }, |
| 4484 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4485 |
{ { (unichar_t *) N_("_TrueType Instructions"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'N' }, H_("TrueType Instructions|No Shortcut"), NULL, NULL, FVMenuCopyFrom, FV_MID_TTFInstr }, |
| 4486 |
GMENUITEM2_EMPTY |
| 4487 |
}; |
| 4488 |
|
| 4489 |
static GMenuItem2 sclist[] = { |
| 4490 |
{ { (unichar_t *) N_("Color|Choose..."), (GImage *)"colorwheel.png", COLOR_DEFAULT, COLOR_DEFAULT, (void *) -10, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Choose...|No Shortcut"), NULL, NULL, FVMenuSelectColor, 0 }, |
| 4491 |
{ { (unichar_t *) N_("Color|Default"), &def_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) COLOR_DEFAULT, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Default|No Shortcut"), NULL, NULL, FVMenuSelectColor, 0 }, |
| 4492 |
{ { NULL, &white_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xffffff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSelectColor, 0 }, |
| 4493 |
{ { NULL, &red_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xff0000, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSelectColor, 0 }, |
| 4494 |
{ { NULL, &green_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0x00ff00, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSelectColor, 0 }, |
| 4495 |
{ { NULL, &blue_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0x0000ff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSelectColor, 0 }, |
| 4496 |
{ { NULL, &yellow_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xffff00, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSelectColor, 0 }, |
| 4497 |
{ { NULL, &cyan_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0x00ffff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSelectColor, 0 }, |
| 4498 |
{ { NULL, &magenta_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xff00ff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSelectColor, 0 }, |
| 4499 |
GMENUITEM2_EMPTY |
| 4500 |
}; |
| 4501 |
|
| 4502 |
static GMenuItem2 sllist[] = { |
| 4503 |
{ { (unichar_t *) N_("Select _All"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'A' }, H_("Select All|No Shortcut"), NULL, NULL, FVMenuSelectAll, 0 }, |
| 4504 |
{ { (unichar_t *) N_("_Invert Selection"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Invert Selection|No Shortcut"), NULL, NULL, FVMenuInvertSelection, 0 }, |
| 4505 |
{ { (unichar_t *) N_("_Deselect All"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Deselect All|Escape"), NULL, NULL, FVMenuDeselectAll, 0 }, |
| 4506 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4507 |
{ { (unichar_t *) N_("Select by _Color"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Select by Color|No Shortcut"), sclist, NULL, NULL, 0 }, |
| 4508 |
{ { (unichar_t *) N_("Select by _Wildcard..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Select by Wildcard...|No Shortcut"), NULL, NULL, FVMenuSelectByName, 0 }, |
| 4509 |
{ { (unichar_t *) N_("Select by _Script..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Select by Script...|No Shortcut"), NULL, NULL, FVMenuSelectByScript, 0 }, |
| 4510 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4511 |
{ { (unichar_t *) N_("_Glyphs Worth Outputting"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Glyphs Worth Outputting|No Shortcut"), NULL,NULL, FVMenuSelectWorthOutputting, 0 }, |
| 4512 |
{ { (unichar_t *) N_("Glyphs with only _References"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Glyphs with only References|No Shortcut"), NULL,NULL, FVMenuGlyphsRefs, 0 }, |
| 4513 |
{ { (unichar_t *) N_("Glyphs with only S_plines"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Glyphs with only Splines|No Shortcut"), NULL,NULL, FVMenuGlyphsSplines, 0 }, |
| 4514 |
{ { (unichar_t *) N_("Glyphs with both"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Glyphs with both|No Shortcut"), NULL,NULL, FVMenuGlyphsBoth, 0 }, |
| 4515 |
{ { (unichar_t *) N_("W_hitespace Glyphs"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Whitespace Glyphs|No Shortcut"), NULL,NULL, FVMenuGlyphsWhite, 0 }, |
| 4516 |
{ { (unichar_t *) N_("_Changed Glyphs"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Changed Glyphs|No Shortcut"), NULL,NULL, FVMenuSelectChanged, 0 }, |
| 4517 |
{ { (unichar_t *) N_("_Hinting Needed"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Hinting Needed|No Shortcut"), NULL,NULL, FVMenuSelectHintingNeeded, 0 }, |
| 4518 |
{ { (unichar_t *) N_("Autohinta_ble"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Autohintable|No Shortcut"), NULL,NULL, FVMenuSelectAutohintable, 0 }, |
| 4519 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4520 |
{ { (unichar_t *) N_("Hold [Shift] key to merge"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 1, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4521 |
{ { (unichar_t *) N_("Hold [Control] key to restrict"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 1, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4522 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4523 |
{ { (unichar_t *) N_("Selec_t By Lookup Subtable..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, H_("Select By Lookup Subtable...|No Shortcut"), NULL, NULL, FVMenuSelectByPST, 0 }, |
| 4524 |
GMENUITEM2_EMPTY |
| 4525 |
}; |
| 4526 |
|
| 4527 |
static GMenuItem2 edlist[] = { |
| 4528 |
{ { (unichar_t *) N_("_Undo"), (GImage *) "editundo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'U' }, H_("Undo|No Shortcut"), NULL, NULL, FVMenuUndo, FV_MID_Undo }, |
| 4529 |
{ { (unichar_t *) N_("_Redo"), (GImage *) "editredo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Redo|No Shortcut"), NULL, NULL, FVMenuRedo, FV_MID_Redo}, |
| 4530 |
{ { (unichar_t *) N_("Undo Fontlevel"), (GImage *) "editundo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'U' }, H_("Undo Fontlevel|No Shortcut"), NULL, NULL, FVMenuUndoFontLevel, FV_MID_UndoFontLevel }, |
| 4531 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4532 |
{ { (unichar_t *) N_("Cu_t"), (GImage *) "editcut.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 't' }, H_("Cut|No Shortcut"), NULL, NULL, FVMenuCut, FV_MID_Cut }, |
| 4533 |
{ { (unichar_t *) N_("_Copy"), (GImage *) "editcopy.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Copy|No Shortcut"), NULL, NULL, FVMenuCopy, FV_MID_Copy }, |
| 4534 |
{ { (unichar_t *) N_("C_opy Reference"), (GImage *) "editcopyref.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Copy Reference|No Shortcut"), NULL, NULL, FVMenuCopyRef, FV_MID_CopyRef }, |
| 4535 |
{ { (unichar_t *) N_("Copy _Lookup Data"), (GImage *) "editcopylookupdata.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Copy Lookup Data|No Shortcut"), NULL, NULL, FVMenuCopyLookupData, FV_MID_CopyLookupData }, |
| 4536 |
{ { (unichar_t *) N_("Copy _Width"), (GImage *) "editcopywidth.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'W' }, H_("Copy Width|No Shortcut"), NULL, NULL, FVMenuCopyWidth, FV_MID_CopyWidth }, |
| 4537 |
{ { (unichar_t *) N_("Copy _VWidth"), (GImage *) "editcopyvwidth.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'V' }, H_("Copy VWidth|No Shortcut"), NULL, NULL, FVMenuCopyWidth, FV_MID_CopyVWidth }, |
| 4538 |
{ { (unichar_t *) N_("Co_py LBearing"), (GImage *) "editcopylbearing.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'p' }, H_("Copy LBearing|No Shortcut"), NULL, NULL, FVMenuCopyWidth, FV_MID_CopyLBearing }, |
| 4539 |
{ { (unichar_t *) N_("Copy RBearin_g"), (GImage *) "editcopyrbearing.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'g' }, H_("Copy RBearing|No Shortcut"), NULL, NULL, FVMenuCopyWidth, FV_MID_CopyRBearing }, |
| 4540 |
{ { (unichar_t *) N_("_Paste"), (GImage *) "editpaste.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Paste|No Shortcut"), NULL, NULL, FVMenuPaste, FV_MID_Paste }, |
| 4541 |
{ { (unichar_t *) N_("Paste Into"), (GImage *) "editpasteinto.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Paste Into|No Shortcut"), NULL, NULL, FVMenuPasteInto, FV_MID_PasteInto }, |
| 4542 |
{ { (unichar_t *) N_("Paste After"), (GImage *) "editpasteafter.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Paste After|No Shortcut"), NULL, NULL, FVMenuPasteAfter, FV_MID_PasteAfter }, |
| 4543 |
{ { (unichar_t *) N_("Sa_me Glyph As"), (GImage *) "editsameas.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'm' }, H_("Same Glyph As|No Shortcut"), NULL, NULL, FVMenuSameGlyphAs, FV_MID_SameGlyphAs }, |
| 4544 |
{ { (unichar_t *) N_("C_lear"), (GImage *) "editclear.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, H_("Clear|No Shortcut"), NULL, NULL, FVMenuClear, FV_MID_Clear }, |
| 4545 |
{ { (unichar_t *) N_("Clear _Background"), (GImage *) "editclearback.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Clear Background|No Shortcut"), NULL, NULL, FVMenuClearBackground, FV_MID_ClearBackground }, |
| 4546 |
{ { (unichar_t *) N_("Copy _Fg To Bg"), (GImage *) "editcopyfg2bg.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Copy Fg To Bg|No Shortcut"), NULL, NULL, FVMenuCopyFgBg, FV_MID_CopyFgToBg }, |
| 4547 |
{ { (unichar_t *) N_("Copy Layer To Layer"), (GImage *) "editcopylayer2layer.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Copy Layer To Layer|No Shortcut"), NULL, NULL, FVMenuCopyL2L, FV_MID_CopyL2L }, |
| 4548 |
{ { (unichar_t *) N_("_Join"), (GImage *) "editjoin.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'J' }, H_("Join|No Shortcut"), NULL, NULL, FVMenuJoin, FV_MID_Join }, |
| 4549 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4550 |
{ { (unichar_t *) N_("_Select"), (GImage *) "editselect.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Select|No Shortcut"), sllist, sllistcheck, NULL, 0 }, |
| 4551 |
{ { (unichar_t *) N_("F_ind / Replace..."), (GImage *) "editfind.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'i' }, H_("Find / Replace...|No Shortcut"), NULL, NULL, FVMenuFindRpl, 0 }, |
| 4552 |
{ { (unichar_t *) N_("Replace with Reference"), (GImage *) "editrplref.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'i' }, H_("Replace with Reference|No Shortcut"), NULL, NULL, FVMenuReplaceWithRef, FV_MID_RplRef }, |
| 4553 |
{ { (unichar_t *) N_("Correct References"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'i' }, H_("Correct References|No Shortcut"), NULL, NULL, FVMenuCorrectRefs, FV_MID_CorrectRefs }, |
| 4554 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4555 |
{ { (unichar_t *) N_("U_nlink Reference"), (GImage *) "editunlink.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'U' }, H_("Unlink Reference|No Shortcut"), NULL, NULL, FVMenuUnlinkRef, FV_MID_UnlinkRef }, |
| 4556 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4557 |
{ { (unichar_t *) N_("Copy _From"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Copy From|No Shortcut"), cflist, cflistcheck, NULL, 0 }, |
| 4558 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4559 |
{ { (unichar_t *) N_("Remo_ve Undoes"), (GImage *) "editrmundoes.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'e' }, H_("Remove Undoes|No Shortcut"), NULL, NULL, FVMenuRemoveUndoes, FV_MID_RemoveUndoes }, |
| 4560 |
GMENUITEM2_EMPTY |
| 4561 |
}; |
| 4562 |
|
| 4563 |
static GMenuItem2 smlist[] = { |
| 4564 |
{ { (unichar_t *) N_("_Simplify"), (GImage *) "elementsimplify.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Simplify|No Shortcut"), NULL, NULL, FVMenuSimplify, FV_MID_Simplify }, |
| 4565 |
{ { (unichar_t *) N_("Simplify More..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("Simplify More...|No Shortcut"), NULL, NULL, FVMenuSimplifyMore, FV_MID_SimplifyMore }, |
| 4566 |
{ { (unichar_t *) N_("Clea_nup Glyph"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'n' }, H_("Cleanup Glyph|No Shortcut"), NULL, NULL, FVMenuCleanup, FV_MID_CleanupGlyph }, |
| 4567 |
{ { (unichar_t *) N_("Canonical Start _Point"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'n' }, H_("Canonical Start Point|No Shortcut"), NULL, NULL, FVMenuCanonicalStart, FV_MID_CanonicalStart }, |
| 4568 |
{ { (unichar_t *) N_("Canonical _Contours"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'n' }, H_("Canonical Contours|No Shortcut"), NULL, NULL, FVMenuCanonicalContours, FV_MID_CanonicalContours }, |
| 4569 |
GMENUITEM2_EMPTY |
| 4570 |
}; |
| 4571 |
|
| 4572 |
static GMenuItem2 rmlist[] = { |
| 4573 |
{ { (unichar_t *) N_("_Remove Overlap"), (GImage *) "overlaprm.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, 'O' }, H_("Remove Overlap|No Shortcut"), NULL, NULL, FVMenuOverlap, FV_MID_RmOverlap }, |
| 4574 |
{ { (unichar_t *) N_("_Intersect"), (GImage *) "overlapintersection.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Intersect|No Shortcut"), NULL, NULL, FVMenuOverlap, FV_MID_Intersection }, |
| 4575 |
{ { (unichar_t *) N_("_Find Intersections"), (GImage *) "overlapfindinter.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, 'O' }, H_("Find Intersections|No Shortcut"), NULL, NULL, FVMenuOverlap, FV_MID_FindInter }, |
| 4576 |
GMENUITEM2_EMPTY |
| 4577 |
}; |
| 4578 |
|
| 4579 |
static GMenuItem2 eflist[] = { |
| 4580 |
{ { (unichar_t *) N_("Change _Weight..."), (GImage *) "styleschangeweight.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Change Weight...|No Shortcut"), NULL, NULL, FVMenuEmbolden, FV_MID_Embolden }, |
| 4581 |
{ { (unichar_t *) N_("_Italic..."), (GImage *) "stylesitalic.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Italic...|No Shortcut"), NULL, NULL, FVMenuItalic, FV_MID_Italic }, |
| 4582 |
{ { (unichar_t *) N_("Obli_que..."), (GImage *) "stylesoblique.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Oblique...|No Shortcut"), NULL, NULL, FVMenuOblique, 0 }, |
| 4583 |
{ { (unichar_t *) N_("_Condense/Extend..."), (GImage *) "stylesextendcondense.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Condense/Extend...|No Shortcut"), NULL, NULL, FVMenuCondense, FV_MID_Condense }, |
| 4584 |
{ { (unichar_t *) N_("Change _X-Height..."), (GImage *) "styleschangexheight.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Change X-Height...|No Shortcut"), NULL, NULL, FVMenuChangeXHeight, FV_MID_ChangeXHeight }, |
| 4585 |
{ { (unichar_t *) N_("Change _Glyph..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Change Glyph...|No Shortcut"), NULL, NULL, FVMenuChangeGlyph, FV_MID_ChangeGlyph }, |
| 4586 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4587 |
{ { (unichar_t *) N_("Add _Small Capitals..."), (GImage *) "stylessmallcaps.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Add Small Capitals...|No Shortcut"), NULL, NULL, FVMenuSmallCaps, FV_MID_SmallCaps }, |
| 4588 |
{ { (unichar_t *) N_("Add Subscripts/Superscripts..."), (GImage *) "stylessubsuper.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Add Subscripts/Superscripts...|No Shortcut"), NULL, NULL, FVMenuSubSup, FV_MID_SubSup }, |
| 4589 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4590 |
{ { (unichar_t *) N_("In_line..."), (GImage *) "stylesinline.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Inline...|No Shortcut"), NULL, NULL, FVMenuInline, 0 }, |
| 4591 |
{ { (unichar_t *) N_("_Outline..."), (GImage *) "stylesoutline.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Outline...|No Shortcut"), NULL, NULL, FVMenuOutline, 0 }, |
| 4592 |
{ { (unichar_t *) N_("S_hadow..."), (GImage *) "stylesshadow.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Shadow...|No Shortcut"), NULL, NULL, FVMenuShadow, 0 }, |
| 4593 |
{ { (unichar_t *) N_("_Wireframe..."), (GImage *) "styleswireframe.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, true, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Wireframe...|No Shortcut"), NULL, NULL, FVMenuWireframe, 0 }, |
| 4594 |
GMENUITEM2_EMPTY |
| 4595 |
}; |
| 4596 |
|
| 4597 |
static GMenuItem2 balist[] = { |
| 4598 |
{ { (unichar_t *) N_("_Build Accented Glyph"), (GImage *) "elementbuildaccent.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Build Accented Glyph|No Shortcut"), NULL, NULL, FVMenuBuildAccent, FV_MID_BuildAccent }, |
| 4599 |
{ { (unichar_t *) N_("Build _Composite Glyph"), (GImage *) "elementbuildcomposite.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Build Composite Glyph|No Shortcut"), NULL, NULL, FVMenuBuildComposite, FV_MID_BuildComposite }, |
| 4600 |
{ { (unichar_t *) N_("Buil_d Duplicate Glyph"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Build Duplicate Glyph|No Shortcut"), NULL, NULL, FVMenuBuildDuplicate, FV_MID_BuildDuplicates }, |
| 4601 |
#ifdef KOREAN |
| 4602 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4603 |
{ { (unichar_t *) _STR_ShowGrp, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, NULL, NULL, NULL, FVMenuShowGroup }, |
| 4604 |
#endif |
| 4605 |
GMENUITEM2_EMPTY |
| 4606 |
}; |
| 4607 |
|
| 4608 |
static GMenuItem2 delist[] = { |
| 4609 |
{ { (unichar_t *) N_("_References..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'u' }, H_("References...|No Shortcut"), NULL, NULL, FVMenuShowDependentRefs, FV_MID_ShowDependentRefs }, |
| 4610 |
{ { (unichar_t *) N_("_Substitutions..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Substitutions...|No Shortcut"), NULL, NULL, FVMenuShowDependentSubs, FV_MID_ShowDependentSubs }, |
| 4611 |
GMENUITEM2_EMPTY |
| 4612 |
}; |
| 4613 |
|
| 4614 |
static GMenuItem2 trlist[] = { |
| 4615 |
{ { (unichar_t *) N_("_Transform..."), (GImage *) "elementtransform.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, H_("Transform...|No Shortcut"), NULL, NULL, FVMenuTransform, FV_MID_Transform }, |
| 4616 |
{ { (unichar_t *) N_("_Point of View Projection..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, H_("Point of View Projection...|No Shortcut"), NULL, NULL, FVMenuPOV, FV_MID_POV }, |
| 4617 |
{ { (unichar_t *) N_("_Non Linear Transform..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, H_("Non Linear Transform...|No Shortcut"), NULL, NULL, FVMenuNLTransform, FV_MID_NLTransform }, |
| 4618 |
GMENUITEM2_EMPTY |
| 4619 |
}; |
| 4620 |
|
| 4621 |
static GMenuItem2 rndlist[] = { |
| 4622 |
{ { (unichar_t *) N_("To _Int"), (GImage *) "elementround.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("To Int|No Shortcut"), NULL, NULL, FVMenuRound2Int, FV_MID_Round }, |
| 4623 |
{ { (unichar_t *) N_("To _Hundredths"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("To Hundredths|No Shortcut"), NULL, NULL, FVMenuRound2Hundredths, 0 }, |
| 4624 |
{ { (unichar_t *) N_("_Cluster"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Cluster|No Shortcut"), NULL, NULL, FVMenuCluster, 0 }, |
| 4625 |
GMENUITEM2_EMPTY |
| 4626 |
}; |
| 4627 |
|
| 4628 |
static GMenuItem2 scollist[] = { |
| 4629 |
{ { (unichar_t *) N_("Color|Choose..."), (GImage *)"colorwheel.png", COLOR_DEFAULT, COLOR_DEFAULT, (void *) -10, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Choose...|No Shortcut"), NULL, NULL, FVMenuSetColor, 0 }, |
| 4630 |
{ { (unichar_t *) N_("Color|Default"), &def_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) COLOR_DEFAULT, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Default|No Shortcut"), NULL, NULL, FVMenuSetColor, 0 }, |
| 4631 |
{ { NULL, &white_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xffffff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSetColor, 0 }, |
| 4632 |
{ { NULL, &red_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xff0000, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSetColor, 0 }, |
| 4633 |
{ { NULL, &green_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0x00ff00, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSetColor, 0 }, |
| 4634 |
{ { NULL, &blue_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0x0000ff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSetColor, 0 }, |
| 4635 |
{ { NULL, &yellow_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xffff00, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSetColor, 0 }, |
| 4636 |
{ { NULL, &cyan_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0x00ffff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSetColor, 0 }, |
| 4637 |
{ { NULL, &magenta_image, COLOR_DEFAULT, COLOR_DEFAULT, (void *) 0xff00ff, NULL, 0, 1, 0, 0, 0, 0, 0, 0, 0, '\0' }, NULL, NULL, NULL, FVMenuSetColor, 0 }, |
| 4638 |
GMENUITEM2_EMPTY |
| 4639 |
}; |
| 4640 |
|
| 4641 |
static GMenuItem2 infolist[] = { |
| 4642 |
{ { (unichar_t *) N_("_MATH Info..."), (GImage *) "elementmathinfo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("MATH Info...|No Shortcut"), NULL, NULL, FVMenuMATHInfo, 0 }, |
| 4643 |
{ { (unichar_t *) N_("_BDF Info..."), (GImage *) "elementbdfinfo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("BDF Info...|No Shortcut"), NULL, NULL, FVMenuBDFInfo, FV_MID_StrikeInfo }, |
| 4644 |
{ { (unichar_t *) N_("_Horizontal Baselines..."), (GImage *) "elementhbaselines.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Horizontal Baselines...|No Shortcut"), NULL, NULL, FVMenuBaseHoriz, 0 }, |
| 4645 |
{ { (unichar_t *) N_("_Vertical Baselines..."), (GImage *) "elementvbaselines.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Vertical Baselines...|No Shortcut"), NULL, NULL, FVMenuBaseVert, 0 }, |
| 4646 |
{ { (unichar_t *) N_("_Justification..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Justification...|No Shortcut"), NULL, NULL, FVMenuJustify, 0 }, |
| 4647 |
{ { (unichar_t *) N_("Show _Dependent"), (GImage *) "elementshowdep.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Show Dependent|No Shortcut"), delist, delistcheck, NULL, 0 }, |
| 4648 |
{ { (unichar_t *) N_("Mass Glyph _Rename..."), (GImage *) "elementrenameglyph.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Mass Glyph Rename...|No Shortcut"), NULL, NULL, FVMenuMassRename, FV_MID_MassRename }, |
| 4649 |
{ { (unichar_t *) N_("Set _Color"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Set Color|No Shortcut"), scollist, NULL, NULL, FV_MID_SetColor }, |
| 4650 |
GMENUITEM2_EMPTY |
| 4651 |
}; |
| 4652 |
|
| 4653 |
static GMenuItem2 validlist[] = { |
| 4654 |
{ { (unichar_t *) N_("Find Pr_oblems..."), (GImage *) "elementfindprobs.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Find Problems...|No Shortcut"), NULL, NULL, FVMenuFindProblems, FV_MID_FindProblems }, |
| 4655 |
{ { (unichar_t *) N_("_Validate..."), (GImage *) "elementvalidate.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Validate...|No Shortcut"), NULL, NULL, FVMenuValidate, FV_MID_Validate }, |
| 4656 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4657 |
{ { (unichar_t *) N_("Set E_xtremum Bound..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Set Extremum Bound...|No Shortcut"), NULL, NULL, FVMenuSetExtremumBound, FV_MID_SetExtremumBound }, |
| 4658 |
GMENUITEM2_EMPTY |
| 4659 |
}; |
| 4660 |
|
| 4661 |
static GMenuItem2 ellist[] = { |
| 4662 |
{ { (unichar_t *) N_("_Font Info..."), (GImage *) "elementfontinfo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Font Info...|No Shortcut"), NULL, NULL, FVMenuFontInfo, FV_MID_FontInfo }, |
| 4663 |
{ { (unichar_t *) N_("_Glyph Info..."), (GImage *) "elementglyphinfo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Glyph Info...|No Shortcut"), NULL, NULL, FVMenuCharInfo, FV_MID_CharInfo }, |
| 4664 |
{ { (unichar_t *) N_("Other Info"), (GImage *) "elementotherinfo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Other Info|No Shortcut"), infolist, infolistcheck, NULL, 0 }, |
| 4665 |
{ { (unichar_t *) N_("_Validation"), (GImage *) "elementvalidate.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Validation|No Shortcut"), validlist, validlistcheck, NULL, 0 }, |
| 4666 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4667 |
{ { (unichar_t *) N_("Bitm_ap Strikes Available..."), (GImage *) "elementbitmapsavail.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'A' }, H_("Bitmap Strikes Available...|No Shortcut"), NULL, NULL, FVMenuBitmaps, FV_MID_AvailBitmaps }, |
| 4668 |
{ { (unichar_t *) N_("Regenerate _Bitmap Glyphs..."), (GImage *) "elementregenbitmaps.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Regenerate Bitmap Glyphs...|No Shortcut"), NULL, NULL, FVMenuBitmaps, FV_MID_RegenBitmaps }, |
| 4669 |
{ { (unichar_t *) N_("Remove Bitmap Glyphs..."), (GImage *) "elementremovebitmaps.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Remove Bitmap Glyphs...|No Shortcut"), NULL, NULL, FVMenuBitmaps, FV_MID_RemoveBitmaps }, |
| 4670 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4671 |
{ { (unichar_t *) N_("St_yle"), (GImage *) "elementstyles.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Style|No Shortcut"), eflist, NULL, NULL, FV_MID_Styles }, |
| 4672 |
{ { (unichar_t *) N_("_Transformations"), (GImage *) "elementtransform.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, H_("Transformations|No Shortcut"), trlist, trlistcheck, NULL, FV_MID_Transform }, |
| 4673 |
{ { (unichar_t *) N_("_Expand Stroke..."), (GImage *) "elementexpandstroke.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'E' }, H_("Expand Stroke...|No Shortcut"), NULL, NULL, FVMenuStroke, FV_MID_Stroke }, |
| 4674 |
#ifdef FONTFORGE_CONFIG_TILEPATH |
| 4675 |
{ { (unichar_t *) N_("Tile _Path..."), (GImage *) "elementtilepath.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Tile Path...|No Shortcut"), NULL, NULL, FVMenuTilePath, FV_MID_TilePath }, |
| 4676 |
{ { (unichar_t *) N_("Tile Pattern..."), (GImage *) "elementtilepattern.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Tile Pattern...|No Shortcut"), NULL, NULL, FVMenuPatternTile, 0 }, |
| 4677 |
#endif |
| 4678 |
{ { (unichar_t *) N_("O_verlap"), (GImage *) "overlaprm.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'O' }, H_("Overlap|No Shortcut"), rmlist, NULL, NULL, FV_MID_RmOverlap }, |
| 4679 |
{ { (unichar_t *) N_("_Simplify"), (GImage *) "elementsimplify.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Simplify|No Shortcut"), smlist, NULL, NULL, FV_MID_Simplify }, |
| 4680 |
{ { (unichar_t *) N_("Add E_xtrema"), (GImage *) "elementaddextrema.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'x' }, H_("Add Extrema|No Shortcut"), NULL, NULL, FVMenuAddExtrema, FV_MID_AddExtrema }, |
| 4681 |
{ { (unichar_t *) N_("Add Points Of I_nflection"), (GImage *) "elementaddinflections.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'n' }, H_("Add Points Of Inflection|No Shortcut"), NULL, NULL, FVMenuAddInflections, FV_MID_AddInflections }, |
| 4682 |
{ { (unichar_t *) N_("_Balance"), (GImage *) "elementbalance.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'b' }, H_("Balance|No Shortcut"), NULL, NULL, FVMenuBalance, FV_MID_Balance }, |
| 4683 |
{ { (unichar_t *) N_("Harmoni_ze"), (GImage *) "elementharmonize.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'z' }, H_("Harmonize|No Shortcut"), NULL, NULL, FVMenuHarmonize, FV_MID_Harmonize }, |
| 4684 |
{ { (unichar_t *) N_("Roun_d"), (GImage *) "elementround.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Round|No Shortcut"), rndlist, NULL, NULL, FV_MID_Round }, |
| 4685 |
{ { (unichar_t *) N_("Autot_race"), (GImage *) "elementautotrace.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'r' }, H_("Autotrace|No Shortcut"), NULL, NULL, FVMenuAutotrace, FV_MID_Autotrace }, |
| 4686 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4687 |
{ { (unichar_t *) N_("_Correct Direction"), (GImage *) "elementcorrectdir.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'D' }, H_("Correct Direction|No Shortcut"), NULL, NULL, FVMenuCorrectDir, FV_MID_Correct }, |
| 4688 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4689 |
{ { (unichar_t *) N_("B_uild"), (GImage *) "elementbuildaccent.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Build|No Shortcut"), balist, balistcheck, NULL, FV_MID_BuildAccent }, |
| 4690 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 4691 |
{ { (unichar_t *) N_("_Merge Fonts..."), (GImage *) "elementmergefonts.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("Merge Fonts...|No Shortcut"), NULL, NULL, FVMenuMergeFonts, FV_MID_MergeFonts }, |
| 4692 |
{ { (unichar_t *) N_("Interpo_late Fonts..."), (GImage *) "elementinterpolatefonts.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'p' }, H_("Interpolate Fonts...|No Shortcut"), NULL, NULL, FVMenuInterpFonts, FV_MID_InterpolateFonts }, |
| 4693 |
{ { (unichar_t *) N_("Compare Fonts..."), (GImage *) "elementcomparefonts.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'p' }, H_("Compare Fonts...|No Shortcut"), NULL, NULL, FVMenuCompareFonts, FV_MID_FontCompare }, |
| 4694 |
{ { (unichar_t *) N_("Compare Layers..."), (GImage *) "elementcomparelayers.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'p' }, H_("Compare Layers...|No Shortcut"), NULL, NULL, FVMenuCompareL2L, 0 }, |
| 4695 |
GMENUITEM2_EMPTY |
| 4696 |
}; |
| 4697 |
|
| 4698 |
static GMenuItem2 dummyall[] = { |
| 4699 |
{ { (unichar_t *) N_("All"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 1, 0, 0, 0, 0, 0, 1, 1, 0, 'K' }, H_("All|No Shortcut"), NULL, NULL, NULL, 0 }, |
| 4700 |
GMENUITEM2_EMPTY |
| 4701 |
}; |
| 4702 |
|
| 4703 |
|
| 4704 |
static void aplistbuild(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4705 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4706 |
|
| 4707 |
GMenuItemArrayFree(mi->sub); |
| 4708 |
mi->sub = NULL; |
| 4709 |
|
| 4710 |
_aplistbuild(mi,fv->b.sf,FVMenuAnchorPairs); |
| 4711 |
} |
| 4712 |
|
| 4713 |
static GMenuItem2 cblist[] = { |
| 4714 |
{ { (unichar_t *) N_("_Kern Pairs"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'K' }, H_("Kern Pairs|No Shortcut"), NULL, NULL, FVMenuKernPairs, FV_MID_KernPairs }, |
| 4715 |
{ { (unichar_t *) N_("_Anchored Pairs"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'K' }, H_("Anchored Pairs|No Shortcut"), dummyall, aplistbuild, NULL, FV_MID_AnchorPairs }, |
| 4716 |
{ { (unichar_t *) N_("_Ligatures"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'L' }, H_("Ligatures|No Shortcut"), NULL, NULL, FVMenuLigatures, FV_MID_Ligatures }, |
| 4717 |
GMENUITEM2_EMPTY |
| 4718 |
}; |
| 4719 |
|
| 4720 |
static void cblistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4721 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4722 |
SplineFont *sf = fv->b.sf; |
| 4723 |
int i, anyligs=0, anykerns=0, gid; |
| 4724 |
PST *pst; |
| 4725 |
|
| 4726 |
if ( sf->kerns ) anykerns=true; |
| 4727 |
for ( i=0; i<fv->b.map->enccount; ++i ) if ( (gid = fv->b.map->map[i])!=-1 && sf->glyphs[gid]!=NULL ) { |
| 4728 |
for ( pst=sf->glyphs[gid]->possub; pst!=NULL; pst=pst->next ) { |
| 4729 |
if ( pst->type==pst_ligature ) { |
| 4730 |
anyligs = true; |
| 4731 |
if ( anykerns ) |
| 4732 |
break; |
| 4733 |
} |
| 4734 |
} |
| 4735 |
if ( sf->glyphs[gid]->kerns!=NULL ) { |
| 4736 |
anykerns = true; |
| 4737 |
if ( anyligs ) |
| 4738 |
break; |
| 4739 |
} |
| 4740 |
} |
| 4741 |
|
| 4742 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4743 |
switch ( mi->mid ) { |
| 4744 |
case FV_MID_Ligatures: |
| 4745 |
mi->ti.disabled = !anyligs; |
| 4746 |
break; |
| 4747 |
case FV_MID_KernPairs: |
| 4748 |
mi->ti.disabled = !anykerns; |
| 4749 |
break; |
| 4750 |
case FV_MID_AnchorPairs: |
| 4751 |
mi->ti.disabled = sf->anchor==NULL; |
| 4752 |
break; |
| 4753 |
} |
| 4754 |
} |
| 4755 |
} |
| 4756 |
|
| 4757 |
|
| 4758 |
static GMenuItem2 gllist[] = { |
| 4759 |
{ { (unichar_t *) N_("_Glyph Image"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'K' }, H_("Glyph Image|No Shortcut"), NULL, NULL, FVMenuGlyphLabel, gl_glyph }, |
| 4760 |
{ { (unichar_t *) N_("_Name"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'K' }, H_("Name|No Shortcut"), NULL, NULL, FVMenuGlyphLabel, gl_name }, |
| 4761 |
{ { (unichar_t *) N_("_Unicode"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'L' }, H_("Unicode|No Shortcut"), NULL, NULL, FVMenuGlyphLabel, gl_unicode }, |
| 4762 |
{ { (unichar_t *) N_("_Encoding Hex"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'L' }, H_("Encoding Hex|No Shortcut"), NULL, NULL, FVMenuGlyphLabel, gl_encoding }, |
| 4763 |
GMENUITEM2_EMPTY |
| 4764 |
}; |
| 4765 |
|
| 4766 |
static void gllistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4767 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4768 |
|
| 4769 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 4770 |
mi->ti.checked = fv->glyphlabel == mi->mid; |
| 4771 |
} |
| 4772 |
} |
| 4773 |
|
| 4774 |
static GMenuItem2 emptymenu[] = { |
| 4775 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0}, |
| 4776 |
GMENUITEM2_EMPTY |
| 4777 |
}; |
| 4778 |
|
| 4779 |
static void FVEncodingMenuBuild(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4780 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4781 |
|
| 4782 |
if ( mi->sub!=NULL ) { |
| 4783 |
GMenuItemArrayFree(mi->sub); |
| 4784 |
mi->sub = NULL; |
| 4785 |
} |
| 4786 |
mi->sub = GetEncodingMenu(FVMenuReencode,fv->b.map->enc); |
| 4787 |
} |
| 4788 |
|
| 4789 |
static void FVMenuAddUnencoded(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4790 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4791 |
int i = add_encoding_slots_dialog(gw, fv->b.cidmaster); |
| 4792 |
if(i == 0) { |
| 4793 |
|
| 4794 |
return; |
| 4795 |
} else if(i < 0) { |
| 4796 |
return ff_post_error(_("Add Unencoded"), _("Error occurred while adding unencoded slots")); |
| 4797 |
} |
| 4798 |
FVAddUnencoded((FontViewBase *) fv, i); |
| 4799 |
} |
| 4800 |
|
| 4801 |
static void FVMenuRemoveUnused(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4802 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4803 |
FVRemoveUnused((FontViewBase *) fv); |
| 4804 |
} |
| 4805 |
|
| 4806 |
static void FVMenuCompact(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4807 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4808 |
SplineChar *sc; |
| 4809 |
|
| 4810 |
sc = FVFindACharInDisplay(fv); |
| 4811 |
FVCompact((FontViewBase *) fv); |
| 4812 |
if ( sc!=NULL ) { |
| 4813 |
int enc = fv->b.map->backmap[sc->orig_pos]; |
| 4814 |
if ( enc!=-1 ) |
| 4815 |
FVScrollToChar(fv,enc); |
| 4816 |
} |
| 4817 |
} |
| 4818 |
|
| 4819 |
static void FVMenuDetachGlyphs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4820 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4821 |
FVDetachGlyphs((FontViewBase *) fv); |
| 4822 |
} |
| 4823 |
|
| 4824 |
static void FVMenuDetachAndRemoveGlyphs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4825 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4826 |
char *buts[3]; |
| 4827 |
|
| 4828 |
buts[0] = _("_Remove"); |
| 4829 |
buts[1] = _("_Cancel"); |
| 4830 |
buts[2] = NULL; |
| 4831 |
|
| 4832 |
if ( gwwv_ask(_("Detach & Remove Glyphs"),(const char **) buts,0,1,_("Are you sure you wish to remove these glyphs? This operation cannot be undone."))==1 ) |
| 4833 |
return; |
| 4834 |
|
| 4835 |
FVDetachAndRemoveGlyphs((FontViewBase *) fv); |
| 4836 |
} |
| 4837 |
|
| 4838 |
static void FVForceEncodingMenuBuild(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 4839 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4840 |
|
| 4841 |
if ( mi->sub!=NULL ) { |
| 4842 |
GMenuItemArrayFree(mi->sub); |
| 4843 |
mi->sub = NULL; |
| 4844 |
} |
| 4845 |
mi->sub = GetEncodingMenu(FVMenuForceEncode,fv->b.map->enc); |
| 4846 |
} |
| 4847 |
|
| 4848 |
static void FVMenuAddEncodingName(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4849 |
char *ret; |
| 4850 |
Encoding *enc; |
| 4851 |
|
| 4852 |
|
| 4853 |
ret = gwwv_ask_string(_("Add Encoding Name..."),NULL,_("Please provide the name of an encoding in the iconv database which you want in the menu.")); |
| 4854 |
if ( ret==NULL ) |
| 4855 |
return; |
| 4856 |
enc = FindOrMakeEncoding(ret); |
| 4857 |
if ( enc==NULL ) |
| 4858 |
ff_post_error(_("Invalid Encoding"),_("Invalid Encoding")); |
| 4859 |
free(ret); |
| 4860 |
} |
| 4861 |
|
| 4862 |
static void FVMenuLoadEncoding(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4863 |
LoadEncodingFile(); |
| 4864 |
} |
| 4865 |
|
| 4866 |
static void FVMenuMakeFromFont(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4867 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4868 |
(void) MakeEncoding(fv->b.sf,fv->b.map); |
| 4869 |
} |
| 4870 |
|
| 4871 |
static void FVMenuRemoveEncoding(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4872 |
RemoveEncoding(); |
| 4873 |
} |
| 4874 |
|
| 4875 |
static void FVMenuMakeNamelist(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4876 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4877 |
char buffer[1025]; |
| 4878 |
char *filename, *temp; |
| 4879 |
FILE *file; |
| 4880 |
|
| 4881 |
snprintf(buffer, sizeof(buffer),"%s/%s.nam", getFontForgeUserDir(Config), fv->b.sf->fontname ); |
| 4882 |
temp = def2utf8_copy(buffer); |
| 4883 |
filename = gwwv_save_filename(_("Make Namelist"), temp,"*.nam"); |
| 4884 |
free(temp); |
| 4885 |
if ( filename==NULL ) |
| 4886 |
return; |
| 4887 |
temp = utf82def_copy(filename); |
| 4888 |
file = fopen(temp,"w"); |
| 4889 |
free(temp); |
| 4890 |
if ( file==NULL ) { |
| 4891 |
ff_post_error(_("Namelist creation failed"),_("Could not write %s"), filename); |
| 4892 |
free(filename); |
| 4893 |
return; |
| 4894 |
} |
| 4895 |
FVB_MakeNamelist((FontViewBase *) fv, file); |
| 4896 |
fclose(file); |
| 4897 |
} |
| 4898 |
|
| 4899 |
static void FVMenuLoadNamelist(GWindow UNUSED(gw), struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4900 |
|
| 4901 |
|
| 4902 |
|
| 4903 |
char buffer[1025]; |
| 4904 |
char *ret = gwwv_open_filename(_("Load Namelist"),NULL, |
| 4905 |
"*.nam",NULL); |
| 4906 |
char *temp, *pt; |
| 4907 |
char *buts[3]; |
| 4908 |
FILE *old, *new; |
| 4909 |
int ch, ans; |
| 4910 |
NameList *nl; |
| 4911 |
|
| 4912 |
if ( ret==NULL ) |
| 4913 |
return; |
| 4914 |
temp = utf82def_copy(ret); |
| 4915 |
pt = strrchr(temp,'/'); |
| 4916 |
if ( pt==NULL ) |
| 4917 |
pt = temp; |
| 4918 |
else |
| 4919 |
++pt; |
| 4920 |
snprintf(buffer,sizeof(buffer),"%s/%s", getFontForgeUserDir(Config), pt); |
| 4921 |
if ( access(buffer,F_OK)==0 ) { |
| 4922 |
buts[0] = _("_Replace"); |
| 4923 |
buts[1] = _("_Cancel"); |
| 4924 |
buts[2] = NULL; |
| 4925 |
ans = gwwv_ask( _("Replace"),(const char **) buts,0,1,_("A name list with this name already exists. Replace it?")); |
| 4926 |
if ( ans==1 ) { |
| 4927 |
free(temp); |
| 4928 |
free(ret); |
| 4929 |
return; |
| 4930 |
} |
| 4931 |
} |
| 4932 |
|
| 4933 |
old = fopen( temp,"r"); |
| 4934 |
if ( old==NULL ) { |
| 4935 |
ff_post_error(_("No such file"),_("Could not read %s"), ret ); |
| 4936 |
free(ret); free(temp); |
| 4937 |
return; |
| 4938 |
} |
| 4939 |
if ( (nl = LoadNamelist(temp))==NULL ) { |
| 4940 |
ff_post_error(_("Bad namelist file"),_("Could not parse %s"), ret ); |
| 4941 |
free(ret); free(temp); |
| 4942 |
fclose(old); |
| 4943 |
return; |
| 4944 |
} |
| 4945 |
free(ret); free(temp); |
| 4946 |
if ( nl->uses_unicode ) { |
| 4947 |
if ( nl->a_utf8_name!=NULL ) |
| 4948 |
ff_post_notice(_("Non-ASCII glyphnames"),_("This namelist contains at least one non-ASCII glyph name, namely: %s"), nl->a_utf8_name ); |
| 4949 |
else |
| 4950 |
ff_post_notice(_("Non-ASCII glyphnames"),_("This namelist is based on a namelist which contains non-ASCII glyph names")); |
| 4951 |
} |
| 4952 |
|
| 4953 |
new = fopen( buffer,"w"); |
| 4954 |
if ( new==NULL ) { |
| 4955 |
ff_post_error(_("Create failed"),_("Could not write %s"), buffer ); |
| 4956 |
fclose(old); |
| 4957 |
return; |
| 4958 |
} |
| 4959 |
|
| 4960 |
while ( (ch=getc(old))!=EOF ) |
| 4961 |
putc(ch,new); |
| 4962 |
fclose(old); |
| 4963 |
fclose(new); |
| 4964 |
} |
| 4965 |
|
| 4966 |
static void FVMenuRenameByNamelist(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4967 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4968 |
char **namelists = AllNamelistNames(); |
| 4969 |
int i; |
| 4970 |
int ret; |
| 4971 |
NameList *nl; |
| 4972 |
extern int allow_utf8_glyphnames; |
| 4973 |
|
| 4974 |
for ( i=0; namelists[i]!=NULL; ++i ); |
| 4975 |
ret = gwwv_choose(_("Rename by NameList"),(const char **) namelists,i,0,_("Rename the glyphs in this font to the names found in the selected namelist")); |
| 4976 |
if ( ret==-1 ) |
| 4977 |
return; |
| 4978 |
nl = NameListByName(namelists[ret]); |
| 4979 |
if ( nl==NULL ) { |
| 4980 |
IError("Couldn't find namelist"); |
| 4981 |
return; |
| 4982 |
} else if ( nl!=NULL && nl->uses_unicode && !allow_utf8_glyphnames) { |
| 4983 |
ff_post_error(_("Namelist contains non-ASCII names"),_("Glyph names should be limited to characters in the ASCII character set, but there are names in this namelist which use characters outside that range.")); |
| 4984 |
return; |
| 4985 |
} |
| 4986 |
SFRenameGlyphsToNamelist(fv->b.sf,nl); |
| 4987 |
GDrawRequestExpose(fv->v,NULL,false); |
| 4988 |
} |
| 4989 |
|
| 4990 |
static void FVMenuNameGlyphs(GWindow gw, struct gmenuitem *UNUSED(mi), GEvent *UNUSED(e)) { |
| 4991 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 4992 |
|
| 4993 |
|
| 4994 |
char buffer[33]; |
| 4995 |
char *ret = gwwv_open_filename(_("Load glyph names"),NULL, "*",NULL); |
| 4996 |
char *temp, *pt; |
| 4997 |
FILE *file; |
| 4998 |
int ch; |
| 4999 |
SplineChar *sc; |
| 5000 |
FontView *fvs; |
| 5001 |
|
| 5002 |
if ( ret==NULL ) |
| 5003 |
return; |
| 5004 |
temp = utf82def_copy(ret); |
| 5005 |
|
| 5006 |
file = fopen( temp,"r"); |
| 5007 |
if ( file==NULL ) { |
| 5008 |
ff_post_error(_("No such file"),_("Could not read %s"), ret ); |
| 5009 |
free(ret); free(temp); |
| 5010 |
return; |
| 5011 |
} |
| 5012 |
pt = buffer; |
| 5013 |
for (;;) { |
| 5014 |
ch = getc(file); |
| 5015 |
if ( ch!=EOF && !isspace(ch)) { |
| 5016 |
if ( pt<buffer+sizeof(buffer)-1 ) |
| 5017 |
*pt++ = ch; |
| 5018 |
} else { |
| 5019 |
if ( pt!=buffer ) { |
| 5020 |
*pt = '\0'; |
| 5021 |
sc = NULL; |
| 5022 |
for ( fvs=(FontView *) (fv->b.sf->fv); fvs!=NULL; fvs=(FontView *) (fvs->b.nextsame) ) { |
| 5023 |
EncMap *map = fvs->b.map; |
| 5024 |
if ( map->enccount+1>=map->encmax ) |
| 5025 |
map->map = realloc(map->map,(map->encmax += 20)*sizeof(int)); |
| 5026 |
map->map[map->enccount] = -1; |
| 5027 |
fvs->b.selected = realloc(fvs->b.selected,(map->enccount+1)); |
| 5028 |
memset(fvs->b.selected+map->enccount,0,1); |
| 5029 |
++map->enccount; |
| 5030 |
if ( sc==NULL ) { |
| 5031 |
sc = SFMakeChar(fv->b.sf,map,map->enccount-1); |
| 5032 |
free(sc->name); |
| 5033 |
sc->name = copy(buffer); |
| 5034 |
sc->comment = copy("."); |
| 5035 |
} |
| 5036 |
map->map[map->enccount-1] = sc->orig_pos; |
| 5037 |
map->backmap[sc->orig_pos] = map->enccount-1; |
| 5038 |
} |
| 5039 |
pt = buffer; |
| 5040 |
} |
| 5041 |
if ( ch==EOF ) |
| 5042 |
break; |
| 5043 |
} |
| 5044 |
} |
| 5045 |
fclose(file); |
| 5046 |
free(ret); free(temp); |
| 5047 |
FontViewReformatAll(fv->b.sf); |
| 5048 |
} |
| 5049 |
|
| 5050 |
static GMenuItem2 enlist[] = { |
| 5051 |
{ { (unichar_t *) N_("_Reencode"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'E' }, H_("Reencode|No Shortcut"), emptymenu, FVEncodingMenuBuild, NULL, FV_MID_Reencode }, |
| 5052 |
{ { (unichar_t *) N_("_Compact (hide unused glyphs)"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'C' }, H_("Compact (hide unused glyphs)|No Shortcut"), NULL, NULL, FVMenuCompact, FV_MID_Compact }, |
| 5053 |
{ { (unichar_t *) N_("_Force Encoding"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Force Encoding|No Shortcut"), emptymenu, FVForceEncodingMenuBuild, NULL, FV_MID_ForceReencode }, |
| 5054 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5055 |
{ { (unichar_t *) N_("_Add Encoding Slots..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Add Encoding Slots...|No Shortcut"), NULL, NULL, FVMenuAddUnencoded, FV_MID_AddUnencoded }, |
| 5056 |
{ { (unichar_t *) N_("Remove _Unused Slots"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Remove Unused Slots|No Shortcut"), NULL, NULL, FVMenuRemoveUnused, FV_MID_RemoveUnused }, |
| 5057 |
{ { (unichar_t *) N_("_Detach Glyphs"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Detach Glyphs|No Shortcut"), NULL, NULL, FVMenuDetachGlyphs, FV_MID_DetachGlyphs }, |
| 5058 |
{ { (unichar_t *) N_("Detach & Remo_ve Glyphs..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Detach & Remove Glyphs...|No Shortcut"), NULL, NULL, FVMenuDetachAndRemoveGlyphs, FV_MID_DetachAndRemoveGlyphs }, |
| 5059 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5060 |
{ { (unichar_t *) N_("Add E_ncoding Name..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Add Encoding Name...|No Shortcut"), NULL, NULL, FVMenuAddEncodingName, 0 }, |
| 5061 |
{ { (unichar_t *) N_("_Load Encoding..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Load Encoding...|No Shortcut"), NULL, NULL, FVMenuLoadEncoding, FV_MID_LoadEncoding }, |
| 5062 |
{ { (unichar_t *) N_("Ma_ke From Font..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Make From Font...|No Shortcut"), NULL, NULL, FVMenuMakeFromFont, FV_MID_MakeFromFont }, |
| 5063 |
{ { (unichar_t *) N_("Remove En_coding..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Remove Encoding...|No Shortcut"), NULL, NULL, FVMenuRemoveEncoding, FV_MID_RemoveEncoding }, |
| 5064 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5065 |
{ { (unichar_t *) N_("Display By _Groups..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Display By Groups...|No Shortcut"), NULL, NULL, FVMenuDisplayByGroups, FV_MID_DisplayByGroups }, |
| 5066 |
{ { (unichar_t *) N_("D_efine Groups..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Define Groups...|No Shortcut"), NULL, NULL, FVMenuDefineGroups, 0 }, |
| 5067 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5068 |
{ { (unichar_t *) N_("_Save Namelist of Font..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Save Namelist of Font...|No Shortcut"), NULL, NULL, FVMenuMakeNamelist, FV_MID_SaveNamelist }, |
| 5069 |
{ { (unichar_t *) N_("L_oad Namelist..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Load Namelist...|No Shortcut"), NULL, NULL, FVMenuLoadNamelist, 0 }, |
| 5070 |
{ { (unichar_t *) N_("Rename Gl_yphs..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Rename Glyphs...|No Shortcut"), NULL, NULL, FVMenuRenameByNamelist, FV_MID_RenameGlyphs }, |
| 5071 |
{ { (unichar_t *) N_("Cre_ate Named Glyphs..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Create Named Glyphs...|No Shortcut"), NULL, NULL, FVMenuNameGlyphs, FV_MID_NameGlyphs }, |
| 5072 |
GMENUITEM2_EMPTY |
| 5073 |
}; |
| 5074 |
|
| 5075 |
static void enlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 5076 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 5077 |
int i, gid; |
| 5078 |
SplineFont *sf = fv->b.sf; |
| 5079 |
EncMap *map = fv->b.map; |
| 5080 |
int anyglyphs = false; |
| 5081 |
|
| 5082 |
for ( i=map->enccount-1; i>=0 ; --i ) |
| 5083 |
if ( fv->b.selected[i] && (gid=map->map[i])!=-1 ) |
| 5084 |
anyglyphs = true; |
| 5085 |
|
| 5086 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 5087 |
switch ( mi->mid ) { |
| 5088 |
case FV_MID_Compact: |
| 5089 |
mi->ti.checked = fv->b.normal!=NULL; |
| 5090 |
break; |
| 5091 |
case FV_MID_HideNoGlyphSlots: |
| 5092 |
break; |
| 5093 |
case FV_MID_Reencode: case FV_MID_ForceReencode: |
| 5094 |
mi->ti.disabled = fv->b.cidmaster!=NULL; |
| 5095 |
break; |
| 5096 |
case FV_MID_DetachGlyphs: case FV_MID_DetachAndRemoveGlyphs: |
| 5097 |
mi->ti.disabled = !anyglyphs; |
| 5098 |
break; |
| 5099 |
case FV_MID_RemoveUnused: |
| 5100 |
gid = map->enccount>0 ? map->map[map->enccount-1] : -1; |
| 5101 |
mi->ti.disabled = gid!=-1 && SCWorthOutputting(sf->glyphs[gid]); |
| 5102 |
break; |
| 5103 |
case FV_MID_MakeFromFont: |
| 5104 |
mi->ti.disabled = fv->b.cidmaster!=NULL || map->enccount>1024 || map->enc!=&custom; |
| 5105 |
break; |
| 5106 |
case FV_MID_RemoveEncoding: |
| 5107 |
break; |
| 5108 |
case FV_MID_DisplayByGroups: |
| 5109 |
mi->ti.disabled = fv->b.cidmaster!=NULL || group_root==NULL; |
| 5110 |
break; |
| 5111 |
case FV_MID_NameGlyphs: |
| 5112 |
mi->ti.disabled = fv->b.normal!=NULL || fv->b.cidmaster!=NULL; |
| 5113 |
break; |
| 5114 |
case FV_MID_RenameGlyphs: case FV_MID_SaveNamelist: |
| 5115 |
mi->ti.disabled = fv->b.cidmaster!=NULL; |
| 5116 |
break; |
| 5117 |
} |
| 5118 |
} |
| 5119 |
} |
| 5120 |
|
| 5121 |
static GMenuItem2 lylist[] = { |
| 5122 |
{ { (unichar_t *) N_("Layer|Foreground"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 1, 0, 1, 1, 0, 0, 1, 1, 0, '\0' }, NULL, NULL, NULL, FVMenuChangeLayer, ly_fore }, |
| 5123 |
GMENUITEM2_EMPTY |
| 5124 |
}; |
| 5125 |
|
| 5126 |
static void lylistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 5127 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 5128 |
SplineFont *sf = fv->b.sf; |
| 5129 |
int ly; |
| 5130 |
GMenuItem *sub; |
| 5131 |
|
| 5132 |
sub = calloc(sf->layer_cnt+1,sizeof(GMenuItem)); |
| 5133 |
for ( ly=ly_fore; ly<sf->layer_cnt; ++ly ) { |
| 5134 |
sub[ly-1].ti.text = utf82u_copy(sf->layers[ly].name); |
| 5135 |
sub[ly-1].ti.checkable = true; |
| 5136 |
sub[ly-1].ti.checked = ly == fv->b.active_layer; |
| 5137 |
sub[ly-1].invoke = FVMenuChangeLayer; |
| 5138 |
sub[ly-1].mid = ly; |
| 5139 |
sub[ly-1].ti.fg = sub[ly-1].ti.bg = COLOR_DEFAULT; |
| 5140 |
} |
| 5141 |
GMenuItemArrayFree(mi->sub); |
| 5142 |
mi->sub = sub; |
| 5143 |
} |
| 5144 |
|
| 5145 |
static GMenuItem2 vwlist[] = { |
| 5146 |
{ { (unichar_t *) N_("_Next Glyph"), (GImage *) "viewnext.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'N' }, H_("Next Glyph|No Shortcut"), NULL, NULL, FVMenuChangeChar, FV_MID_Next }, |
| 5147 |
{ { (unichar_t *) N_("_Prev Glyph"), (GImage *) "viewprev.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Prev Glyph|No Shortcut"), NULL, NULL, FVMenuChangeChar, FV_MID_Prev }, |
| 5148 |
{ { (unichar_t *) N_("Next _Defined Glyph"), (GImage *) "viewnextdef.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'D' }, H_("Next Defined Glyph|No Shortcut"), NULL, NULL, FVMenuChangeChar, FV_MID_NextDef }, |
| 5149 |
{ { (unichar_t *) N_("Prev Defined Gl_yph"), (GImage *) "viewprevdef.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'a' }, H_("Prev Defined Glyph|No Shortcut"), NULL, NULL, FVMenuChangeChar, FV_MID_PrevDef }, |
| 5150 |
{ { (unichar_t *) N_("_Goto"), (GImage *) "viewgoto.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'G' }, H_("Goto|No Shortcut"), NULL, NULL, FVMenuGotoChar, 0 }, |
| 5151 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5152 |
{ { (unichar_t *) N_("_Layers"), (GImage *) "viewlayers.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Layers|No Shortcut"), lylist, lylistcheck, NULL, 0 }, |
| 5153 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5154 |
{ { (unichar_t *) N_("_Show ATT"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'S' }, H_("Show ATT|No Shortcut"), NULL, NULL, FVMenuShowAtt, 0 }, |
| 5155 |
{ { (unichar_t *) N_("Display S_ubstitutions..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'u' }, H_("Display Substitutions...|No Shortcut"), NULL, NULL, FVMenuDisplaySubs, FV_MID_DisplaySubs }, |
| 5156 |
{ { (unichar_t *) N_("Com_binations"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'b' }, H_("Combinations|No Shortcut"), cblist, cblistcheck, NULL, 0 }, |
| 5157 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5158 |
{ { (unichar_t *) N_("Label Gl_yph By"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'b' }, H_("Label Glyph By|No Shortcut"), gllist, gllistcheck, NULL, 0 }, |
| 5159 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5160 |
{ { (unichar_t *) N_("S_how H. Metrics..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("Show H. Metrics...|No Shortcut"), NULL, NULL, FVMenuShowMetrics, FV_MID_ShowHMetrics }, |
| 5161 |
{ { (unichar_t *) N_("Show _V. Metrics..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'V' }, H_("Show V. Metrics...|No Shortcut"), NULL, NULL, FVMenuShowMetrics, FV_MID_ShowVMetrics }, |
| 5162 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5163 |
{ { (unichar_t *) N_("32x8 cell window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '2' }, H_("32x8 cell window|No Shortcut"), NULL, NULL, FVMenuWSize, FV_MID_32x8 }, |
| 5164 |
{ { (unichar_t *) N_("_16x4 cell window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '3' }, H_("16x4 cell window|No Shortcut"), NULL, NULL, FVMenuWSize, FV_MID_16x4 }, |
| 5165 |
{ { (unichar_t *) N_("_8x2 cell window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '3' }, H_("8x2 cell window|No Shortcut"), NULL, NULL, FVMenuWSize, FV_MID_8x2 }, |
| 5166 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5167 |
{ { (unichar_t *) N_("_24 pixel outline"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '2' }, H_("24 pixel outline|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_24 }, |
| 5168 |
{ { (unichar_t *) N_("_36 pixel outline"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '3' }, H_("36 pixel outline|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_36 }, |
| 5169 |
{ { (unichar_t *) N_("_48 pixel outline"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '4' }, H_("48 pixel outline|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_48 }, |
| 5170 |
{ { (unichar_t *) N_("_72 pixel outline"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '4' }, H_("72 pixel outline|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_72 }, |
| 5171 |
{ { (unichar_t *) N_("_96 pixel outline"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '4' }, H_("96 pixel outline|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_96 }, |
| 5172 |
{ { (unichar_t *) N_("_128 pixel outline"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, '4' }, H_("128 pixel outline|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_128 }, |
| 5173 |
{ { (unichar_t *) N_("_Anti Alias"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'A' }, H_("Anti Alias|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_AntiAlias }, |
| 5174 |
{ { (unichar_t *) N_("_Fit to font bounding box"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'F' }, H_("Fit to font bounding box|No Shortcut"), NULL, NULL, FVMenuSize, FV_MID_FitToBbox }, |
| 5175 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5176 |
{ { (unichar_t *) N_("Bitmap _Magnification..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 1, 0, 0, 0, 1, 1, 0, 'F' }, H_("Bitmap Magnification...|No Shortcut"), NULL, NULL, FVMenuMagnify, FV_MID_BitmapMag }, |
| 5177 |
GMENUITEM2_EMPTY, |
| 5178 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5179 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5180 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5181 |
GMENUITEM2_EMPTY |
| 5182 |
}; |
| 5183 |
|
| 5184 |
static void vwlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 5185 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 5186 |
int anychars = FVAnyCharSelected(fv); |
| 5187 |
int i, base; |
| 5188 |
BDFFont *bdf; |
| 5189 |
char buffer[50]; |
| 5190 |
int pos; |
| 5191 |
SplineFont *sf = fv->b.sf; |
| 5192 |
SplineFont *master = sf->cidmaster ? sf->cidmaster : sf; |
| 5193 |
EncMap *map = fv->b.map; |
| 5194 |
OTLookup *otl; |
| 5195 |
|
| 5196 |
for ( i=0; vwlist[i].ti.text==NULL || strcmp((char *) vwlist[i].ti.text, _("Bitmap _Magnification..."))!=0; ++i ); |
| 5197 |
base = i+1; |
| 5198 |
for ( i=base; vwlist[i].ti.text!=NULL; ++i ) { |
| 5199 |
free( vwlist[i].ti.text); |
| 5200 |
vwlist[i].ti.text = NULL; |
| 5201 |
} |
| 5202 |
|
| 5203 |
vwlist[base-1].ti.disabled = true; |
| 5204 |
if ( master->bitmaps!=NULL ) { |
| 5205 |
for ( bdf = master->bitmaps, i=base; |
| 5206 |
i<sizeof(vwlist)/sizeof(vwlist[0])-1 && bdf!=NULL; |
| 5207 |
++i, bdf = bdf->next ) { |
| 5208 |
if ( BDFDepth(bdf)==1 ) |
| 5209 |
sprintf( buffer, _("%d pixel bitmap"), bdf->pixelsize ); |
| 5210 |
else |
| 5211 |
sprintf( buffer, _("%d@%d pixel bitmap"), |
| 5212 |
bdf->pixelsize, BDFDepth(bdf) ); |
| 5213 |
vwlist[i].ti.text = (unichar_t *) utf82u_copy(buffer); |
| 5214 |
vwlist[i].ti.checkable = true; |
| 5215 |
vwlist[i].ti.checked = bdf==fv->show; |
| 5216 |
vwlist[i].ti.userdata = bdf; |
| 5217 |
vwlist[i].invoke = FVMenuShowBitmap; |
| 5218 |
vwlist[i].ti.fg = vwlist[i].ti.bg = COLOR_DEFAULT; |
| 5219 |
if ( bdf==fv->show ) |
| 5220 |
vwlist[base-1].ti.disabled = false; |
| 5221 |
} |
| 5222 |
} |
| 5223 |
GMenuItemArrayFree(mi->sub); |
| 5224 |
mi->sub = GMenuItem2ArrayCopy(vwlist,NULL); |
| 5225 |
|
| 5226 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 5227 |
switch ( mi->mid ) { |
| 5228 |
case FV_MID_Next: case FV_MID_Prev: |
| 5229 |
mi->ti.disabled = anychars<0; |
| 5230 |
break; |
| 5231 |
case FV_MID_NextDef: |
| 5232 |
pos = anychars+1; |
| 5233 |
if ( anychars<0 ) pos = map->enccount; |
| 5234 |
for ( ; pos<map->enccount && |
| 5235 |
(map->map[pos]==-1 || !SCWorthOutputting(sf->glyphs[map->map[pos]])); |
| 5236 |
++pos ); |
| 5237 |
mi->ti.disabled = pos==map->enccount; |
| 5238 |
break; |
| 5239 |
case FV_MID_PrevDef: |
| 5240 |
for ( pos = anychars-1; pos>=0 && |
| 5241 |
(map->map[pos]==-1 || !SCWorthOutputting(sf->glyphs[map->map[pos]])); |
| 5242 |
--pos ); |
| 5243 |
mi->ti.disabled = pos<0; |
| 5244 |
break; |
| 5245 |
case FV_MID_DisplaySubs: { SplineFont *_sf = sf; |
| 5246 |
mi->ti.checked = fv->cur_subtable!=NULL; |
| 5247 |
if ( _sf->cidmaster ) _sf = _sf->cidmaster; |
| 5248 |
for ( otl=_sf->gsub_lookups; otl!=NULL; otl=otl->next ) |
| 5249 |
if ( otl->lookup_type == gsub_single && otl->subtables!=NULL ) |
| 5250 |
break; |
| 5251 |
mi->ti.disabled = otl==NULL; |
| 5252 |
} break; |
| 5253 |
case FV_MID_ShowHMetrics: |
| 5254 |
break; |
| 5255 |
case FV_MID_ShowVMetrics: |
| 5256 |
mi->ti.disabled = !sf->hasvmetrics; |
| 5257 |
break; |
| 5258 |
case FV_MID_32x8: |
| 5259 |
mi->ti.checked = (fv->rowcnt==8 && fv->colcnt==32); |
| 5260 |
mi->ti.disabled = fv->b.container!=NULL; |
| 5261 |
break; |
| 5262 |
case FV_MID_16x4: |
| 5263 |
mi->ti.checked = (fv->rowcnt==4 && fv->colcnt==16); |
| 5264 |
mi->ti.disabled = fv->b.container!=NULL; |
| 5265 |
break; |
| 5266 |
case FV_MID_8x2: |
| 5267 |
mi->ti.checked = (fv->rowcnt==2 && fv->colcnt==8); |
| 5268 |
mi->ti.disabled = fv->b.container!=NULL; |
| 5269 |
break; |
| 5270 |
case FV_MID_24: |
| 5271 |
mi->ti.checked = (fv->show!=NULL && fv->show==fv->filled && fv->show->pixelsize==24); |
| 5272 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5273 |
break; |
| 5274 |
case FV_MID_36: |
| 5275 |
mi->ti.checked = (fv->show!=NULL && fv->show==fv->filled && fv->show->pixelsize==36); |
| 5276 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5277 |
break; |
| 5278 |
case FV_MID_48: |
| 5279 |
mi->ti.checked = (fv->show!=NULL && fv->show==fv->filled && fv->show->pixelsize==48); |
| 5280 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5281 |
break; |
| 5282 |
case FV_MID_72: |
| 5283 |
mi->ti.checked = (fv->show!=NULL && fv->show==fv->filled && fv->show->pixelsize==72); |
| 5284 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5285 |
break; |
| 5286 |
case FV_MID_96: |
| 5287 |
mi->ti.checked = (fv->show!=NULL && fv->show==fv->filled && fv->show->pixelsize==96); |
| 5288 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5289 |
break; |
| 5290 |
case FV_MID_128: |
| 5291 |
mi->ti.checked = (fv->show!=NULL && fv->show==fv->filled && fv->show->pixelsize==128); |
| 5292 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5293 |
break; |
| 5294 |
case FV_MID_AntiAlias: |
| 5295 |
mi->ti.checked = (fv->show!=NULL && fv->show->clut!=NULL); |
| 5296 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5297 |
break; |
| 5298 |
case FV_MID_FitToBbox: |
| 5299 |
mi->ti.checked = (fv->show!=NULL && fv->show->bbsized); |
| 5300 |
mi->ti.disabled = sf->onlybitmaps && fv->show!=fv->filled; |
| 5301 |
break; |
| 5302 |
case FV_MID_Layers: |
| 5303 |
mi->ti.disabled = sf->layer_cnt<=2 || sf->multilayer; |
| 5304 |
break; |
| 5305 |
} |
| 5306 |
} |
| 5307 |
} |
| 5308 |
|
| 5309 |
static GMenuItem2 histlist[] = { |
| 5310 |
{ { (unichar_t *) N_("_HStem"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("HStem|No Shortcut"), NULL, NULL, FVMenuHistograms, FV_MID_HStemHist }, |
| 5311 |
{ { (unichar_t *) N_("_VStem"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'V' }, H_("VStem|No Shortcut"), NULL, NULL, FVMenuHistograms, FV_MID_VStemHist }, |
| 5312 |
{ { (unichar_t *) N_("BlueValues"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("BlueValues|No Shortcut"), NULL, NULL, FVMenuHistograms, FV_MID_BlueValuesHist }, |
| 5313 |
GMENUITEM2_EMPTY |
| 5314 |
}; |
| 5315 |
|
| 5316 |
static GMenuItem2 htlist[] = { |
| 5317 |
{ { (unichar_t *) N_("Auto_Hint"), (GImage *) "hintsautohint.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("AutoHint|No Shortcut"), NULL, NULL, FVMenuAutoHint, FV_MID_AutoHint }, |
| 5318 |
{ { (unichar_t *) N_("Hint _Substitution Pts"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("Hint Substitution Pts|No Shortcut"), NULL, NULL, FVMenuAutoHintSubs, FV_MID_HintSubsPt }, |
| 5319 |
{ { (unichar_t *) N_("Auto _Counter Hint"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("Auto Counter Hint|No Shortcut"), NULL, NULL, FVMenuAutoCounter, FV_MID_AutoCounter }, |
| 5320 |
{ { (unichar_t *) N_("_Don't AutoHint"), (GImage *) "hintsdontautohint.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("Don't AutoHint|No Shortcut"), NULL, NULL, FVMenuDontAutoHint, FV_MID_DontAutoHint }, |
| 5321 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5322 |
{ { (unichar_t *) N_("Auto_Instr"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, H_("AutoInstr|No Shortcut"), NULL, NULL, FVMenuAutoInstr, FV_MID_AutoInstr }, |
| 5323 |
{ { (unichar_t *) N_("_Edit Instructions..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, H_("Edit Instructions...|No Shortcut"), NULL, NULL, FVMenuEditInstrs, FV_MID_EditInstructions }, |
| 5324 |
{ { (unichar_t *) N_("Edit 'fpgm'..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Edit 'fpgm'...|No Shortcut"), NULL, NULL, FVMenuEditTable, FV_MID_Editfpgm }, |
| 5325 |
{ { (unichar_t *) N_("Edit 'prep'..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Edit 'prep'...|No Shortcut"), NULL, NULL, FVMenuEditTable, FV_MID_Editprep }, |
| 5326 |
{ { (unichar_t *) N_("Edit 'maxp'..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Edit 'maxp'...|No Shortcut"), NULL, NULL, FVMenuEditTable, FV_MID_Editmaxp }, |
| 5327 |
{ { (unichar_t *) N_("Edit 'cvt '..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Edit 'cvt '...|No Shortcut"), NULL, NULL, FVMenuEditTable, FV_MID_Editcvt }, |
| 5328 |
{ { (unichar_t *) N_("Remove Instr Tables"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Remove Instr Tables|No Shortcut"), NULL, NULL, FVMenuRmInstrTables, FV_MID_RmInstrTables }, |
| 5329 |
{ { (unichar_t *) N_("S_uggest Deltas..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, H_("Suggest Deltas...|No Shortcut"), NULL, NULL, FVMenuDeltas, FV_MID_Deltas }, |
| 5330 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5331 |
{ { (unichar_t *) N_("_Clear Hints"), (GImage *) "hintsclearvstems.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Clear Hints|No Shortcut"), NULL, NULL, FVMenuClearHints, FV_MID_ClearHints }, |
| 5332 |
{ { (unichar_t *) N_("Clear Instructions"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Clear Instructions|No Shortcut"), NULL, NULL, FVMenuClearInstrs, FV_MID_ClearInstrs }, |
| 5333 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5334 |
{ { (unichar_t *) N_("Histograms"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("Histograms|No Shortcut"), histlist, NULL, NULL, 0 }, |
| 5335 |
GMENUITEM2_EMPTY |
| 5336 |
}; |
| 5337 |
|
| 5338 |
static GMenuItem2 mtlist[] = { |
| 5339 |
{ { (unichar_t *) N_("New _Metrics Window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("New Metrics Window|No Shortcut"), NULL, NULL, FVMenuOpenMetrics, FV_MID_OpenMetrics }, |
| 5340 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5341 |
{ { (unichar_t *) N_("_Center in Width"), (GImage *) "metricscenter.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Center in Width|No Shortcut"), NULL, NULL, FVMenuCenter, FV_MID_Center }, |
| 5342 |
{ { (unichar_t *) N_("_Thirds in Width"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, H_("Thirds in Width|No Shortcut"), NULL, NULL, FVMenuCenter, FV_MID_Thirds }, |
| 5343 |
{ { (unichar_t *) N_("Set _Width..."), (GImage *) "metricssetwidth.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'W' }, H_("Set Width...|No Shortcut"), NULL, NULL, FVMenuSetWidth, FV_MID_SetWidth }, |
| 5344 |
{ { (unichar_t *) N_("Set _LBearing..."), (GImage *) "metricssetlbearing.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'L' }, H_("Set LBearing...|No Shortcut"), NULL, NULL, FVMenuSetWidth, FV_MID_SetLBearing }, |
| 5345 |
{ { (unichar_t *) N_("Set _RBearing..."), (GImage *) "metricssetrbearing.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Set RBearing...|No Shortcut"), NULL, NULL, FVMenuSetWidth, FV_MID_SetRBearing }, |
| 5346 |
{ { (unichar_t *) N_("Set Both Bearings..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Set Both Bearings...|No Shortcut"), NULL, NULL, FVMenuSetWidth, FV_MID_SetBearings }, |
| 5347 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5348 |
{ { (unichar_t *) N_("Set _Vertical Advance..."), (GImage *) "metricssetvwidth.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'V' }, H_("Set Vertical Advance...|No Shortcut"), NULL, NULL, FVMenuSetWidth, FV_MID_SetVWidth }, |
| 5349 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5350 |
{ { (unichar_t *) N_("_Auto Width..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'A' }, H_("Auto Width...|No Shortcut"), NULL, NULL, FVMenuAutoWidth, 0 }, |
| 5351 |
{ { (unichar_t *) N_("Ker_n By Classes..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'K' }, H_("Kern By Classes...|No Shortcut"), NULL, NULL, FVMenuKernByClasses, 0 }, |
| 5352 |
{ { (unichar_t *) N_("Remove All Kern _Pairs"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Remove All Kern Pairs|No Shortcut"), NULL, NULL, FVMenuRemoveKern, FV_MID_RmHKern }, |
| 5353 |
{ { (unichar_t *) N_("Kern Pair Closeup..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Kern Pair Closeup...|No Shortcut"), NULL, NULL, FVMenuKPCloseup, 0 }, |
| 5354 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5355 |
{ { (unichar_t *) N_("VKern By Classes..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'K' }, H_("VKern By Classes...|No Shortcut"), NULL, NULL, FVMenuVKernByClasses, FV_MID_VKernByClass }, |
| 5356 |
{ { (unichar_t *) N_("VKern From HKern"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("VKern From HKern|No Shortcut"), NULL, NULL, FVMenuVKernFromHKern, FV_MID_VKernFromH }, |
| 5357 |
{ { (unichar_t *) N_("Remove All VKern Pairs"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, H_("Remove All VKern Pairs|No Shortcut"), NULL, NULL, FVMenuRemoveVKern, FV_MID_RmVKern }, |
| 5358 |
GMENUITEM2_EMPTY |
| 5359 |
}; |
| 5360 |
|
| 5361 |
static GMenuItem2 cdlist[] = { |
| 5362 |
{ { (unichar_t *) N_("_Convert to CID"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Convert to CID|No Shortcut"), NULL, NULL, FVMenuConvert2CID, FV_MID_Convert2CID }, |
| 5363 |
{ { (unichar_t *) N_("Convert By C_Map"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("Convert By CMap|No Shortcut"), NULL, NULL, FVMenuConvertByCMap, FV_MID_ConvertByCMap }, |
| 5364 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5365 |
{ { (unichar_t *) N_("_Flatten"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("Flatten|No Shortcut"), NULL, NULL, FVMenuFlatten, FV_MID_Flatten }, |
| 5366 |
{ { (unichar_t *) N_("Fl_attenByCMap"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("FlattenByCMap|No Shortcut"), NULL, NULL, FVMenuFlattenByCMap, FV_MID_FlattenByCMap }, |
| 5367 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5368 |
{ { (unichar_t *) N_("Insert F_ont..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, H_("Insert Font...|No Shortcut"), NULL, NULL, FVMenuInsertFont, FV_MID_InsertFont }, |
| 5369 |
{ { (unichar_t *) N_("Insert _Blank"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("Insert Blank|No Shortcut"), NULL, NULL, FVMenuInsertBlank, FV_MID_InsertBlank }, |
| 5370 |
{ { (unichar_t *) N_("_Remove Font"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'R' }, H_("Remove Font|No Shortcut"), NULL, NULL, FVMenuRemoveFontFromCID, FV_MID_RemoveFromCID }, |
| 5371 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5372 |
{ { (unichar_t *) N_("_Change Supplement..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Change Supplement...|No Shortcut"), NULL, NULL, FVMenuChangeSupplement, FV_MID_ChangeSupplement }, |
| 5373 |
{ { (unichar_t *) N_("C_ID Font Info..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("CID Font Info...|No Shortcut"), NULL, NULL, FVMenuCIDFontInfo, FV_MID_CIDFontInfo }, |
| 5374 |
GMENUITEM2_EMPTY, |
| 5375 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5376 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5377 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5378 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5379 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5380 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5381 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5382 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5383 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5384 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5385 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5386 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5387 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5388 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5389 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5390 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5391 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5392 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5393 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5394 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5395 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5396 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5397 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5398 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5399 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5400 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5401 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5402 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5403 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5404 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5405 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5406 |
GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, GMENUITEM2_EMPTY, |
| 5407 |
GMENUITEM2_EMPTY |
| 5408 |
}; |
| 5409 |
|
| 5410 |
static void cdlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 5411 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 5412 |
int i, base, j; |
| 5413 |
SplineFont *sub, *cidmaster = fv->b.cidmaster; |
| 5414 |
|
| 5415 |
for ( i=0; cdlist[i].mid!=FV_MID_CIDFontInfo; ++i ); |
| 5416 |
base = i+2; |
| 5417 |
for ( i=base; cdlist[i].ti.text!=NULL; ++i ) { |
| 5418 |
free( cdlist[i].ti.text); |
| 5419 |
cdlist[i].ti.text = NULL; |
| 5420 |
} |
| 5421 |
|
| 5422 |
cdlist[base-1].ti.fg = cdlist[base-1].ti.bg = COLOR_DEFAULT; |
| 5423 |
if ( cidmaster==NULL ) { |
| 5424 |
cdlist[base-1].ti.line = false; |
| 5425 |
} else { |
| 5426 |
cdlist[base-1].ti.line = true; |
| 5427 |
for ( j = 0, i=base; |
| 5428 |
i<sizeof(cdlist)/sizeof(cdlist[0])-1 && j<cidmaster->subfontcnt; |
| 5429 |
++i, ++j ) { |
| 5430 |
sub = cidmaster->subfonts[j]; |
| 5431 |
cdlist[i].ti.text = uc_copy(sub->fontname); |
| 5432 |
cdlist[i].ti.checkable = true; |
| 5433 |
cdlist[i].ti.checked = sub==fv->b.sf; |
| 5434 |
cdlist[i].ti.userdata = sub; |
| 5435 |
cdlist[i].invoke = FVMenuShowSubFont; |
| 5436 |
cdlist[i].ti.fg = cdlist[i].ti.bg = COLOR_DEFAULT; |
| 5437 |
} |
| 5438 |
} |
| 5439 |
GMenuItemArrayFree(mi->sub); |
| 5440 |
mi->sub = GMenuItem2ArrayCopy(cdlist,NULL); |
| 5441 |
|
| 5442 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 5443 |
switch ( mi->mid ) { |
| 5444 |
case FV_MID_Convert2CID: case FV_MID_ConvertByCMap: |
| 5445 |
mi->ti.disabled = cidmaster!=NULL || fv->b.sf->mm!=NULL; |
| 5446 |
break; |
| 5447 |
case FV_MID_InsertFont: case FV_MID_InsertBlank: |
| 5448 |
|
| 5449 |
mi->ti.disabled = cidmaster==NULL || cidmaster->subfontcnt>=255; |
| 5450 |
break; |
| 5451 |
case FV_MID_RemoveFromCID: |
| 5452 |
mi->ti.disabled = cidmaster==NULL || cidmaster->subfontcnt<=1; |
| 5453 |
break; |
| 5454 |
case FV_MID_Flatten: case FV_MID_FlattenByCMap: case FV_MID_CIDFontInfo: |
| 5455 |
case FV_MID_ChangeSupplement: |
| 5456 |
mi->ti.disabled = cidmaster==NULL; |
| 5457 |
break; |
| 5458 |
} |
| 5459 |
} |
| 5460 |
} |
| 5461 |
|
| 5462 |
static GMenuItem2 mmlist[] = { |
| 5463 |
|
| 5464 |
{ { (unichar_t *) N_("_Create MM..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Create MM...|No Shortcut"), NULL, NULL, FVMenuCreateMM, FV_MID_CreateMM }, |
| 5465 |
{ { (unichar_t *) N_("MM _Validity Check"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("MM Validity Check|No Shortcut"), NULL, NULL, FVMenuMMValid, FV_MID_MMValid }, |
| 5466 |
{ { (unichar_t *) N_("MM _Info..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("MM Info...|No Shortcut"), NULL, NULL, FVMenuMMInfo, FV_MID_MMInfo }, |
| 5467 |
{ { (unichar_t *) N_("_Blend to New Font..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Blend to New Font...|No Shortcut"), NULL, NULL, FVMenuBlendToNew, FV_MID_BlendToNew }, |
| 5468 |
{ { (unichar_t *) N_("MM Change Default _Weights..."), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("MM Change Default Weights...|No Shortcut"), NULL, NULL, FVMenuChangeMMBlend, FV_MID_ChangeMMBlend }, |
| 5469 |
GMENUITEM2_EMPTY, |
| 5470 |
}; |
| 5471 |
|
| 5472 |
static void mmlistcheck(GWindow gw, struct gmenuitem *mi, GEvent *UNUSED(e)) { |
| 5473 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 5474 |
int i, base, j; |
| 5475 |
MMSet *mm = fv->b.sf->mm; |
| 5476 |
SplineFont *sub; |
| 5477 |
GMenuItem2 *mml; |
| 5478 |
|
| 5479 |
for ( i=0; mmlist[i].mid!=FV_MID_ChangeMMBlend; ++i ); |
| 5480 |
base = i+2; |
| 5481 |
if ( mm==NULL ) |
| 5482 |
mml = mmlist; |
| 5483 |
else { |
| 5484 |
mml = calloc(base+mm->instance_count+2,sizeof(GMenuItem2)); |
| 5485 |
memcpy(mml,mmlist,sizeof(mmlist)); |
| 5486 |
mml[base-1].ti.fg = mml[base-1].ti.bg = COLOR_DEFAULT; |
| 5487 |
mml[base-1].ti.line = true; |
| 5488 |
for ( j = 0, i=base; j<mm->instance_count+1; ++i, ++j ) { |
| 5489 |
if ( j==0 ) |
| 5490 |
sub = mm->normal; |
| 5491 |
else |
| 5492 |
sub = mm->instances[j-1]; |
| 5493 |
mml[i].ti.text = uc_copy(sub->fontname); |
| 5494 |
mml[i].ti.checkable = true; |
| 5495 |
mml[i].ti.checked = sub==fv->b.sf; |
| 5496 |
mml[i].ti.userdata = sub; |
| 5497 |
mml[i].invoke = FVMenuShowSubFont; |
| 5498 |
mml[i].ti.fg = mml[i].ti.bg = COLOR_DEFAULT; |
| 5499 |
} |
| 5500 |
} |
| 5501 |
GMenuItemArrayFree(mi->sub); |
| 5502 |
mi->sub = GMenuItem2ArrayCopy(mml,NULL); |
| 5503 |
if ( mml!=mmlist ) { |
| 5504 |
for ( i=base; mml[i].ti.text!=NULL; ++i ) |
| 5505 |
free( mml[i].ti.text); |
| 5506 |
free(mml); |
| 5507 |
} |
| 5508 |
|
| 5509 |
for ( mi = mi->sub; mi->ti.text!=NULL || mi->ti.line ; ++mi ) { |
| 5510 |
switch ( mi->mid ) { |
| 5511 |
case FV_MID_CreateMM: |
| 5512 |
mi->ti.disabled = false; |
| 5513 |
break; |
| 5514 |
case FV_MID_MMInfo: case FV_MID_MMValid: case FV_MID_BlendToNew: |
| 5515 |
mi->ti.disabled = mm==NULL; |
| 5516 |
break; |
| 5517 |
case FV_MID_ChangeMMBlend: |
| 5518 |
mi->ti.disabled = mm==NULL || mm->apple; |
| 5519 |
break; |
| 5520 |
} |
| 5521 |
} |
| 5522 |
} |
| 5523 |
|
| 5524 |
static GMenuItem2 wnmenu[] = { |
| 5525 |
{ { (unichar_t *) N_("New O_utline Window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'u' }, H_("New Outline Window|No Shortcut"), NULL, NULL, FVMenuOpenOutline, FV_MID_OpenOutline }, |
| 5526 |
{ { (unichar_t *) N_("New _Bitmap Window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'B' }, H_("New Bitmap Window|No Shortcut"), NULL, NULL, FVMenuOpenBitmap, FV_MID_OpenBitmap }, |
| 5527 |
{ { (unichar_t *) N_("New _Metrics Window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("New Metrics Window|No Shortcut"), NULL, NULL, FVMenuOpenMetrics, FV_MID_OpenMetrics }, |
| 5528 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5529 |
{ { (unichar_t *) N_("Warnings"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("Warnings|No Shortcut"), NULL, NULL, _MenuWarnings, FV_MID_Warnings }, |
| 5530 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, NULL, NULL, NULL, NULL, 0 }, |
| 5531 |
GMENUITEM2_EMPTY |
| 5532 |
}; |
| 5533 |
|
| 5534 |
static void FVWindowMenuBuild(GWindow gw, struct gmenuitem *mi, GEvent *e) { |
| 5535 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 5536 |
int anychars = FVAnyCharSelected(fv); |
| 5537 |
struct gmenuitem *wmi; |
| 5538 |
int in_modal = (fv->b.container!=NULL && fv->b.container->funcs->is_modal); |
| 5539 |
|
| 5540 |
WindowMenuBuild(gw,mi,e); |
| 5541 |
for ( wmi = mi->sub; wmi->ti.text!=NULL || wmi->ti.line ; ++wmi ) { |
| 5542 |
switch ( wmi->mid ) { |
| 5543 |
case FV_MID_OpenOutline: |
| 5544 |
wmi->ti.disabled = anychars==-1 || in_modal; |
| 5545 |
break; |
| 5546 |
case FV_MID_OpenBitmap: |
| 5547 |
wmi->ti.disabled = anychars==-1 || fv->b.sf->bitmaps==NULL || in_modal; |
| 5548 |
break; |
| 5549 |
case FV_MID_OpenMetrics: |
| 5550 |
wmi->ti.disabled = in_modal; |
| 5551 |
break; |
| 5552 |
case FV_MID_Warnings: |
| 5553 |
wmi->ti.disabled = ErrorWindowExists(); |
| 5554 |
break; |
| 5555 |
} |
| 5556 |
} |
| 5557 |
} |
| 5558 |
|
| 5559 |
GMenuItem2 helplist[] = { |
| 5560 |
{ { (unichar_t *) N_("_Help"), (GImage *) "helphelp.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("Help|F1"), NULL, NULL, FVMenuContextualHelp, 0 }, |
| 5561 |
{ { (unichar_t *) N_("_Overview"), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Overview|Shft+F1"), NULL, NULL, MenuHelp, 0 }, |
| 5562 |
{ { (unichar_t *) N_("_Index"), (GImage *) "helpindex.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, H_("Index|No Shortcut"), NULL, NULL, MenuIndex, 0 }, |
| 5563 |
{ { (unichar_t *) N_("_About..."), (GImage *) "helpabout.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'A' }, H_("About...|No Shortcut"), NULL, NULL, MenuAbout, 0 }, |
| 5564 |
{ { (unichar_t *) N_("_License..."), (GImage *) "menuempty.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'A' }, H_("License...|No Shortcut"), NULL, NULL, MenuLicense, 0 }, |
| 5565 |
GMENUITEM2_EMPTY |
| 5566 |
}; |
| 5567 |
|
| 5568 |
GMenuItem fvpopupmenu[] = { |
| 5569 |
{ { (unichar_t *) N_("New O_utline Window"), 0, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'u' }, '\0', ksm_control, NULL, NULL, FVMenuOpenOutline, FV_MID_OpenOutline }, |
| 5570 |
GMENUITEM_LINE, |
| 5571 |
{ { (unichar_t *) N_("Cu_t"), (GImage *) "editcut.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 't' }, '\0', ksm_control, NULL, NULL, FVMenuCut, FV_MID_Cut }, |
| 5572 |
{ { (unichar_t *) N_("_Copy"), (GImage *) "editcopy.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, '\0', ksm_control, NULL, NULL, FVMenuCopy, FV_MID_Copy }, |
| 5573 |
{ { (unichar_t *) N_("C_opy Reference"), (GImage *) "editcopyref.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'o' }, '\0', ksm_control, NULL, NULL, FVMenuCopyRef, FV_MID_CopyRef }, |
| 5574 |
{ { (unichar_t *) N_("Copy _Width"), (GImage *) "editcopywidth.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'W' }, '\0', ksm_control, NULL, NULL, FVMenuCopyWidth, FV_MID_CopyWidth }, |
| 5575 |
{ { (unichar_t *) N_("_Paste"), (GImage *) "editpaste.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'P' }, '\0', ksm_control, NULL, NULL, FVMenuPaste, FV_MID_Paste }, |
| 5576 |
{ { (unichar_t *) N_("C_lear"), (GImage *) "editclear.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, 0, 0, NULL, NULL, FVMenuClear, FV_MID_Clear }, |
| 5577 |
{ { (unichar_t *) N_("Copy _Fg To Bg"), (GImage *) "editcopyfg2bg.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, '\0', ksm_control|ksm_shift, NULL, NULL, FVMenuCopyFgBg, FV_MID_CopyFgToBg }, |
| 5578 |
{ { (unichar_t *) N_("U_nlink Reference"), (GImage *) "editunlink.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'U' }, '\0', ksm_control, NULL, NULL, FVMenuUnlinkRef, FV_MID_UnlinkRef }, |
| 5579 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, '\0', 0, NULL, NULL, NULL, 0 }, |
| 5580 |
{ { (unichar_t *) N_("Glyph _Info..."), (GImage *) "elementglyphinfo.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, '\0', ksm_control, NULL, NULL, FVMenuCharInfo, FV_MID_CharInfo }, |
| 5581 |
{ { (unichar_t *) N_("_Transform..."), (GImage *) "elementtransform.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'T' }, '\0', ksm_control, NULL, NULL, FVMenuTransform, FV_MID_Transform }, |
| 5582 |
{ { (unichar_t *) N_("_Expand Stroke..."), (GImage *) "elementexpandstroke.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'E' }, '\0', ksm_control|ksm_shift, NULL, NULL, FVMenuStroke, FV_MID_Stroke }, |
| 5583 |
{ { (unichar_t *) N_("To _Int"), (GImage *) "elementround.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'I' }, '\0', ksm_control|ksm_shift, NULL, NULL, FVMenuRound2Int, FV_MID_Round }, |
| 5584 |
{ { (unichar_t *) N_("_Correct Direction"), (GImage *) "elementcorrectdir.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'D' }, '\0', ksm_control|ksm_shift, NULL, NULL, FVMenuCorrectDir, FV_MID_Correct }, |
| 5585 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, '\0', 0, NULL, NULL, NULL, 0 }, |
| 5586 |
{ { (unichar_t *) N_("Auto_Hint"), (GImage *) "hintsautohint.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, '\0', ksm_control|ksm_shift, NULL, NULL, FVMenuAutoHint, FV_MID_AutoHint }, |
| 5587 |
{ { NULL, NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 1, 0, 0, 0, '\0' }, '\0', 0, NULL, NULL, NULL, 0 }, |
| 5588 |
{ { (unichar_t *) N_("_Center in Width"), (GImage *) "metricscenter.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, '\0', ksm_control, NULL, NULL, FVMenuCenter, FV_MID_Center }, |
| 5589 |
{ { (unichar_t *) N_("Set _Width..."), (GImage *) "metricssetwidth.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'W' }, '\0', ksm_control|ksm_shift, NULL, NULL, FVMenuSetWidth, FV_MID_SetWidth }, |
| 5590 |
{ { (unichar_t *) N_("Set _Vertical Advance..."), (GImage *) "metricssetvwidth.png", COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'V' }, '\0', ksm_control|ksm_shift, NULL, NULL, FVMenuSetWidth, FV_MID_SetVWidth }, |
| 5591 |
GMENUITEM_EMPTY |
| 5592 |
}; |
| 5593 |
|
| 5594 |
static GMenuItem2 mblist[] = { |
| 5595 |
{ { (unichar_t *) N_("_File"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'F' }, H_("File|No Shortcut"), fllist, fllistcheck, NULL, 0 }, |
| 5596 |
{ { (unichar_t *) N_("_Edit"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'E' }, H_("Edit|No Shortcut"), edlist, edlistcheck, NULL, 0 }, |
| 5597 |
{ { (unichar_t *) N_("E_lement"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, H_("Element|No Shortcut"), ellist, ellistcheck, NULL, 0 }, |
| 5598 |
#ifndef _NO_PYTHON |
| 5599 |
{ { (unichar_t *) N_("_Tools"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 1, 1, 0, 0, 0, 0, 1, 1, 0, 'l' }, H_("Tools|No Shortcut"), NULL, fvpy_tllistcheck, NULL, 0 }, |
| 5600 |
#endif |
| 5601 |
{ { (unichar_t *) N_("H_ints"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'i' }, H_("Hints|No Shortcut"), htlist, htlistcheck, NULL, 0 }, |
| 5602 |
{ { (unichar_t *) N_("E_ncoding"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'V' }, H_("Encoding|No Shortcut"), enlist, enlistcheck, NULL, 0 }, |
| 5603 |
{ { (unichar_t *) N_("_View"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'V' }, H_("View|No Shortcut"), vwlist, vwlistcheck, NULL, 0 }, |
| 5604 |
{ { (unichar_t *) N_("_Metrics"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'M' }, H_("Metrics|No Shortcut"), mtlist, mtlistcheck, NULL, 0 }, |
| 5605 |
{ { (unichar_t *) N_("_CID"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'C' }, H_("CID|No Shortcut"), cdlist, cdlistcheck, NULL, 0 }, |
| 5606 |
|
| 5607 |
{ { (unichar_t *) N_("MM"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, '\0' }, H_("MM|No Shortcut"), mmlist, mmlistcheck, NULL, 0 }, |
| 5608 |
{ { (unichar_t *) N_("_Window"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'W' }, H_("Window|No Shortcut"), wnmenu, FVWindowMenuBuild, NULL, 0 }, |
| 5609 |
{ { (unichar_t *) N_("_Help"), NULL, COLOR_DEFAULT, COLOR_DEFAULT, NULL, NULL, 0, 1, 0, 0, 0, 0, 1, 1, 0, 'H' }, H_("Help|No Shortcut"), helplist, NULL, NULL, 0 }, |
| 5610 |
GMENUITEM2_EMPTY |
| 5611 |
}; |
| 5612 |
|
| 5613 |
void FVRefreshChar(FontView *fv,int gid) { |
| 5614 |
BDFChar *bdfc; |
| 5615 |
int i, enc; |
| 5616 |
MetricsView *mv; |
| 5617 |
|
| 5618 |
|
| 5619 |
if ( fv->v==NULL || fv->colcnt==0 || fv->b.sf->glyphs[gid]== NULL ) |
| 5620 |
return; |
| 5621 |
for ( fv=(FontView *) (fv->b.sf->fv); fv!=NULL; fv = (FontView *) (fv->b.nextsame) ) { |
| 5622 |
if( !fv->colcnt ) |
| 5623 |
continue; |
| 5624 |
|
| 5625 |
for ( mv=fv->b.sf->metrics; mv!=NULL; mv=mv->next ) |
| 5626 |
MVRefreshChar(mv,fv->b.sf->glyphs[gid]); |
| 5627 |
if ( fv->show==fv->filled ) |
| 5628 |
bdfc = BDFPieceMealCheck(fv->show,gid); |
| 5629 |
else |
| 5630 |
bdfc = fv->show->glyphs[gid]; |
| 5631 |
if ( bdfc==NULL ) |
| 5632 |
bdfc = BDFPieceMeal(fv->show,gid); |
| 5633 |
|
| 5634 |
for ( enc = 0; enc<fv->b.map->enccount; ++enc ) if ( fv->b.map->map[enc]==gid ) { |
| 5635 |
i = enc / fv->colcnt; |
| 5636 |
i -= fv->rowoff; |
| 5637 |
if ( i>=0 && i<fv->rowcnt ) |
| 5638 |
FVDrawGlyph(fv->v,fv,enc,true); |
| 5639 |
} |
| 5640 |
} |
| 5641 |
} |
| 5642 |
|
| 5643 |
void FVRegenChar(FontView *fv,SplineChar *sc) { |
| 5644 |
struct splinecharlist *dlist; |
| 5645 |
MetricsView *mv; |
| 5646 |
|
| 5647 |
if ( fv->v==NULL ) |
| 5648 |
return; |
| 5649 |
|
| 5650 |
if ( sc->orig_pos<fv->filled->glyphcnt ) { |
| 5651 |
BDFCharFree(fv->filled->glyphs[sc->orig_pos]); |
| 5652 |
fv->filled->glyphs[sc->orig_pos] = NULL; |
| 5653 |
} |
| 5654 |
|
| 5655 |
for ( mv=fv->b.sf->metrics; mv!=NULL; mv=mv->next ) |
| 5656 |
MVRegenChar(mv,sc); |
| 5657 |
|
| 5658 |
FVRefreshChar(fv,sc->orig_pos); |
| 5659 |
#if HANYANG |
| 5660 |
if ( sc->compositionunit && fv->b.sf->rules!=NULL ) |
| 5661 |
Disp_RefreshChar(fv->b.sf,sc); |
| 5662 |
#endif |
| 5663 |
|
| 5664 |
for ( dlist=sc->dependents; dlist!=NULL; dlist=dlist->next ) |
| 5665 |
FVRegenChar(fv,dlist->sc); |
| 5666 |
} |
| 5667 |
|
| 5668 |
static void AddSubPST(SplineChar *sc,struct lookup_subtable *sub,char *variant) { |
| 5669 |
PST *pst; |
| 5670 |
|
| 5671 |
pst = chunkalloc(sizeof(PST)); |
| 5672 |
pst->type = pst_substitution; |
| 5673 |
pst->subtable = sub; |
| 5674 |
pst->u.alt.components = copy(variant); |
| 5675 |
pst->next = sc->possub; |
| 5676 |
sc->possub = pst; |
| 5677 |
} |
| 5678 |
|
| 5679 |
SplineChar *FVMakeChar(FontView *fv,int enc) { |
| 5680 |
SplineFont *sf = fv->b.sf; |
| 5681 |
SplineChar *base_sc = SFMakeChar(sf,fv->b.map,enc), *feat_sc = NULL; |
| 5682 |
int feat_gid = FeatureTrans(fv,enc); |
| 5683 |
|
| 5684 |
if ( fv->cur_subtable==NULL ) |
| 5685 |
return( base_sc ); |
| 5686 |
|
| 5687 |
if ( feat_gid==-1 ) { |
| 5688 |
int uni = -1; |
| 5689 |
FeatureScriptLangList *fl = fv->cur_subtable->lookup->features; |
| 5690 |
|
| 5691 |
if ( base_sc->unicodeenc>=0x600 && base_sc->unicodeenc<=0x6ff && |
| 5692 |
fl!=NULL && |
| 5693 |
(fl->featuretag == CHR('i','n','i','t') || |
| 5694 |
fl->featuretag == CHR('m','e','d','i') || |
| 5695 |
fl->featuretag == CHR('f','i','n','a') || |
| 5696 |
fl->featuretag == CHR('i','s','o','l')) ) { |
| 5697 |
uni = fl->featuretag == CHR('i','n','i','t') ? arabicform(base_sc->unicodeenc)->initial : |
| 5698 |
fl->featuretag == CHR('m','e','d','i') ? arabicform(base_sc->unicodeenc)->medial : |
| 5699 |
fl->featuretag == CHR('f','i','n','a') ? arabicform(base_sc->unicodeenc)->final : |
| 5700 |
fl->featuretag == CHR('i','s','o','l') ? arabicform(base_sc->unicodeenc)->isolated : |
| 5701 |
-1; |
| 5702 |
feat_sc = SFGetChar(sf,uni,NULL); |
| 5703 |
if ( feat_sc!=NULL ) |
| 5704 |
return( feat_sc ); |
| 5705 |
} |
| 5706 |
feat_sc = SFSplineCharCreate(sf); |
| 5707 |
feat_sc->unicodeenc = uni; |
| 5708 |
if ( uni!=-1 ) { |
| 5709 |
feat_sc->name = malloc(8); |
| 5710 |
feat_sc->unicodeenc = uni; |
| 5711 |
sprintf( feat_sc->name,"uni%04X", uni ); |
| 5712 |
} else if ( fv->cur_subtable->suffix!=NULL ) { |
| 5713 |
feat_sc->name = malloc(strlen(base_sc->name)+strlen(fv->cur_subtable->suffix)+2); |
| 5714 |
sprintf( feat_sc->name, "%s.%s", base_sc->name, fv->cur_subtable->suffix ); |
| 5715 |
} else if ( fl==NULL ) { |
| 5716 |
feat_sc->name = strconcat(base_sc->name,".unknown"); |
| 5717 |
} else if ( fl->ismac ) { |
| 5718 |
|
| 5719 |
feat_sc->name = malloc(strlen(base_sc->name)+14); |
| 5720 |
sprintf( feat_sc->name,"%s.m%d_%d", base_sc->name, |
| 5721 |
(int) (fl->featuretag>>16), |
| 5722 |
(int) ((fl->featuretag)&0xffff) ); |
| 5723 |
} else { |
| 5724 |
|
| 5725 |
feat_sc->name = malloc(strlen(base_sc->name)+6); |
| 5726 |
sprintf( feat_sc->name,"%s.%c%c%c%c", base_sc->name, |
| 5727 |
(int) (fl->featuretag>>24), |
| 5728 |
(int) ((fl->featuretag>>16)&0xff), |
| 5729 |
(int) ((fl->featuretag>>8)&0xff), |
| 5730 |
(int) ((fl->featuretag)&0xff) ); |
| 5731 |
} |
| 5732 |
SFAddGlyphAndEncode(sf,feat_sc,fv->b.map,fv->b.map->enccount); |
| 5733 |
AddSubPST(base_sc,fv->cur_subtable,feat_sc->name); |
| 5734 |
return( feat_sc ); |
| 5735 |
} else |
| 5736 |
return( base_sc ); |
| 5737 |
} |
| 5738 |
|
| 5739 |
|
| 5740 |
#define _uni_italic 0x2 |
| 5741 |
#define _uni_vertical (1<<2) |
| 5742 |
#define _uni_fontmax (2<<2) |
| 5743 |
|
| 5744 |
static GFont *FVCheckFont(FontView *fv,int type) { |
| 5745 |
FontRequest rq; |
| 5746 |
|
| 5747 |
if ( fv->fontset[type]==NULL ) { |
| 5748 |
memset(&rq, 0, sizeof(rq)); |
| 5749 |
GDrawDecomposeFont(fv_font.fi, &rq); |
| 5750 |
rq.style = 0; |
| 5751 |
if (type&_uni_italic) |
| 5752 |
rq.style |= fs_italic; |
| 5753 |
if (type&_uni_vertical) |
| 5754 |
rq.style |= fs_vertical; |
| 5755 |
fv->fontset[type] = GDrawInstanciateFont(fv->v,&rq); |
| 5756 |
} |
| 5757 |
return( fv->fontset[type] ); |
| 5758 |
} |
| 5759 |
|
| 5760 |
extern unichar_t adobes_pua_alts[0x200][3]; |
| 5761 |
|
| 5762 |
static void do_Adobe_Pua(unichar_t *buf,int sob,int uni) { |
| 5763 |
int i, j; |
| 5764 |
|
| 5765 |
for ( i=j=0; j<sob-1 && i<3; ++i ) { |
| 5766 |
int ch = adobes_pua_alts[uni-0xf600][i]; |
| 5767 |
if ( ch==0 ) |
| 5768 |
break; |
| 5769 |
if ( ch>=0xf600 && ch<=0xf7ff && adobes_pua_alts[ch-0xf600][0]!=0 ) { |
| 5770 |
do_Adobe_Pua(buf+j,sob-j,ch); |
| 5771 |
while ( buf[j]!=0 ) ++j; |
| 5772 |
} else |
| 5773 |
buf[j++] = ch; |
| 5774 |
} |
| 5775 |
buf[j] = 0; |
| 5776 |
} |
| 5777 |
|
| 5778 |
static void FVExpose(FontView *fv,GWindow pixmap, GEvent *event) { |
| 5779 |
int i, j, y, width, gid; |
| 5780 |
int changed; |
| 5781 |
GRect old, old2, r; |
| 5782 |
GClut clut; |
| 5783 |
struct _GImage base; |
| 5784 |
GImage gi; |
| 5785 |
SplineChar dummy; |
| 5786 |
int styles, laststyles=0; |
| 5787 |
Color bg; |
| 5788 |
int fgxor; |
| 5789 |
|
| 5790 |
memset(&gi,'\0',sizeof(gi)); |
| 5791 |
memset(&base,'\0',sizeof(base)); |
| 5792 |
if ( fv->show->clut!=NULL ) { |
| 5793 |
gi.u.image = &base; |
| 5794 |
base.image_type = it_index; |
| 5795 |
base.clut = fv->show->clut; |
| 5796 |
GDrawSetDither(NULL, false); |
| 5797 |
base.trans = -1; |
| 5798 |
} else { |
| 5799 |
memset(&clut,'\0',sizeof(clut)); |
| 5800 |
gi.u.image = &base; |
| 5801 |
base.image_type = it_mono; |
| 5802 |
base.clut = &clut; |
| 5803 |
clut.clut_len = 2; |
| 5804 |
clut.clut[0] = view_bgcol; |
| 5805 |
} |
| 5806 |
|
| 5807 |
GDrawSetFont(pixmap,fv->fontset[0]); |
| 5808 |
GDrawSetLineWidth(pixmap,0); |
| 5809 |
GDrawPushClip(pixmap,&event->u.expose.rect,&old); |
| 5810 |
GDrawFillRect(pixmap,NULL,view_bgcol); |
| 5811 |
for ( i=0; i<=fv->rowcnt; ++i ) { |
| 5812 |
GDrawDrawLine(pixmap,0,i*fv->cbh,fv->width,i*fv->cbh,fvslotcol); |
| 5813 |
GDrawDrawLine(pixmap,0,i*fv->cbh+fv->lab_height,fv->width,i*fv->cbh+fv->lab_height,fvslotdivcol); |
| 5814 |
} |
| 5815 |
for ( i=0; i<=fv->colcnt; ++i ) |
| 5816 |
GDrawDrawLine(pixmap,i*fv->cbw,0,i*fv->cbw,fv->height,fvslotcol); |
| 5817 |
for ( i=event->u.expose.rect.y/fv->cbh; i<=fv->rowcnt && |
| 5818 |
i<(event->u.expose.rect.y+event->u.expose.rect.height+fv->cbh-1)/fv->cbh; ++i ) |
| 5819 |
for ( j=event->u.expose.rect.x/fv->cbw; j<fv->colcnt && |
| 5820 |
j<(event->u.expose.rect.x+event->u.expose.rect.width+fv->cbw-1)/fv->cbw; ++j ) { |
| 5821 |
int index = (i+fv->rowoff)*fv->colcnt+j; |
| 5822 |
SplineChar *sc; |
| 5823 |
styles = 0; |
| 5824 |
if ( index < fv->b.map->enccount && index!=-1 ) { |
| 5825 |
unichar_t buf[60]; char cbuf[8]; |
| 5826 |
char utf8_buf[8]; |
| 5827 |
int use_utf8 = false; |
| 5828 |
Color fg; |
| 5829 |
int uni; |
| 5830 |
struct cidmap *cidmap = NULL; |
| 5831 |
sc = (gid=fv->b.map->map[index])!=-1 ? fv->b.sf->glyphs[gid]: NULL; |
| 5832 |
|
| 5833 |
if ( fv->b.cidmaster!=NULL ) |
| 5834 |
cidmap = FindCidMap(fv->b.cidmaster->cidregistry,fv->b.cidmaster->ordering,fv->b.cidmaster->supplement,fv->b.cidmaster); |
| 5835 |
|
| 5836 |
if ( ( fv->b.map->enc==&custom && index<256 ) || |
| 5837 |
( fv->b.map->enc!=&custom && index<fv->b.map->enc->char_cnt ) || |
| 5838 |
( cidmap!=NULL && index<MaxCID(cidmap) )) |
| 5839 |
fg = fvlabelcol; |
| 5840 |
else |
| 5841 |
fg = fvunenclabelcol; |
| 5842 |
if ( sc==NULL ) |
| 5843 |
sc = SCBuildDummy(&dummy,fv->b.sf,fv->b.map,index); |
| 5844 |
uni = sc->unicodeenc; |
| 5845 |
buf[0] = buf[1] = 0; |
| 5846 |
if ( fv->b.sf->uni_interp==ui_ams && uni>=0xe000 && uni<=0xf8ff && |
| 5847 |
amspua[uni-0xe000]!=0 ) |
| 5848 |
uni = amspua[uni-0xe000]; |
| 5849 |
switch ( fv->glyphlabel ) { |
| 5850 |
case gl_name: |
| 5851 |
uc_strncpy(buf,sc->name,sizeof(buf)/sizeof(buf[0])); |
| 5852 |
break; |
| 5853 |
case gl_unicode: |
| 5854 |
if ( sc->unicodeenc!=-1 ) { |
| 5855 |
sprintf(cbuf,"%04x",sc->unicodeenc); |
| 5856 |
uc_strcpy(buf,cbuf); |
| 5857 |
} else |
| 5858 |
uc_strcpy(buf,"?"); |
| 5859 |
break; |
| 5860 |
case gl_encoding: |
| 5861 |
if ( fv->b.map->enc->only_1byte || |
| 5862 |
(fv->b.map->enc->has_1byte && index<256)) |
| 5863 |
sprintf(cbuf,"%02x",index); |
| 5864 |
else |
| 5865 |
sprintf(cbuf,"%04x",index); |
| 5866 |
uc_strcpy(buf,cbuf); |
| 5867 |
break; |
| 5868 |
case gl_glyph: |
| 5869 |
if ( uni==0xad ) |
| 5870 |
buf[0] = '-'; |
| 5871 |
else if ( fv->b.sf->uni_interp==ui_adobe && uni>=0xf600 && uni<=0xf7ff && |
| 5872 |
adobes_pua_alts[uni-0xf600][0]!=0 ) { |
| 5873 |
use_utf8 = false; |
| 5874 |
do_Adobe_Pua(buf,sizeof(buf),uni); |
| 5875 |
} else if ( uni>=0xe0020 && uni<=0xe007e ) { |
| 5876 |
buf[0] = uni-0xe0000; |
| 5877 |
#if HANYANG |
| 5878 |
} else if ( sc->compositionunit ) { |
| 5879 |
if ( sc->jamo<19 ) |
| 5880 |
buf[0] = 0x1100+sc->jamo; |
| 5881 |
else if ( sc->jamo<19+21 ) |
| 5882 |
buf[0] = 0x1161 + sc->jamo-19; |
| 5883 |
else |
| 5884 |
buf[0] = 0x11a8 + sc->jamo-(19+21+1); |
| 5885 |
#endif |
| 5886 |
} else if ( uni>0 && uni<unicode4_size ) { |
| 5887 |
char *pt = utf8_buf; |
| 5888 |
use_utf8 = true; |
| 5889 |
*pt = '\0'; |
| 5890 |
pt = utf8_idpb(pt,uni,0); |
| 5891 |
if (pt) *pt = '\0'; |
| 5892 |
else if (uni<0xd800 || uni>0xdfff) |
| 5893 |
TRACE("Invalid Unicode alert.\n"); |
| 5894 |
} else { |
| 5895 |
char *pt = strchr(sc->name,'.'); |
| 5896 |
buf[0] = '?'; |
| 5897 |
fg = fvmissinglabelcol; |
| 5898 |
if ( pt!=NULL ) { |
| 5899 |
int i, n = pt-sc->name; |
| 5900 |
char *end; |
| 5901 |
SplineFont *cm = fv->b.sf->cidmaster; |
| 5902 |
if ( n==7 && sc->name[0]=='u' && sc->name[1]=='n' && sc->name[2]=='i' && |
| 5903 |
(i=strtol(sc->name+3,&end,16), end-sc->name==7)) |
| 5904 |
buf[0] = i; |
| 5905 |
else if ( n>=5 && n<=7 && sc->name[0]=='u' && |
| 5906 |
(i=strtol(sc->name+1,&end,16), end-sc->name==n)) |
| 5907 |
buf[0] = i; |
| 5908 |
else if ( cm!=NULL && (i=CIDFromName(sc->name,cm))!=-1 ) { |
| 5909 |
int uni; |
| 5910 |
uni = CID2Uni(FindCidMap(cm->cidregistry,cm->ordering,cm->supplement,cm), |
| 5911 |
i); |
| 5912 |
if ( uni!=-1 ) |
| 5913 |
buf[0] = uni; |
| 5914 |
} else { |
| 5915 |
int uni; |
| 5916 |
*pt = '\0'; |
| 5917 |
uni = UniFromName(sc->name,fv->b.sf->uni_interp,fv->b.map->enc); |
| 5918 |
if ( uni!=-1 ) |
| 5919 |
buf[0] = uni; |
| 5920 |
*pt = '.'; |
| 5921 |
} |
| 5922 |
if ( strstr(pt,".vert")!=NULL ) |
| 5923 |
styles = _uni_vertical; |
| 5924 |
if ( buf[0]!='?' ) { |
| 5925 |
fg = fvlabelcol; |
| 5926 |
if ( strstr(pt,".italic")!=NULL ) |
| 5927 |
styles = _uni_italic; |
| 5928 |
} |
| 5929 |
} else if ( strncmp(sc->name,"hwuni",5)==0 ) { |
| 5930 |
int uni=-1; |
| 5931 |
sscanf(sc->name,"hwuni%x", (unsigned *) &uni ); |
| 5932 |
if ( uni!=-1 ) buf[0] = uni; |
| 5933 |
} else if ( strncmp(sc->name,"italicuni",9)==0 ) { |
| 5934 |
int uni=-1; |
| 5935 |
sscanf(sc->name,"italicuni%x", (unsigned *) &uni ); |
| 5936 |
if ( uni!=-1 ) { buf[0] = uni; styles=_uni_italic; } |
| 5937 |
fg = fvlabelcol; |
| 5938 |
} else if ( strncmp(sc->name,"vertcid_",8)==0 || |
| 5939 |
strncmp(sc->name,"vertuni",7)==0 ) { |
| 5940 |
styles = _uni_vertical; |
| 5941 |
} |
| 5942 |
} |
| 5943 |
break; |
| 5944 |
} |
| 5945 |
r.x = j*fv->cbw+1; r.width = fv->cbw-1; |
| 5946 |
r.y = i*fv->cbh+1; r.height = fv->lab_height-1; |
| 5947 |
bg = view_bgcol; |
| 5948 |
fgxor = 0x000000; |
| 5949 |
changed = sc->changed; |
| 5950 |
if ( fv->b.sf->onlybitmaps && gid<fv->show->glyphcnt ) |
| 5951 |
changed = gid==-1 || fv->show->glyphs[gid]==NULL? false : fv->show->glyphs[gid]->changed; |
| 5952 |
if ( changed || |
| 5953 |
sc->layers[ly_back].splines!=NULL || sc->layers[ly_back].images!=NULL || |
| 5954 |
sc->color!=COLOR_DEFAULT ) { |
| 5955 |
if ( sc->layers[ly_back].splines!=NULL || sc->layers[ly_back].images!=NULL || |
| 5956 |
sc->color!=COLOR_DEFAULT ) |
| 5957 |
bg = sc->color!=COLOR_DEFAULT?sc->color:0x808080; |
| 5958 |
if ( sc->changed ) { |
| 5959 |
fgxor = bg ^ fvchangedcol; |
| 5960 |
bg = fvchangedcol; |
| 5961 |
} |
| 5962 |
GDrawFillRect(pixmap,&r,bg); |
| 5963 |
} |
| 5964 |
if ( (!fv->b.sf->layers[fv->b.active_layer].order2 && sc->changedsincelasthinted ) || |
| 5965 |
( fv->b.sf->layers[fv->b.active_layer].order2 && sc->layers[fv->b.active_layer].splines!=NULL && |
| 5966 |
sc->ttf_instrs_len<=0 ) || |
| 5967 |
( fv->b.sf->layers[fv->b.active_layer].order2 && sc->instructions_out_of_date ) ) { |
| 5968 |
Color hintcol = fvhintingneededcol; |
| 5969 |
if ( fv->b.sf->layers[fv->b.active_layer].order2 && sc->instructions_out_of_date && sc->ttf_instrs_len>0 ) |
| 5970 |
hintcol = GDrawGetWarningForeground(NULL); |
| 5971 |
GDrawDrawLine(pixmap,r.x,r.y,r.x,r.y+r.height-1,hintcol); |
| 5972 |
GDrawDrawLine(pixmap,r.x+1,r.y,r.x+1,r.y+r.height-1,hintcol); |
| 5973 |
GDrawDrawLine(pixmap,r.x+2,r.y,r.x+2,r.y+r.height-1,hintcol); |
| 5974 |
GDrawDrawLine(pixmap,r.x+r.width-1,r.y,r.x+r.width-1,r.y+r.height-1,hintcol); |
| 5975 |
GDrawDrawLine(pixmap,r.x+r.width-2,r.y,r.x+r.width-2,r.y+r.height-1,hintcol); |
| 5976 |
GDrawDrawLine(pixmap,r.x+r.width-3,r.y,r.x+r.width-3,r.y+r.height-1,hintcol); |
| 5977 |
} |
| 5978 |
if ( use_utf8 && sc->unicodeenc!=-1 && |
| 5979 |
|
| 5980 |
|
| 5981 |
((sc->unicodeenc&0xffff)==0xfffe || (sc->unicodeenc&0xffff)==0xffff || |
| 5982 |
(sc->unicodeenc>=0xfdd0 && sc->unicodeenc<=0xfdef) || |
| 5983 |
(sc->unicodeenc>=0xfe00 && sc->unicodeenc<=0xfe0f) || |
| 5984 |
(sc->unicodeenc>=0xe0110 && sc->unicodeenc<=0xe01ff) || |
| 5985 |
|
| 5986 |
(sc->unicodeenc>=0xd800 && sc->unicodeenc<=0xdfff))) { |
| 5987 |
GDrawDrawLine(pixmap,r.x,r.y,r.x+r.width-1,r.y+r.height-1,0x000000); |
| 5988 |
GDrawDrawLine(pixmap,r.x,r.y+r.height-1,r.x+r.width-1,r.y,0x000000); |
| 5989 |
} else if ( use_utf8 ) { |
| 5990 |
GTextBounds size; |
| 5991 |
if ( styles!=laststyles ) GDrawSetFont(pixmap,FVCheckFont(fv,styles)); |
| 5992 |
width = GDrawGetText8Bounds(pixmap,utf8_buf,-1,&size); |
| 5993 |
if ( size.lbearing==0 && size.rbearing==0 ) { |
| 5994 |
utf8_buf[0] = 0xe0 | (0xfffd>>12); |
| 5995 |
utf8_buf[1] = 0x80 | ((0xfffd>>6)&0x3f); |
| 5996 |
utf8_buf[2] = 0x80 | (0xfffd&0x3f); |
| 5997 |
utf8_buf[3] = 0; |
| 5998 |
width = GDrawGetText8Bounds(pixmap,utf8_buf,-1,&size); |
| 5999 |
} |
| 6000 |
width = size.rbearing - size.lbearing+1; |
| 6001 |
if ( width >= fv->cbw-1 ) { |
| 6002 |
GDrawPushClip(pixmap,&r,&old2); |
| 6003 |
width = fv->cbw-1; |
| 6004 |
} |
| 6005 |
if ( sc->unicodeenc<0x80 || sc->unicodeenc>=0xa0 ) { |
| 6006 |
y = i*fv->cbh+fv->lab_as+1; |
| 6007 |
|
| 6008 |
if (styles&_uni_vertical) |
| 6009 |
y -= fv->lab_as/2; |
| 6010 |
GDrawDrawText8(pixmap,j*fv->cbw+(fv->cbw-1-width)/2-size.lbearing,y,utf8_buf,-1,fg^fgxor); |
| 6011 |
} |
| 6012 |
if ( width >= fv->cbw-1 ) |
| 6013 |
GDrawPopClip(pixmap,&old2); |
| 6014 |
laststyles = styles; |
| 6015 |
} else { |
| 6016 |
if ( styles!=laststyles ) GDrawSetFont(pixmap,FVCheckFont(fv,styles)); |
| 6017 |
width = GDrawGetTextWidth(pixmap,buf,-1); |
| 6018 |
if ( width >= fv->cbw-1 ) { |
| 6019 |
GDrawPushClip(pixmap,&r,&old2); |
| 6020 |
width = fv->cbw-1; |
| 6021 |
} |
| 6022 |
if ( sc->unicodeenc<0x80 || sc->unicodeenc>=0xa0 ) { |
| 6023 |
y = i*fv->cbh+fv->lab_as+1; |
| 6024 |
|
| 6025 |
if (styles&_uni_vertical) |
| 6026 |
y -= fv->lab_as/2; |
| 6027 |
GDrawDrawText(pixmap,j*fv->cbw+(fv->cbw-1-width)/2,y,buf,-1,fg^fgxor); |
| 6028 |
} |
| 6029 |
if ( width >= fv->cbw-1 ) |
| 6030 |
GDrawPopClip(pixmap,&old2); |
| 6031 |
laststyles = styles; |
| 6032 |
} |
| 6033 |
} |
| 6034 |
FVDrawGlyph(pixmap,fv,index,false); |
| 6035 |
} |
| 6036 |
if ( fv->showhmetrics&fvm_baseline ) { |
| 6037 |
for ( i=0; i<=fv->rowcnt; ++i ) |
| 6038 |
GDrawDrawLine(pixmap,0,i*fv->cbh+fv->lab_height+fv->magnify*fv->show->ascent+1,fv->width,i*fv->cbh+fv->lab_height+fv->magnify*fv->show->ascent+1,fvmetbaselinecol); |
| 6039 |
} |
| 6040 |
GDrawPopClip(pixmap,&old); |
| 6041 |
GDrawSetDither(NULL, true); |
| 6042 |
} |
| 6043 |
|
| 6044 |
void FVDrawInfo(FontView *fv,GWindow pixmap, GEvent *event) { |
| 6045 |
GRect old, r; |
| 6046 |
Color bg = GDrawGetDefaultBackground(GDrawGetDisplayOfWindow(pixmap)); |
| 6047 |
Color fg = fvglyphinfocol; |
| 6048 |
SplineChar *sc, dummy; |
| 6049 |
SplineFont *sf = fv->b.sf; |
| 6050 |
EncMap *map = fv->b.map; |
| 6051 |
int gid, uni, localenc; |
| 6052 |
GString *output = g_string_new( "" ); |
| 6053 |
char *uniname = NULL; |
| 6054 |
|
| 6055 |
if ( event->u.expose.rect.y+event->u.expose.rect.height<=fv->mbh ) { |
| 6056 |
g_string_free( output, TRUE ); output = NULL; |
| 6057 |
return; |
| 6058 |
} |
| 6059 |
|
| 6060 |
GDrawSetFont(pixmap,fv->fontset[0]); |
| 6061 |
GDrawPushClip(pixmap,&event->u.expose.rect,&old); |
| 6062 |
|
| 6063 |
r.x = 0; r.width = fv->width; r.y = fv->mbh; r.height = fv->infoh; |
| 6064 |
GDrawFillRect(pixmap,&r,bg); |
| 6065 |
if ( fv->end_pos>=map->enccount || fv->pressed_pos>=map->enccount || |
| 6066 |
fv->end_pos<0 || fv->pressed_pos<0 ) |
| 6067 |
fv->end_pos = fv->pressed_pos = -1; |
| 6068 |
if ( fv->end_pos == -1 ) { |
| 6069 |
g_string_free( output, TRUE ); output = NULL; |
| 6070 |
GDrawPopClip(pixmap,&old); |
| 6071 |
return; |
| 6072 |
} |
| 6073 |
|
| 6074 |
localenc = fv->end_pos; |
| 6075 |
if ( map->remap!=NULL ) { |
| 6076 |
struct remap *remap = map->remap; |
| 6077 |
while ( remap->infont!=-1 ) { |
| 6078 |
if ( localenc>=remap->infont && localenc<=remap->infont+(remap->lastenc-remap->firstenc) ) { |
| 6079 |
localenc += remap->firstenc-remap->infont; |
| 6080 |
break; |
| 6081 |
} |
| 6082 |
++remap; |
| 6083 |
} |
| 6084 |
} |
| 6085 |
g_string_printf( output, "%d (0x%x) ", localenc, localenc ); |
| 6086 |
|
| 6087 |
sc = (gid=fv->b.map->map[fv->end_pos])!=-1 ? sf->glyphs[gid] : NULL; |
| 6088 |
if ( fv->b.cidmaster==NULL || fv->b.normal==NULL || sc==NULL ) |
| 6089 |
SCBuildDummy(&dummy,sf,fv->b.map,fv->end_pos); |
| 6090 |
else |
| 6091 |
dummy = *sc; |
| 6092 |
if ( sc==NULL ) sc = &dummy; |
| 6093 |
uni = dummy.unicodeenc!=-1 ? dummy.unicodeenc : sc->unicodeenc; |
| 6094 |
|
| 6095 |
|
| 6096 |
if ( uni == -1 ) { |
| 6097 |
char *pt = strchr( sc->name, '.' ); |
| 6098 |
if( pt != NULL ) { |
| 6099 |
gchar *buf = g_strndup( (const gchar *) sc->name, pt - sc->name ); |
| 6100 |
uni = UniFromName( (char *) buf, fv->b.sf->uni_interp, map->enc ); |
| 6101 |
g_free( buf ); |
| 6102 |
} |
| 6103 |
} |
| 6104 |
|
| 6105 |
if ( uni != -1 ) |
| 6106 |
g_string_append_printf( output, "U+%04X", uni ); |
| 6107 |
else { |
| 6108 |
output = g_string_append( output, "U+????" ); |
| 6109 |
} |
| 6110 |
|
| 6111 |
|
| 6112 |
g_string_append_printf( output, " \"%s\" ", sc->name ); |
| 6113 |
|
| 6114 |
|
| 6115 |
if( uni != -1 ) { |
| 6116 |
uniname = uniname_name( uni ); |
| 6117 |
if ( uniname == NULL ) { |
| 6118 |
uniname = copy( UnicodeRange( uni ) ); |
| 6119 |
} |
| 6120 |
} |
| 6121 |
|
| 6122 |
if ( uniname != NULL ) { |
| 6123 |
output = g_string_append( output, uniname ); |
| 6124 |
free( uniname ); |
| 6125 |
} |
| 6126 |
|
| 6127 |
GDrawDrawText8( pixmap, 10, fv->mbh+fv->lab_as, output->str, -1, fg ); |
| 6128 |
g_string_free( output, TRUE ); output = NULL; |
| 6129 |
GDrawPopClip( pixmap, &old ); |
| 6130 |
return; |
| 6131 |
} |
| 6132 |
|
| 6133 |
static void FVShowInfo(FontView *fv) { |
| 6134 |
GRect r; |
| 6135 |
|
| 6136 |
if ( fv->v==NULL ) |
| 6137 |
return; |
| 6138 |
|
| 6139 |
r.x = 0; r.width = fv->width; r.y = fv->mbh; r.height = fv->infoh; |
| 6140 |
GDrawRequestExpose(fv->gw,&r,false); |
| 6141 |
} |
| 6142 |
|
| 6143 |
void FVChar(FontView *fv, GEvent *event) { |
| 6144 |
int i,pos, cnt, gid; |
| 6145 |
extern int navigation_mask; |
| 6146 |
|
| 6147 |
#if MyMemory |
| 6148 |
if ( event->u.chr.keysym == GK_F2 ) { |
| 6149 |
fprintf( stderr, "Malloc debug on\n" ); |
| 6150 |
__malloc_debug(5); |
| 6151 |
} else if ( event->u.chr.keysym == GK_F3 ) { |
| 6152 |
fprintf( stderr, "Malloc debug off\n" ); |
| 6153 |
__malloc_debug(0); |
| 6154 |
} |
| 6155 |
#endif |
| 6156 |
|
| 6157 |
if ( event->u.chr.keysym=='s' && |
| 6158 |
(event->u.chr.state&ksm_control) && |
| 6159 |
(event->u.chr.state&ksm_meta) ) |
| 6160 |
MenuSaveAll(NULL,NULL,NULL); |
| 6161 |
else if ( event->u.chr.keysym=='q' && |
| 6162 |
(event->u.chr.state&ksm_control) && |
| 6163 |
(event->u.chr.state&ksm_meta) ) |
| 6164 |
MenuExit(NULL,NULL,NULL); |
| 6165 |
else if ( event->u.chr.keysym=='I' && |
| 6166 |
(event->u.chr.state&ksm_shift) && |
| 6167 |
(event->u.chr.state&ksm_meta) ) |
| 6168 |
FVMenuCharInfo(fv->gw,NULL,NULL); |
| 6169 |
else if ( (event->u.chr.keysym=='[' || event->u.chr.keysym==']') && |
| 6170 |
(event->u.chr.state&ksm_control) ) { |
| 6171 |
_FVMenuChangeChar(fv,event->u.chr.keysym=='['?FV_MID_Prev:FV_MID_Next); |
| 6172 |
} else if ( (event->u.chr.keysym=='{' || event->u.chr.keysym=='}') && |
| 6173 |
(event->u.chr.state&ksm_control) ) { |
| 6174 |
_FVMenuChangeChar(fv,event->u.chr.keysym=='{'?FV_MID_PrevDef:FV_MID_NextDef); |
| 6175 |
} else if ( event->u.chr.keysym=='\\' && (event->u.chr.state&ksm_control) ) { |
| 6176 |
|
| 6177 |
FVDoTransform(fv); |
| 6178 |
#if !defined(_NO_FFSCRIPT) || !defined(_NO_PYTHON) |
| 6179 |
} else if ( isdigit(event->u.chr.keysym) && (event->u.chr.state&ksm_control) && |
| 6180 |
(event->u.chr.state&ksm_meta) ) { |
| 6181 |
|
| 6182 |
|
| 6183 |
int index = event->u.chr.keysym-'1'; |
| 6184 |
if ( index<0 ) index = 9; |
| 6185 |
if ( script_filenames[index]!=NULL ) |
| 6186 |
ExecuteScriptFile((FontViewBase *) fv,NULL,script_filenames[index]); |
| 6187 |
#endif |
| 6188 |
} else if ( event->u.chr.keysym == GK_Left || |
| 6189 |
event->u.chr.keysym == GK_Tab || |
| 6190 |
event->u.chr.keysym == GK_BackTab || |
| 6191 |
event->u.chr.keysym == GK_Up || |
| 6192 |
event->u.chr.keysym == GK_Right || |
| 6193 |
event->u.chr.keysym == GK_Down || |
| 6194 |
event->u.chr.keysym == GK_KP_Left || |
| 6195 |
event->u.chr.keysym == GK_KP_Up || |
| 6196 |
event->u.chr.keysym == GK_KP_Right || |
| 6197 |
event->u.chr.keysym == GK_KP_Down || |
| 6198 |
event->u.chr.keysym == GK_Home || |
| 6199 |
event->u.chr.keysym == GK_KP_Home || |
| 6200 |
event->u.chr.keysym == GK_End || |
| 6201 |
event->u.chr.keysym == GK_KP_End || |
| 6202 |
event->u.chr.keysym == GK_Page_Up || |
| 6203 |
event->u.chr.keysym == GK_KP_Page_Up || |
| 6204 |
event->u.chr.keysym == GK_Prior || |
| 6205 |
event->u.chr.keysym == GK_Page_Down || |
| 6206 |
event->u.chr.keysym == GK_KP_Page_Down || |
| 6207 |
event->u.chr.keysym == GK_Next ) { |
| 6208 |
int end_pos = fv->end_pos; |
| 6209 |
|
| 6210 |
|
| 6211 |
if ( end_pos==-1 ) |
| 6212 |
end_pos = (fv->rowoff+fv->rowcnt/2)*fv->colcnt; |
| 6213 |
switch ( event->u.chr.keysym ) { |
| 6214 |
case GK_Tab: |
| 6215 |
pos = end_pos; |
| 6216 |
do { |
| 6217 |
if ( event->u.chr.state&ksm_shift ) |
| 6218 |
--pos; |
| 6219 |
else |
| 6220 |
++pos; |
| 6221 |
if ( pos>=fv->b.map->enccount ) pos = 0; |
| 6222 |
else if ( pos<0 ) pos = fv->b.map->enccount-1; |
| 6223 |
} while ( pos!=end_pos && |
| 6224 |
((gid=fv->b.map->map[pos])==-1 || !SCWorthOutputting(fv->b.sf->glyphs[gid]))); |
| 6225 |
if ( pos==end_pos ) ++pos; |
| 6226 |
if ( pos>=fv->b.map->enccount ) pos = 0; |
| 6227 |
break; |
| 6228 |
#if GK_Tab!=GK_BackTab |
| 6229 |
case GK_BackTab: |
| 6230 |
pos = end_pos; |
| 6231 |
do { |
| 6232 |
--pos; |
| 6233 |
if ( pos<0 ) pos = fv->b.map->enccount-1; |
| 6234 |
} while ( pos!=end_pos && |
| 6235 |
((gid=fv->b.map->map[pos])==-1 || !SCWorthOutputting(fv->b.sf->glyphs[gid]))); |
| 6236 |
if ( pos==end_pos ) --pos; |
| 6237 |
if ( pos<0 ) pos = 0; |
| 6238 |
break; |
| 6239 |
#endif |
| 6240 |
case GK_Left: case GK_KP_Left: |
| 6241 |
pos = end_pos-1; |
| 6242 |
break; |
| 6243 |
case GK_Right: case GK_KP_Right: |
| 6244 |
pos = end_pos+1; |
| 6245 |
break; |
| 6246 |
case GK_Up: case GK_KP_Up: |
| 6247 |
pos = end_pos-fv->colcnt; |
| 6248 |
break; |
| 6249 |
case GK_Down: case GK_KP_Down: |
| 6250 |
pos = end_pos+fv->colcnt; |
| 6251 |
break; |
| 6252 |
case GK_End: case GK_KP_End: |
| 6253 |
pos = fv->b.map->enccount; |
| 6254 |
break; |
| 6255 |
case GK_Home: case GK_KP_Home: |
| 6256 |
pos = 0; |
| 6257 |
if ( fv->b.sf->top_enc!=-1 && fv->b.sf->top_enc<fv->b.map->enccount ) |
| 6258 |
pos = fv->b.sf->top_enc; |
| 6259 |
else { |
| 6260 |
pos = SFFindSlot(fv->b.sf,fv->b.map,home_char,NULL); |
| 6261 |
if ( pos==-1 ) pos = 0; |
| 6262 |
} |
| 6263 |
break; |
| 6264 |
case GK_Page_Up: case GK_KP_Page_Up: |
| 6265 |
#if GK_Prior!=GK_Page_Up |
| 6266 |
case GK_Prior: |
| 6267 |
#endif |
| 6268 |
pos = (fv->rowoff-fv->rowcnt+1)*fv->colcnt; |
| 6269 |
break; |
| 6270 |
case GK_Page_Down: case GK_KP_Page_Down: |
| 6271 |
#if GK_Next!=GK_Page_Down |
| 6272 |
case GK_Next: |
| 6273 |
#endif |
| 6274 |
pos = (fv->rowoff+fv->rowcnt+1)*fv->colcnt; |
| 6275 |
break; |
| 6276 |
} |
| 6277 |
if ( pos<0 ) pos = 0; |
| 6278 |
if ( pos>=fv->b.map->enccount ) pos = fv->b.map->enccount-1; |
| 6279 |
if ( event->u.chr.state&ksm_shift && event->u.chr.keysym!=GK_Tab && event->u.chr.keysym!=GK_BackTab ) { |
| 6280 |
FVReselect(fv,pos); |
| 6281 |
} else { |
| 6282 |
FVDeselectAll(fv); |
| 6283 |
fv->b.selected[pos] = true; |
| 6284 |
FVToggleCharSelected(fv,pos); |
| 6285 |
fv->pressed_pos = pos; |
| 6286 |
fv->sel_index = 1; |
| 6287 |
} |
| 6288 |
fv->end_pos = pos; |
| 6289 |
FVShowInfo(fv); |
| 6290 |
FVScrollToChar(fv,pos); |
| 6291 |
} else if ( event->u.chr.keysym == GK_Help ) { |
| 6292 |
MenuHelp(NULL,NULL,NULL); |
| 6293 |
} else if ( event->u.chr.keysym == GK_Escape ) { |
| 6294 |
FVDeselectAll(fv); |
| 6295 |
} else if ( event->u.chr.chars[0]=='\r' || event->u.chr.chars[0]=='\n' ) { |
| 6296 |
if ( fv->b.container!=NULL && fv->b.container->funcs->is_modal ) |
| 6297 |
return; |
| 6298 |
for ( i=cnt=0; i<fv->b.map->enccount && cnt<10; ++i ) if ( fv->b.selected[i] ) { |
| 6299 |
SplineChar *sc = SFMakeChar(fv->b.sf,fv->b.map,i); |
| 6300 |
if ( fv->show==fv->filled ) { |
| 6301 |
CharViewCreate(sc,fv,i); |
| 6302 |
} else { |
| 6303 |
BDFFont *bdf = fv->show; |
| 6304 |
BitmapViewCreate(BDFMakeGID(bdf,sc->orig_pos),bdf,fv,i); |
| 6305 |
} |
| 6306 |
++cnt; |
| 6307 |
} |
| 6308 |
} else if ( (event->u.chr.state&((GMenuMask()|navigation_mask)&~(ksm_shift|ksm_capslock)))==navigation_mask && |
| 6309 |
event->type == et_char && |
| 6310 |
event->u.chr.keysym!=0 && |
| 6311 |
(event->u.chr.keysym<GK_Special)) { |
| 6312 |
SplineFont *sf = fv->b.sf; |
| 6313 |
int enc = EncFromUni(event->u.chr.keysym,fv->b.map->enc); |
| 6314 |
if ( enc==-1 ) { |
| 6315 |
for ( i=0; i<sf->glyphcnt; ++i ) { |
| 6316 |
if ( sf->glyphs[i]!=NULL ) |
| 6317 |
if ( sf->glyphs[i]->unicodeenc==event->u.chr.keysym ) |
| 6318 |
break; |
| 6319 |
} |
| 6320 |
if ( i<sf->glyphcnt ) |
| 6321 |
enc = fv->b.map->backmap[i]; |
| 6322 |
} |
| 6323 |
if ( enc<fv->b.map->enccount && enc!=-1 ) |
| 6324 |
FVChangeChar(fv,enc); |
| 6325 |
} |
| 6326 |
} |
| 6327 |
|
| 6328 |
void SCPreparePopup(GWindow gw,SplineChar *sc,struct remap *remap, int localenc, |
| 6329 |
int actualuni) { |
| 6330 |
|
| 6331 |
int upos=-1; |
| 6332 |
char *msg, *msg_old; |
| 6333 |
|
| 6334 |
|
| 6335 |
|
| 6336 |
if ( remap!=NULL ) { |
| 6337 |
while ( remap->infont!=-1 ) { |
| 6338 |
if ( localenc>=remap->infont && localenc<=remap->infont+(remap->lastenc-remap->firstenc) ) { |
| 6339 |
localenc += remap->firstenc-remap->infont; |
| 6340 |
break; |
| 6341 |
} |
| 6342 |
++remap; |
| 6343 |
} |
| 6344 |
} |
| 6345 |
|
| 6346 |
if ( actualuni!=-1 ) |
| 6347 |
upos = actualuni; |
| 6348 |
else if ( sc->unicodeenc!=-1 ) |
| 6349 |
upos = sc->unicodeenc; |
| 6350 |
#if HANYANG |
| 6351 |
else if ( sc->compositionunit ) { |
| 6352 |
if ( sc->jamo<19 ) |
| 6353 |
upos = 0x1100+sc->jamo; |
| 6354 |
else if ( sc->jamo<19+21 ) |
| 6355 |
upos = 0x1161 + sc->jamo-19; |
| 6356 |
else |
| 6357 |
upos = 0x11a8 + sc->jamo-(19+21+1); |
| 6358 |
} |
| 6359 |
#endif |
| 6360 |
|
| 6361 |
if ( upos == -1 ) { |
| 6362 |
msg = smprintf( "%u 0x%x U+???? \"%.25s\" ", |
| 6363 |
localenc, localenc, |
| 6364 |
(sc->name == NULL) ? "" : sc->name ); |
| 6365 |
} else { |
| 6366 |
|
| 6367 |
char *uniname = uniname_name( upos ); |
| 6368 |
if( uniname == NULL ) uniname = strdup( UnicodeRange( upos ) ); |
| 6369 |
msg = smprintf ( "%u 0x%x U+%04X \"%.25s\" %.100s", |
| 6370 |
localenc, localenc, upos, |
| 6371 |
(sc->name == NULL) ? "" : sc->name, uniname ); |
| 6372 |
if ( uniname != NULL ) free( uniname ); uniname = NULL; |
| 6373 |
|
| 6374 |
|
| 6375 |
char *uniannot = uniname_annotation( upos, true ); |
| 6376 |
if( uniannot != NULL ) { |
| 6377 |
msg_old = msg; |
| 6378 |
msg = smprintf("%s\n%s", msg_old, uniannot); |
| 6379 |
free(msg_old); |
| 6380 |
free( uniannot ); |
| 6381 |
} |
| 6382 |
} |
| 6383 |
|
| 6384 |
|
| 6385 |
if ( sc->comment!=NULL ) { |
| 6386 |
msg_old = msg; |
| 6387 |
msg = smprintf("%s\n%s", msg_old, sc->comment); |
| 6388 |
free(msg_old); |
| 6389 |
} |
| 6390 |
|
| 6391 |
GGadgetPreparePopup8( gw, msg ); |
| 6392 |
free(msg); |
| 6393 |
} |
| 6394 |
|
| 6395 |
static void noop(void *UNUSED(_fv)) { |
| 6396 |
} |
| 6397 |
|
| 6398 |
static void *ddgencharlist(void *_fv,int32_t *len) { |
| 6399 |
int i,j,cnt, gid; |
| 6400 |
FontView *fv = (FontView *) _fv; |
| 6401 |
SplineFont *sf = fv->b.sf; |
| 6402 |
EncMap *map = fv->b.map; |
| 6403 |
char *data; |
| 6404 |
|
| 6405 |
for ( i=cnt=0; i<map->enccount; ++i ) if ( fv->b.selected[i] && (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL ) |
| 6406 |
cnt += strlen(sf->glyphs[gid]->name)+1; |
| 6407 |
data = malloc(cnt+1); data[0] = '\0'; |
| 6408 |
for ( cnt=0, j=1 ; j<=fv->sel_index; ++j ) { |
| 6409 |
for ( i=cnt=0; i<map->enccount; ++i ) |
| 6410 |
if ( fv->b.selected[i] && (gid=map->map[i])!=-1 && sf->glyphs[gid]!=NULL ) { |
| 6411 |
strcpy(data+cnt,sf->glyphs[gid]->name); |
| 6412 |
cnt += strlen(sf->glyphs[gid]->name); |
| 6413 |
strcpy(data+cnt++," "); |
| 6414 |
} |
| 6415 |
} |
| 6416 |
if ( cnt>0 ) |
| 6417 |
data[--cnt] = '\0'; |
| 6418 |
*len = cnt; |
| 6419 |
return( data ); |
| 6420 |
} |
| 6421 |
|
| 6422 |
static void FVMouse(FontView *fv, GEvent *event) { |
| 6423 |
int pos = (event->u.mouse.y/fv->cbh + fv->rowoff)*fv->colcnt + event->u.mouse.x/fv->cbw; |
| 6424 |
int gid; |
| 6425 |
int realpos = pos; |
| 6426 |
SplineChar *sc, dummy; |
| 6427 |
int dopopup = true; |
| 6428 |
|
| 6429 |
if ( event->type==et_mousedown ) |
| 6430 |
CVPaletteDeactivate(); |
| 6431 |
if ( pos<0 ) { |
| 6432 |
pos = 0; |
| 6433 |
dopopup = false; |
| 6434 |
} else if ( pos>=fv->b.map->enccount ) { |
| 6435 |
pos = fv->b.map->enccount-1; |
| 6436 |
if ( pos<0 ) |
| 6437 |
return; |
| 6438 |
dopopup = false; |
| 6439 |
} |
| 6440 |
|
| 6441 |
sc = (gid=fv->b.map->map[pos])!=-1 ? fv->b.sf->glyphs[gid] : NULL; |
| 6442 |
if ( sc==NULL ) |
| 6443 |
sc = SCBuildDummy(&dummy,fv->b.sf,fv->b.map,pos); |
| 6444 |
if ( event->type == et_mouseup && event->u.mouse.clicks==2 ) { |
| 6445 |
if ( fv->pressed ) { |
| 6446 |
GDrawCancelTimer(fv->pressed); |
| 6447 |
fv->pressed = NULL; |
| 6448 |
} |
| 6449 |
if ( fv->b.container!=NULL && fv->b.container->funcs->is_modal ) |
| 6450 |
return; |
| 6451 |
if ( fv->cur_subtable!=NULL ) { |
| 6452 |
sc = FVMakeChar(fv,pos); |
| 6453 |
pos = fv->b.map->backmap[sc->orig_pos]; |
| 6454 |
} |
| 6455 |
if ( sc==&dummy ) { |
| 6456 |
sc = SFMakeChar(fv->b.sf,fv->b.map,pos); |
| 6457 |
gid = fv->b.map->map[pos]; |
| 6458 |
} |
| 6459 |
if ( fv->show==fv->filled ) { |
| 6460 |
SplineFont *sf = fv->b.sf; |
| 6461 |
gid = -1; |
| 6462 |
if ( !OpenCharsInNewWindow ) |
| 6463 |
for ( gid=sf->glyphcnt-1; gid>=0; --gid ) |
| 6464 |
if ( sf->glyphs[gid]!=NULL && sf->glyphs[gid]->views!=NULL ) |
| 6465 |
break; |
| 6466 |
if ( gid!=-1 ) { |
| 6467 |
CharView *cv = (CharView *) (sf->glyphs[gid]->views); |
| 6468 |
|
| 6469 |
CVChangeSC(cv,sc); |
| 6470 |
GDrawSetVisible(cv->gw,true); |
| 6471 |
GDrawRaise(cv->gw); |
| 6472 |
} else |
| 6473 |
CharViewCreate(sc,fv,pos); |
| 6474 |
} else { |
| 6475 |
BDFFont *bdf = fv->show; |
| 6476 |
BDFChar *bc =BDFMakeGID(bdf,gid); |
| 6477 |
gid = -1; |
| 6478 |
if ( !OpenCharsInNewWindow ) |
| 6479 |
for ( gid=bdf->glyphcnt-1; gid>=0; --gid ) |
| 6480 |
if ( bdf->glyphs[gid]!=NULL && bdf->glyphs[gid]->views!=NULL ) |
| 6481 |
break; |
| 6482 |
if ( gid!=-1 ) { |
| 6483 |
BitmapView *bv = bdf->glyphs[gid]->views; |
| 6484 |
BVChangeBC(bv,bc,true); |
| 6485 |
GDrawSetVisible(bv->gw,true); |
| 6486 |
GDrawRaise(bv->gw); |
| 6487 |
} else |
| 6488 |
BitmapViewCreate(bc,bdf,fv,pos); |
| 6489 |
} |
| 6490 |
} else if ( event->type == et_mousemove ) { |
| 6491 |
if ( dopopup ) |
| 6492 |
SCPreparePopup(fv->v,sc,fv->b.map->remap,pos,sc==&dummy?dummy.unicodeenc: UniFromEnc(pos,fv->b.map->enc)); |
| 6493 |
} |
| 6494 |
if ( event->type == et_mousedown ) { |
| 6495 |
if ( fv->drag_and_drop ) { |
| 6496 |
GDrawSetCursor(fv->v,ct_mypointer); |
| 6497 |
fv->any_dd_events_sent = fv->drag_and_drop = false; |
| 6498 |
} |
| 6499 |
if ( !(event->u.mouse.state&ksm_shift) && event->u.mouse.clicks<=1 ) { |
| 6500 |
if ( !fv->b.selected[pos] ) |
| 6501 |
FVDeselectAll(fv); |
| 6502 |
else if ( event->u.mouse.button!=3 ) { |
| 6503 |
fv->drag_and_drop = fv->has_dd_no_cursor = true; |
| 6504 |
fv->any_dd_events_sent = false; |
| 6505 |
GDrawSetCursor(fv->v,ct_prohibition); |
| 6506 |
GDrawGrabSelection(fv->v,sn_drag_and_drop); |
| 6507 |
GDrawAddSelectionType(fv->v,sn_drag_and_drop,"STRING",fv,0,sizeof(char), |
| 6508 |
ddgencharlist,noop); |
| 6509 |
} |
| 6510 |
} |
| 6511 |
fv->pressed_pos = fv->end_pos = pos; |
| 6512 |
FVShowInfo(fv); |
| 6513 |
if ( !fv->drag_and_drop ) { |
| 6514 |
if ( !(event->u.mouse.state&ksm_shift)) |
| 6515 |
fv->sel_index = 1; |
| 6516 |
else if ( fv->sel_index<255 ) |
| 6517 |
++fv->sel_index; |
| 6518 |
if ( fv->pressed!=NULL ) { |
| 6519 |
GDrawCancelTimer(fv->pressed); |
| 6520 |
fv->pressed = NULL; |
| 6521 |
} else if ( event->u.mouse.state&ksm_shift ) { |
| 6522 |
fv->b.selected[pos] = fv->b.selected[pos] ? 0 : fv->sel_index; |
| 6523 |
FVToggleCharSelected(fv,pos); |
| 6524 |
} else if ( !fv->b.selected[pos] ) { |
| 6525 |
fv->b.selected[pos] = fv->sel_index; |
| 6526 |
FVToggleCharSelected(fv,pos); |
| 6527 |
} |
| 6528 |
if ( event->u.mouse.button==3 ) |
| 6529 |
GMenuCreatePopupMenuWithName(fv->v,event, "Popup", fvpopupmenu); |
| 6530 |
else |
| 6531 |
fv->pressed = GDrawRequestTimer(fv->v,200,100,NULL); |
| 6532 |
} |
| 6533 |
} else if ( fv->drag_and_drop ) { |
| 6534 |
GWindow othergw = GDrawGetPointerWindow(fv->v); |
| 6535 |
|
| 6536 |
if ( othergw==fv->v || othergw==fv->gw || othergw==NULL ) { |
| 6537 |
if ( !fv->has_dd_no_cursor ) { |
| 6538 |
fv->has_dd_no_cursor = true; |
| 6539 |
GDrawSetCursor(fv->v,ct_prohibition); |
| 6540 |
} |
| 6541 |
} else { |
| 6542 |
if ( fv->has_dd_no_cursor ) { |
| 6543 |
fv->has_dd_no_cursor = false; |
| 6544 |
GDrawSetCursor(fv->v,ct_ddcursor); |
| 6545 |
} |
| 6546 |
} |
| 6547 |
if ( event->type==et_mouseup ) { |
| 6548 |
if ( pos!=fv->pressed_pos ) { |
| 6549 |
GDrawPostDragEvent(fv->v,event,event->type==et_mouseup?et_drop:et_drag); |
| 6550 |
fv->any_dd_events_sent = true; |
| 6551 |
} |
| 6552 |
fv->drag_and_drop = fv->has_dd_no_cursor = false; |
| 6553 |
GDrawSetCursor(fv->v,ct_mypointer); |
| 6554 |
if ( !fv->any_dd_events_sent ) |
| 6555 |
FVDeselectAll(fv); |
| 6556 |
fv->any_dd_events_sent = false; |
| 6557 |
} |
| 6558 |
} else if ( fv->pressed!=NULL ) { |
| 6559 |
int showit = realpos!=fv->end_pos; |
| 6560 |
FVReselect(fv,realpos); |
| 6561 |
if ( showit ) |
| 6562 |
FVShowInfo(fv); |
| 6563 |
if ( event->type==et_mouseup ) { |
| 6564 |
GDrawCancelTimer(fv->pressed); |
| 6565 |
fv->pressed = NULL; |
| 6566 |
} |
| 6567 |
} |
| 6568 |
if ( event->type==et_mouseup && dopopup ) |
| 6569 |
SCPreparePopup(fv->v,sc,fv->b.map->remap,pos,sc==&dummy?dummy.unicodeenc: UniFromEnc(pos,fv->b.map->enc)); |
| 6570 |
if ( event->type==et_mouseup ) |
| 6571 |
SVAttachFV(fv,2); |
| 6572 |
} |
| 6573 |
|
| 6574 |
static void FVResize(FontView *fv, GEvent *event) { |
| 6575 |
extern int default_fv_row_count, default_fv_col_count; |
| 6576 |
GRect pos,screensize; |
| 6577 |
int topchar; |
| 6578 |
|
| 6579 |
if ( fv->colcnt!=0 ) |
| 6580 |
topchar = fv->rowoff*fv->colcnt; |
| 6581 |
else if ( fv->b.sf->top_enc!=-1 && fv->b.sf->top_enc<fv->b.map->enccount ) |
| 6582 |
topchar = fv->b.sf->top_enc; |
| 6583 |
else { |
| 6584 |
|
| 6585 |
topchar = SFFindSlot(fv->b.sf,fv->b.map,home_char,NULL); |
| 6586 |
if ( topchar==-1 ) { |
| 6587 |
for ( topchar=0; topchar<fv->b.map->enccount; ++topchar ) |
| 6588 |
if ( fv->b.map->map[topchar]!=-1 && fv->b.sf->glyphs[fv->b.map->map[topchar]]!=NULL ) |
| 6589 |
break; |
| 6590 |
if ( topchar==fv->b.map->enccount ) |
| 6591 |
topchar = 0; |
| 6592 |
} |
| 6593 |
} |
| 6594 |
if ( !event->u.resize.sized ) |
| 6595 |
; |
| 6596 |
else if ( (event->u.resize.size.width- |
| 6597 |
GDrawPointsToPixels(fv->gw,_GScrollBar_Width)-1)%fv->cbw!=0 || |
| 6598 |
(event->u.resize.size.height-fv->mbh-fv->infoh-1)%fv->cbh!=0 ) { |
| 6599 |
int cc = (event->u.resize.size.width+fv->cbw/2- |
| 6600 |
GDrawPointsToPixels(fv->gw,_GScrollBar_Width)-1)/fv->cbw; |
| 6601 |
int rc = (event->u.resize.size.height-fv->mbh-fv->infoh-1)/fv->cbh; |
| 6602 |
if ( cc<=0 ) cc = 1; |
| 6603 |
if ( rc<=0 ) rc = 1; |
| 6604 |
GDrawGetSize(GDrawGetRoot(NULL),&screensize); |
| 6605 |
if ( cc*fv->cbw+GDrawPointsToPixels(fv->gw,_GScrollBar_Width)>screensize.width ) |
| 6606 |
--cc; |
| 6607 |
if ( rc*fv->cbh+fv->mbh+fv->infoh+10>screensize.height ) |
| 6608 |
--rc; |
| 6609 |
GDrawResize(fv->gw, |
| 6610 |
cc*fv->cbw+1+GDrawPointsToPixels(fv->gw,_GScrollBar_Width), |
| 6611 |
rc*fv->cbh+1+fv->mbh+fv->infoh); |
| 6612 |
|
| 6613 |
|
| 6614 |
|
| 6615 |
} |
| 6616 |
|
| 6617 |
pos.width = GDrawPointsToPixels(fv->gw,_GScrollBar_Width); |
| 6618 |
pos.height = event->u.resize.size.height-fv->mbh-fv->infoh; |
| 6619 |
pos.x = event->u.resize.size.width-pos.width; pos.y = fv->mbh+fv->infoh; |
| 6620 |
GGadgetResize(fv->vsb,pos.width,pos.height); |
| 6621 |
GGadgetMove(fv->vsb,pos.x,pos.y); |
| 6622 |
pos.width = pos.x; pos.x = 0; |
| 6623 |
GDrawResize(fv->v,pos.width,pos.height); |
| 6624 |
|
| 6625 |
fv->width = pos.width; fv->height = pos.height; |
| 6626 |
fv->colcnt = (fv->width-1)/fv->cbw; |
| 6627 |
if ( fv->colcnt<1 ) fv->colcnt = 1; |
| 6628 |
fv->rowcnt = (fv->height-1)/fv->cbh; |
| 6629 |
if ( fv->rowcnt<1 ) fv->rowcnt = 1; |
| 6630 |
fv->rowltot = (fv->b.map->enccount+fv->colcnt-1)/fv->colcnt; |
| 6631 |
|
| 6632 |
GScrollBarSetBounds(fv->vsb,0,fv->rowltot,fv->rowcnt); |
| 6633 |
fv->rowoff = topchar/fv->colcnt; |
| 6634 |
if ( fv->rowoff>=fv->rowltot-fv->rowcnt ) |
| 6635 |
fv->rowoff = fv->rowltot-fv->rowcnt; |
| 6636 |
if ( fv->rowoff<0 ) fv->rowoff =0; |
| 6637 |
GScrollBarSetPos(fv->vsb,fv->rowoff); |
| 6638 |
GDrawRequestExpose(fv->gw,NULL,true); |
| 6639 |
GDrawRequestExpose(fv->v,NULL,true); |
| 6640 |
|
| 6641 |
if ( fv->rowcnt!=fv->b.sf->desired_row_cnt || fv->colcnt!=fv->b.sf->desired_col_cnt ) { |
| 6642 |
default_fv_row_count = fv->rowcnt; |
| 6643 |
default_fv_col_count = fv->colcnt; |
| 6644 |
fv->b.sf->desired_row_cnt = fv->rowcnt; |
| 6645 |
fv->b.sf->desired_col_cnt = fv->colcnt; |
| 6646 |
SavePrefs(true); |
| 6647 |
} |
| 6648 |
} |
| 6649 |
|
| 6650 |
static void FVTimer(FontView *fv, GEvent *event) { |
| 6651 |
|
| 6652 |
if ( event->u.timer.timer==fv->pressed ) { |
| 6653 |
GEvent e; |
| 6654 |
GDrawGetPointerPosition(fv->v,&e); |
| 6655 |
if ( e.u.mouse.y<0 || e.u.mouse.y >= fv->height ) { |
| 6656 |
real dy = 0; |
| 6657 |
if ( e.u.mouse.y<0 ) |
| 6658 |
dy = -1; |
| 6659 |
else if ( e.u.mouse.y>=fv->height ) |
| 6660 |
dy = 1; |
| 6661 |
if ( fv->rowoff+dy<0 ) |
| 6662 |
dy = 0; |
| 6663 |
else if ( fv->rowoff+dy+fv->rowcnt > fv->rowltot ) |
| 6664 |
dy = 0; |
| 6665 |
fv->rowoff += dy; |
| 6666 |
if ( dy!=0 ) { |
| 6667 |
GScrollBarSetPos(fv->vsb,fv->rowoff); |
| 6668 |
GDrawScroll(fv->v,NULL,0,dy*fv->cbh); |
| 6669 |
} |
| 6670 |
} |
| 6671 |
} else if ( event->u.timer.timer==fv->resize ) { |
| 6672 |
|
| 6673 |
fv->resize = NULL; |
| 6674 |
FVResize(fv,(GEvent *) (event->u.timer.userdata)); |
| 6675 |
} else if ( event->u.timer.userdata!=NULL ) { |
| 6676 |
|
| 6677 |
void (*func)(FontView *) = (void (*)(FontView *)) (event->u.timer.userdata); |
| 6678 |
func(fv); |
| 6679 |
} |
| 6680 |
} |
| 6681 |
|
| 6682 |
void FVDelay(FontView *fv,void (*func)(FontView *)) { |
| 6683 |
GDrawRequestTimer(fv->v,100,0,(void *) func); |
| 6684 |
} |
| 6685 |
|
| 6686 |
static int FVScroll(GGadget *g, GEvent *e) { |
| 6687 |
FontView *fv = GGadgetGetUserData(g); |
| 6688 |
int newpos = fv->rowoff; |
| 6689 |
struct sbevent *sb = &e->u.control.u.sb; |
| 6690 |
|
| 6691 |
switch( sb->type ) { |
| 6692 |
case et_sb_top: |
| 6693 |
newpos = 0; |
| 6694 |
break; |
| 6695 |
case et_sb_uppage: |
| 6696 |
newpos -= fv->rowcnt; |
| 6697 |
break; |
| 6698 |
case et_sb_up: |
| 6699 |
--newpos; |
| 6700 |
break; |
| 6701 |
case et_sb_down: |
| 6702 |
++newpos; |
| 6703 |
break; |
| 6704 |
case et_sb_downpage: |
| 6705 |
newpos += fv->rowcnt; |
| 6706 |
break; |
| 6707 |
case et_sb_bottom: |
| 6708 |
newpos = fv->rowltot-fv->rowcnt; |
| 6709 |
break; |
| 6710 |
case et_sb_thumb: |
| 6711 |
case et_sb_thumbrelease: |
| 6712 |
newpos = sb->pos; |
| 6713 |
break; |
| 6714 |
case et_sb_halfup: case et_sb_halfdown: break; |
| 6715 |
} |
| 6716 |
if ( newpos>fv->rowltot-fv->rowcnt ) |
| 6717 |
newpos = fv->rowltot-fv->rowcnt; |
| 6718 |
if ( newpos<0 ) newpos =0; |
| 6719 |
if ( newpos!=fv->rowoff ) { |
| 6720 |
int diff = newpos-fv->rowoff; |
| 6721 |
fv->rowoff = newpos; |
| 6722 |
GScrollBarSetPos(fv->vsb,fv->rowoff); |
| 6723 |
GDrawScroll(fv->v,NULL,0,diff*fv->cbh); |
| 6724 |
} |
| 6725 |
return( true ); |
| 6726 |
} |
| 6727 |
|
| 6728 |
static int v_e_h(GWindow gw, GEvent *event) { |
| 6729 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 6730 |
|
| 6731 |
if (( event->type==et_mouseup || event->type==et_mousedown ) && |
| 6732 |
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) { |
| 6733 |
return( GGadgetDispatchEvent(fv->vsb,event)); |
| 6734 |
} |
| 6735 |
|
| 6736 |
GGadgetPopupExternalEvent(event); |
| 6737 |
switch ( event->type ) { |
| 6738 |
case et_expose: |
| 6739 |
GDrawSetLineWidth(gw,0); |
| 6740 |
FVExpose(fv,gw,event); |
| 6741 |
break; |
| 6742 |
case et_char: |
| 6743 |
if ( fv->b.container!=NULL ) |
| 6744 |
(fv->b.container->funcs->charEvent)(fv->b.container,event); |
| 6745 |
else |
| 6746 |
FVChar(fv,event); |
| 6747 |
break; |
| 6748 |
case et_mousemove: case et_mousedown: case et_mouseup: |
| 6749 |
if ( event->type==et_mousedown ) |
| 6750 |
GDrawSetGIC(gw,fv->gic,0,20); |
| 6751 |
if ( fv->notactive && event->type==et_mousedown ) |
| 6752 |
(fv->b.container->funcs->activateMe)(fv->b.container,&fv->b); |
| 6753 |
FVMouse(fv,event); |
| 6754 |
break; |
| 6755 |
case et_timer: |
| 6756 |
FVTimer(fv,event); |
| 6757 |
break; |
| 6758 |
case et_focus: |
| 6759 |
|
| 6760 |
if ( event->u.focus.gained_focus ) |
| 6761 |
GDrawSetGIC(gw,fv->gic,0,20); |
| 6762 |
break; |
| 6763 |
default: break; |
| 6764 |
} |
| 6765 |
return( true ); |
| 6766 |
} |
| 6767 |
|
| 6768 |
static void FontView_ReformatOne(FontView *fv) { |
| 6769 |
FontView *fvs; |
| 6770 |
|
| 6771 |
if ( fv->v==NULL || fv->colcnt==0 ) |
| 6772 |
return; |
| 6773 |
|
| 6774 |
GDrawSetCursor(fv->v,ct_watch); |
| 6775 |
fv->rowltot = (fv->b.map->enccount+fv->colcnt-1)/fv->colcnt; |
| 6776 |
GScrollBarSetBounds(fv->vsb,0,fv->rowltot,fv->rowcnt); |
| 6777 |
if ( fv->rowoff>fv->rowltot-fv->rowcnt ) { |
| 6778 |
fv->rowoff = fv->rowltot-fv->rowcnt; |
| 6779 |
if ( fv->rowoff<0 ) fv->rowoff =0; |
| 6780 |
GScrollBarSetPos(fv->vsb,fv->rowoff); |
| 6781 |
} |
| 6782 |
for ( fvs=(FontView *) (fv->b.sf->fv); fvs!=NULL; fvs=(FontView *) (fvs->b.nextsame) ) |
| 6783 |
if ( fvs!=fv && fvs->b.sf==fv->b.sf ) |
| 6784 |
break; |
| 6785 |
GDrawRequestExpose(fv->v,NULL,false); |
| 6786 |
GDrawSetCursor(fv->v,ct_pointer); |
| 6787 |
} |
| 6788 |
|
| 6789 |
static void FontView_ReformatAll(SplineFont *sf) { |
| 6790 |
BDFFont *new, *old, *bdf; |
| 6791 |
FontView *fv; |
| 6792 |
MetricsView *mvs; |
| 6793 |
extern int use_freetype_to_rasterize_fv; |
| 6794 |
|
| 6795 |
if ( sf->fv==NULL || ((FontView *) (sf->fv))->v==NULL ) |
| 6796 |
return; |
| 6797 |
|
| 6798 |
for ( fv=(FontView *) (sf->fv); fv!=NULL; fv=(FontView *) (fv->b.nextsame) ) { |
| 6799 |
GDrawSetCursor(fv->v,ct_watch); |
| 6800 |
old = fv->filled; |
| 6801 |
|
| 6802 |
new = FVSplineFontPieceMeal(fv->b.sf,fv->b.active_layer,fv->filled->pixelsize,72, |
| 6803 |
(fv->antialias?pf_antialias:0)|(fv->bbsized?pf_bbsized:0)| |
| 6804 |
(use_freetype_to_rasterize_fv && !sf->strokedfont && !sf->multilayer?pf_ft_nohints:0), |
| 6805 |
NULL); |
| 6806 |
fv->filled = new; |
| 6807 |
if ( fv->show==old ) |
| 6808 |
fv->show = new; |
| 6809 |
else { |
| 6810 |
for ( bdf=sf->bitmaps; bdf != NULL && |
| 6811 |
( bdf->pixelsize != fv->show->pixelsize || BDFDepth( bdf ) != BDFDepth( fv->show )); bdf=bdf->next ); |
| 6812 |
if ( bdf != NULL ) fv->show = bdf; |
| 6813 |
else fv->show = new; |
| 6814 |
} |
| 6815 |
BDFFontFree(old); |
| 6816 |
if ( ((FontView *) (sf->fv))->colcnt!=0 ) { |
| 6817 |
fv->rowltot = (fv->b.map->enccount+fv->colcnt-1)/fv->colcnt; |
| 6818 |
GScrollBarSetBounds(fv->vsb,0,fv->rowltot,fv->rowcnt); |
| 6819 |
if ( fv->rowoff>fv->rowltot-fv->rowcnt ) { |
| 6820 |
fv->rowoff = fv->rowltot-fv->rowcnt; |
| 6821 |
if ( fv->rowoff<0 ) fv->rowoff =0; |
| 6822 |
GScrollBarSetPos(fv->vsb,fv->rowoff); |
| 6823 |
} |
| 6824 |
GDrawRequestExpose(fv->v,NULL,false); |
| 6825 |
} |
| 6826 |
GDrawSetCursor(fv->v,ct_pointer); |
| 6827 |
} |
| 6828 |
for ( mvs=sf->metrics; mvs!=NULL; mvs=mvs->next ) if ( mvs->bdf==NULL ) { |
| 6829 |
BDFFontFree(mvs->show); |
| 6830 |
mvs->show = FVSplineFontPieceMeal(sf,mvs->layer,mvs->ptsize,mvs->dpi, |
| 6831 |
mvs->antialias?(pf_antialias|pf_ft_recontext):pf_ft_recontext,NULL); |
| 6832 |
GDrawRequestExpose(mvs->gw,NULL,false); |
| 6833 |
} |
| 6834 |
} |
| 6835 |
|
| 6836 |
void FontViewRemove(FontView *fv) { |
| 6837 |
if ( fv_list==fv ) |
| 6838 |
fv_list = (FontView *) (fv->b.next); |
| 6839 |
else { |
| 6840 |
FontView *n; |
| 6841 |
for ( n=fv_list; n->b.next!=&fv->b; n=(FontView *) (n->b.next) ); |
| 6842 |
n->b.next = fv->b.next; |
| 6843 |
} |
| 6844 |
FontViewFree(&fv->b); |
| 6845 |
} |
| 6846 |
|
| 6847 |
|
| 6848 |
static FontView* ActiveFontView = 0; |
| 6849 |
|
| 6850 |
static int fv_e_h(GWindow gw, GEvent *event) { |
| 6851 |
FontView *fv = (FontView *) GDrawGetUserData(gw); |
| 6852 |
|
| 6853 |
if (( event->type==et_mouseup || event->type==et_mousedown ) && |
| 6854 |
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) { |
| 6855 |
return( GGadgetDispatchEvent(fv->vsb,event)); |
| 6856 |
} |
| 6857 |
|
| 6858 |
switch ( event->type ) { |
| 6859 |
case et_focus: |
| 6860 |
if ( event->u.focus.gained_focus ) |
| 6861 |
{ |
| 6862 |
ActiveFontView = fv; |
| 6863 |
} |
| 6864 |
else |
| 6865 |
{ |
| 6866 |
} |
| 6867 |
break; |
| 6868 |
case et_selclear: |
| 6869 |
ClipboardClear(); |
| 6870 |
break; |
| 6871 |
case et_expose: |
| 6872 |
GDrawSetLineWidth(gw,0); |
| 6873 |
FVDrawInfo(fv,gw,event); |
| 6874 |
break; |
| 6875 |
case et_resize: |
| 6876 |
|
| 6877 |
|
| 6878 |
|
| 6879 |
if ( event->u.resize.sized || fv->resize_expected ) { |
| 6880 |
if ( fv->resize ) |
| 6881 |
GDrawCancelTimer(fv->resize); |
| 6882 |
fv->resize_event = *event; |
| 6883 |
fv->resize = GDrawRequestTimer(fv->v,300,0,(void *) &fv->resize_event); |
| 6884 |
fv->resize_expected = false; |
| 6885 |
} |
| 6886 |
break; |
| 6887 |
case et_char: |
| 6888 |
if ( fv->b.container!=NULL ) |
| 6889 |
(fv->b.container->funcs->charEvent)(fv->b.container,event); |
| 6890 |
else |
| 6891 |
FVChar(fv,event); |
| 6892 |
break; |
| 6893 |
case et_mousedown: |
| 6894 |
GDrawSetGIC(gw,fv->gwgic,0,20); |
| 6895 |
if ( fv->notactive ) |
| 6896 |
(fv->b.container->funcs->activateMe)(fv->b.container,&fv->b); |
| 6897 |
break; |
| 6898 |
case et_close: |
| 6899 |
FVMenuClose(gw,NULL,NULL); |
| 6900 |
break; |
| 6901 |
case et_create: |
| 6902 |
fv->b.next = (FontViewBase *) fv_list; |
| 6903 |
fv_list = fv; |
| 6904 |
break; |
| 6905 |
case et_destroy: |
| 6906 |
if ( fv->qg!=NULL ) |
| 6907 |
QGRmFontView(fv->qg,fv); |
| 6908 |
FontViewRemove(fv); |
| 6909 |
break; |
| 6910 |
default: break; |
| 6911 |
} |
| 6912 |
return( true ); |
| 6913 |
} |
| 6914 |
|
| 6915 |
static void FontViewOpenKids(FontView *fv) { |
| 6916 |
int k, i; |
| 6917 |
SplineFont *sf = fv->b.sf, *_sf; |
| 6918 |
#if defined(__Mac) |
| 6919 |
int cnt= 0; |
| 6920 |
#endif |
| 6921 |
|
| 6922 |
if ( sf->cidmaster!=NULL ) |
| 6923 |
sf = sf->cidmaster; |
| 6924 |
|
| 6925 |
k=0; |
| 6926 |
do { |
| 6927 |
_sf = sf->subfontcnt==0 ? sf : sf->subfonts[k]; |
| 6928 |
for ( i=0; i<_sf->glyphcnt; ++i ) |
| 6929 |
if ( _sf->glyphs[i]!=NULL && _sf->glyphs[i]->wasopen ) { |
| 6930 |
_sf->glyphs[i]->wasopen = false; |
| 6931 |
#if defined(__Mac) |
| 6932 |
|
| 6933 |
|
| 6934 |
if ( ++cnt==1 ) |
| 6935 |
#endif |
| 6936 |
CharViewCreate(_sf->glyphs[i],fv,-1); |
| 6937 |
} |
| 6938 |
++k; |
| 6939 |
} while ( k<sf->subfontcnt ); |
| 6940 |
} |
| 6941 |
|
| 6942 |
static FontView *__FontViewCreate(SplineFont *sf) { |
| 6943 |
FontView *fv = calloc(1,sizeof(FontView)); |
| 6944 |
int i; |
| 6945 |
int ps = sf->display_size<0 ? -sf->display_size : |
| 6946 |
sf->display_size==0 ? default_fv_font_size : sf->display_size; |
| 6947 |
|
| 6948 |
if ( ps>200 ) ps = 128; |
| 6949 |
|
| 6950 |
|
| 6951 |
|
| 6952 |
|
| 6953 |
if ( sf->fv==NULL && compact_font_on_open && sf->filename==NULL && !sf->isnew ) { |
| 6954 |
sf->compacted = true; |
| 6955 |
for ( i=0; i<sf->subfontcnt; ++i ) |
| 6956 |
sf->subfonts[i]->compacted = true; |
| 6957 |
} |
| 6958 |
fv->b.nextsame = sf->fv; |
| 6959 |
fv->b.active_layer = sf->display_layer; |
| 6960 |
sf->fv = (FontViewBase *) fv; |
| 6961 |
if ( sf->mm!=NULL ) { |
| 6962 |
sf->mm->normal->fv = (FontViewBase *) fv; |
| 6963 |
for ( i = 0; i<sf->mm->instance_count; ++i ) |
| 6964 |
sf->mm->instances[i]->fv = (FontViewBase *) fv; |
| 6965 |
} |
| 6966 |
if ( sf->subfontcnt==0 ) { |
| 6967 |
fv->b.sf = sf; |
| 6968 |
if ( fv->b.nextsame!=NULL ) { |
| 6969 |
fv->b.map = EncMapCopy(fv->b.nextsame->map); |
| 6970 |
fv->b.normal = fv->b.nextsame->normal==NULL ? NULL : EncMapCopy(fv->b.nextsame->normal); |
| 6971 |
} else if ( sf->compacted ) { |
| 6972 |
fv->b.normal = sf->map; |
| 6973 |
fv->b.map = CompactEncMap(EncMapCopy(sf->map),sf); |
| 6974 |
sf->map = fv->b.map; |
| 6975 |
} else { |
| 6976 |
fv->b.map = sf->map; |
| 6977 |
fv->b.normal = NULL; |
| 6978 |
} |
| 6979 |
} else { |
| 6980 |
fv->b.cidmaster = sf; |
| 6981 |
for ( i=0; i<sf->subfontcnt; ++i ) |
| 6982 |
sf->subfonts[i]->fv = (FontViewBase *) fv; |
| 6983 |
for ( i=0; i<sf->subfontcnt; ++i ) |
| 6984 |
if ( sf->subfonts[i]->glyphcnt>1 ) { |
| 6985 |
fv->b.sf = sf->subfonts[i]; |
| 6986 |
break; |
| 6987 |
} |
| 6988 |
if ( fv->b.sf==NULL ) |
| 6989 |
fv->b.sf = sf->subfonts[0]; |
| 6990 |
sf = fv->b.sf; |
| 6991 |
if ( fv->b.nextsame==NULL ) { EncMapFree(sf->map); sf->map = NULL; } |
| 6992 |
fv->b.map = EncMap1to1(sf->glyphcnt); |
| 6993 |
if ( fv->b.nextsame==NULL ) { sf->map = fv->b.map; } |
| 6994 |
if ( sf->compacted ) { |
| 6995 |
fv->b.normal = fv->b.map; |
| 6996 |
fv->b.map = CompactEncMap(EncMapCopy(fv->b.map),sf); |
| 6997 |
if ( fv->b.nextsame==NULL ) { sf->map = fv->b.map; } |
| 6998 |
} |
| 6999 |
} |
| 7000 |
fv->b.selected = calloc((fv->b.map ? fv->b.map->enccount : 0), sizeof(uint8_t)); |
| 7001 |
fv->user_requested_magnify = -1; |
| 7002 |
fv->magnify = (ps<=9)? 3 : (ps<20) ? 2 : 1; |
| 7003 |
fv->cbw = (ps*fv->magnify)+1; |
| 7004 |
fv->cbh = (ps*fv->magnify)+1+fv->lab_height+1; |
| 7005 |
fv->antialias = sf->display_antialias; |
| 7006 |
fv->bbsized = sf->display_bbsized; |
| 7007 |
fv->glyphlabel = default_fv_glyphlabel; |
| 7008 |
|
| 7009 |
fv->end_pos = -1; |
| 7010 |
#ifndef _NO_PYTHON |
| 7011 |
PyFF_InitFontHook((FontViewBase *)fv); |
| 7012 |
#endif |
| 7013 |
|
| 7014 |
return( fv ); |
| 7015 |
} |
| 7016 |
|
| 7017 |
static int fontview_ready = false; |
| 7018 |
|
| 7019 |
static void FontViewFinish() { |
| 7020 |
if (!fontview_ready) return; |
| 7021 |
mb2FreeGetText(mblist); |
| 7022 |
mbFreeGetText(fvpopupmenu); |
| 7023 |
} |
| 7024 |
|
| 7025 |
void FontViewFinishNonStatic() { |
| 7026 |
FontViewFinish(); |
| 7027 |
} |
| 7028 |
|
| 7029 |
#ifndef _NO_PYTHON |
| 7030 |
void FVSetToolsSubmenu(GMenuItem2 *py_menu) { |
| 7031 |
mblist[3].ti.disabled = (py_menu == NULL); |
| 7032 |
mblist[3].sub = py_menu; |
| 7033 |
} |
| 7034 |
|
| 7035 |
static GMenuItem2 *FVGetToolsSubmenu(void) { |
| 7036 |
return mblist[3].sub; |
| 7037 |
} |
| 7038 |
#endif |
| 7039 |
|
| 7040 |
static void FontViewInit(void) { |
| 7041 |
|
| 7042 |
|
| 7043 |
if ( fontview_ready ) |
| 7044 |
return; |
| 7045 |
|
| 7046 |
fontview_ready = true; |
| 7047 |
|
| 7048 |
|
| 7049 |
|
| 7050 |
|
| 7051 |
#ifndef _NO_PYTHON |
| 7052 |
GMenuItem2 *t = FVGetToolsSubmenu(); |
| 7053 |
FVSetToolsSubmenu(NULL); |
| 7054 |
#endif |
| 7055 |
mb2DoGetText(mblist); |
| 7056 |
#ifndef _NO_PYTHON |
| 7057 |
FVSetToolsSubmenu(t); |
| 7058 |
#endif |
| 7059 |
mbDoGetText(fvpopupmenu); |
| 7060 |
atexit(&FontViewFinishNonStatic); |
| 7061 |
} |
| 7062 |
|
| 7063 |
|
| 7064 |
static GResFont ui_viewfont = GRESFONT_INIT("400 12pt " SANS_UI_FAMILIES); |
| 7065 |
static GResFont label_viewfont = GRESFONT_INIT("400 12pt " LABEL_UI_FAMILIES); |
| 7066 |
static GResFont mono_viewfont = GRESFONT_INIT("400 12pt " MONO_UI_FAMILIES); |
| 7067 |
static GResFont serif_viewfont = GRESFONT_INIT("400 12pt " SERIF_UI_FAMILIES); |
| 7068 |
|
| 7069 |
static struct resed view_re[] = { |
| 7070 |
{N_("DefaultFont"), "DefaultFont", rt_font, &ui_viewfont, N_("The primary display font family (normally sans-serif) at the normal size for menus, dialogs, etc."), NULL, { 0 }, 0, 0 }, |
| 7071 |
{N_("LabelFont"), "LabelFont", rt_font, &label_viewfont, N_("A font for displaying unicode characters, normally used for FontView glyph labels."), NULL, { 0 }, 0, 0 }, |
| 7072 |
{N_("MonoFont"), "MonoFont", rt_font, &mono_viewfont, N_("A monospace font family at the same size as DefaultFont"), NULL, { 0 }, 0, 0 }, |
| 7073 |
{N_("SerifFont"), "SerifFont", rt_font, &serif_viewfont, N_("A font family with serifs at the same size as DefaultFont (for the splash screen)"), NULL, { 0 }, 0, 0 }, |
| 7074 |
{N_("Color|Background"), "Background", rt_color, &view_bgcol, N_("Background color for the drawing area of all views"), NULL, { 0 }, 0, 0 }, |
| 7075 |
RESED_EMPTY |
| 7076 |
}; |
| 7077 |
static struct resed fontview_re[] = { |
| 7078 |
{N_("Glyph FG Color"), "GlyphFGColor", rt_color, &fvfgcol, N_("Color of used to draw the foreground of (unselected) glyphs"), NULL, { 0 }, 0, 0 }, |
| 7079 |
{N_("Glyph Info Color"), "GlyphInfoColor", rt_color, &fvglyphinfocol, N_("Color of the font used to display glyph information in the fontview"), NULL, { 0 }, 0, 0 }, |
| 7080 |
{N_("Slot Outline Color"), "SlotOutlineColor", rt_color, &fvslotcol, N_("Color of the lines around glyph slots"), NULL, { 0 }, 0, 0 }, |
| 7081 |
{N_("Slot Division Color"), "SlotDivisionColor", rt_color, &fvslotdivcol, N_("Color of the line between label and glyph"), NULL, { 0 }, 0, 0 }, |
| 7082 |
{N_("Label Color"), "LabelColor", rt_color, &fvlabelcol, N_("Default color of glyph labels"), NULL, { 0 }, 0, 0 }, |
| 7083 |
{N_("Unencoded Label Color"), "UnencodedLabelColor", rt_color, &fvunenclabelcol, N_("Color of glyph labels when glyph is not encoded"), NULL, { 0 }, 0, 0 }, |
| 7084 |
{N_("Missing Label Color"), "MissingLabelColor", rt_color, &fvmissinglabelcol, N_("Color of glyph labels when label is missing"), NULL, { 0 }, 0, 0 }, |
| 7085 |
{N_("Empty Slot FG Color"), "EmptySlotFgColor", rt_color, &fvemtpyslotfgcol, N_("Color used to draw the foreground of empty slots"), NULL, { 0 }, 0, 0 }, |
| 7086 |
{N_("Selected BG Color"), "SelectedColor", rt_color, &fvselcol, N_("Color used to draw the background of selected glyphs"), NULL, { 0 }, 0, 0 }, |
| 7087 |
{N_("Selected FG Color"), "SelectedFgColor", rt_color, &fvselfgcol, N_("Color used to draw the foreground of selected glyphs"), NULL, { 0 }, 0, 0 }, |
| 7088 |
{N_("Changed Color"), "ChangedColor", rt_color, &fvchangedcol, N_("Color used to mark a changed glyph"), NULL, { 0 }, 0, 0 }, |
| 7089 |
{N_("Missing Bitmap Color"), "MissingBitmapColor", rt_color, &fvmissingbitmapcol, N_("Color used to mark a glyph with an outline and no bitmap when displaying bitmaps"), NULL, { 0 }, 0, 0 }, |
| 7090 |
{N_("Missing Outline Color"), "MissingOutlineColor", rt_color, &fvmissingoutlinecol, N_("Color used to mark a glyph with a bitmap but no outline when displaying outlines"), NULL, { 0 }, 0, 0 }, |
| 7091 |
{N_("Hinting Needed Color"), "HintingNeededColor", rt_color, &fvhintingneededcol, N_("Color used to mark glyphs that need hinting"), NULL, { 0 }, 0, 0 }, |
| 7092 |
{N_("Metrics Advance At Color"), "MetricsAdvanceAtColor", rt_color, &fvmetadvanceatcol, N_("Color used to draw the (vertical or) horizontal line at the advance when that metric is selected in View"), NULL, { 0 }, 0, 0 }, |
| 7093 |
{N_("Metrics Advance To Color"), "MetricsAdvanceToColor", rt_color, &fvmetadvancetocol, N_("Color used to draw the (horizontal or) vertical line from the origin to the advance when that metric is selected in View"), NULL, { 0 }, 0, 0 }, |
| 7094 |
{N_("Metrics Baseline Color"), "MetricsBaselineColor", rt_color, &fvmetbaselinecol, N_("Color used to draw the (vertical or) horizontal baseline when that metric is selected in View"), NULL, { 0 }, 0, 0 }, |
| 7095 |
{N_("Metrics Origin Color"), "MetricsOriginColor", rt_color, &fvmetorigincol, N_("Color used to draw the (vertical or) horizontal origin tick when that metric is selected in View"), NULL, { 0 }, 0, 0 }, |
| 7096 |
{N_("Metrics Glyph Contour Color"), "MetricsGlyphContourColor", rt_color, &fvmetglyphcontourcol, N_("Color used to draw glyph contour when that metric is selected in View"), NULL, { 0 }, 0, 0 }, |
| 7097 |
{N_("Font"), "Font", rt_font, &fv_font, N_("Font used to display small example images of glyphs over the user designed glyphs"), NULL, { 0 }, 0, 0 }, |
| 7098 |
RESED_EMPTY |
| 7099 |
}; |
| 7100 |
|
| 7101 |
extern GResFont bdfprop_font; |
| 7102 |
extern GResFont combinations_font; |
| 7103 |
extern GResFont cvt_font; |
| 7104 |
#ifdef FREETYPE_HAS_DEBUGGER |
| 7105 |
extern Color dv_rasterbackcol; |
| 7106 |
extern GResFont debugview_font; |
| 7107 |
#endif |
| 7108 |
extern GResFont fontinfo_font; |
| 7109 |
extern Color fi_originlinescol; |
| 7110 |
extern GResFont glyphinfo_font; |
| 7111 |
extern GResFont groups_font; |
| 7112 |
Color histogram_graphcol = 0x2020ff; |
| 7113 |
extern GResFont kernclass_font; |
| 7114 |
extern Color kernclass_classfgcol; |
| 7115 |
extern GResFont kernformat_font; |
| 7116 |
extern GResFont kernformat_boldfont; |
| 7117 |
extern GResFont math_font; |
| 7118 |
extern GResFont math_boldfont; |
| 7119 |
extern GResFont prefs_monofont; |
| 7120 |
extern GResFont searchview_font; |
| 7121 |
extern GResFont searchview_boldfont; |
| 7122 |
extern Color showatt_selcol; |
| 7123 |
extern Color showatt_glyphnamecol; |
| 7124 |
extern GResFont showatt_font; |
| 7125 |
extern GResFont showatt_monofont; |
| 7126 |
extern GResFont splash_font; |
| 7127 |
extern GResFont splash_monofont; |
| 7128 |
extern GResFont splash_italicfont; |
| 7129 |
extern GResFont statemachine_font; |
| 7130 |
extern GResImage splashresimage; |
| 7131 |
extern Color splashfg; |
| 7132 |
extern Color splashbg; |
| 7133 |
|
| 7134 |
#ifdef FONTFORGE_CONFIG_TILEPATH |
| 7135 |
extern GResFont tilepath_font; |
| 7136 |
extern GResFont tilepath_boldfont; |
| 7137 |
#endif |
| 7138 |
extern GResFont ttinstruction_font; |
| 7139 |
extern GResFont validate_font; |
| 7140 |
extern GResFont errfont; |
| 7141 |
static struct resed miscwin_re[] = { |
| 7142 |
{N_("BDFProperties.Font"), "BDFProperties.Font", rt_font, &bdfprop_font, N_("Font used in the BDF Info dialog"), NULL, { 0 }, 0, 0 }, |
| 7143 |
{N_("Combinations.Font"), "Combinations.Font", rt_font, &combinations_font, N_("Font used in the View Combinations dialogs"), NULL, { 0 }, 0, 0 }, |
| 7144 |
{N_("CVT.Font"), "CVT.Font", rt_font, &cvt_font, N_("Font used in the TTF Instruction Control Value Table dialog"), NULL, { 0 }, 0, 0 }, |
| 7145 |
#ifdef FREETYPE_HAS_DEBUGGER |
| 7146 |
{ N_("Debug View Background Color"), "Background", rt_color, &dv_rasterbackcol, N_("The background of the TTF debugging window"), NULL, { 0 }, 0, 0 }, |
| 7147 |
{N_("DebugView.Font"), "DebugView.Font", rt_font, &debugview_font, N_("Font used in the TTF Instruction Debug window"), NULL, { 0 }, 0, 0 }, |
| 7148 |
#endif |
| 7149 |
{N_("FontInfo Origin Lines Color"), "FontInfo.OriginLineColor", rt_color, &fi_originlinescol, N_("Color used for the baseline and x=0 line in kerning dialogs"), NULL, { 0 }, 0, 0 }, |
| 7150 |
{N_("FontInfo.Font"), "FontInfo.Font", rt_font, &fontinfo_font, N_("Font used for Font Info dialog scrolling lists"), NULL, { 0 }, 0, 0 }, |
| 7151 |
{N_("GlyphInfo.Font"), "GlyphInfo.Font", rt_font, &glyphinfo_font, N_("Font used in the Glyph Info dialog"), NULL, { 0 }, 0, 0 }, |
| 7152 |
{N_("Groups.Font"), "Groups.Font", rt_font, &groups_font, N_("Font used in the Define Encoding Groups dialog"), NULL, { 0 }, 0, 0 }, |
| 7153 |
{N_("Histogram Graph Color"), "Histogram.GraphColor", rt_color, &histogram_graphcol, N_("Color used for the hint histogram graphs"), NULL, { 0 }, 0, 0 }, |
| 7154 |
{N_("Kern Class Text Color"), "KernClass.TextColor", rt_color, &kernclass_classfgcol, N_("Color for kerning class names"), NULL, { 0 }, 0, 0 }, |
| 7155 |
{N_("KernClass.Font"), "KernClass.Font", rt_font, &kernclass_font, N_("Font used in the Kerning Classes dialog"), NULL, { 0 }, 0, 0 }, |
| 7156 |
{N_("KernFormat.Font"), "KernFormat.Font", rt_font, &kernformat_font, N_("Normal font used in the Kerning Format dialog"), NULL, { 0 }, 0, 0 }, |
| 7157 |
{N_("KernFormat.BoldFont"), "KernFormat.BoldFont", rt_font, &kernformat_boldfont, N_("Bold font used in the Kerning Format dialog"), NULL, { 0 }, 0, 0 }, |
| 7158 |
{N_("Math.Font"), "Math.Font", rt_font, &math_font, N_("Normal font used in the Math dialog"), NULL, { 0 }, 0, 0 }, |
| 7159 |
{N_("Math.BoldFont"), "Math.BoldFont", rt_font, &math_boldfont, N_("Bold font used in the Math dialog"), NULL, { 0 }, 0, 0 }, |
| 7160 |
RESED_EMPTY |
| 7161 |
}; |
| 7162 |
static struct resed miscwin2_re[] = { |
| 7163 |
{N_("Prefs.MonoFont"), "Prefs.MonoFont", rt_font, &prefs_monofont, N_("Font for Mac Features in Preferences dialog"), NULL, { 0 }, 0, 0 }, |
| 7164 |
{N_("SearchView.Font"), "SearchView.Font", rt_font, &searchview_font, N_("Normal font used in the Find/Replace window"), NULL, { 0 }, 0, 0 }, |
| 7165 |
{N_("SearchView.BoldFont"), "SearchView.BoldFont", rt_font, &searchview_boldfont, N_("Bold font used in the Find/Replace window"), NULL, { 0 }, 0, 0 }, |
| 7166 |
{N_("Show ATT Selection Color"), "ShowAtt.SelectColor", rt_color, &showatt_selcol, N_("Color used for currently selected entry in Show ATT dialog"), NULL, { 0 }, 0, 0 }, |
| 7167 |
{N_("Show ATT Glyph Name Color"), "ShowAtt.GlyphNameColor", rt_color, &showatt_glyphnamecol, N_("Color used for (some) glyph names in Show ATT dialog"), NULL, { 0 }, 0, 0 }, |
| 7168 |
{N_("ShowATT.Font"), "ShowATT.Font", rt_font, &showatt_font, N_("Normal font used in the Advanced Typographic Tables dialog"), NULL, { 0 }, 0, 0 }, |
| 7169 |
{N_("ShowATT.MonoFont"), "ShowATT.MonoFont", rt_font, &showatt_monofont, N_("Monospace font used in the Advanced Typographic Tables dialog"), NULL, { 0 }, 0, 0 }, |
| 7170 |
{N_("StateMachine.Font"), "StateMachine.Font", rt_font, &statemachine_font, N_("Font used in the MacOS kerning State Machine dialog"), NULL, { 0 }, 0, 0 }, |
| 7171 |
#ifdef FONTFORGE_CONFIG_TILEPATH |
| 7172 |
{N_("TilePath.Font"), "TilePath.Font", rt_font, &tilepath_font, N_("Normal font used in the Tile Path dialog"), NULL, { 0 }, 0, 0 }, |
| 7173 |
{N_("TilePath.BoldFont"), "TilePath.BoldFont", rt_font, &tilepath_boldfont, N_("Bold font used in the Tile Path dialog"), NULL, { 0 }, 0, 0 }, |
| 7174 |
#endif |
| 7175 |
{N_("TTInstruction.Font"), "TTInstruction.Font", rt_font, &ttinstruction_font, N_("Font used in the Edit Instructions dialog"), NULL, { 0 }, 0, 0 }, |
| 7176 |
{N_("Validate.Font"), "Validate.Font", rt_font, &validate_font, N_("Font used in the Validate and Suggest Deltas dialogs"), NULL, { 0 }, 0, 0 }, |
| 7177 |
{N_("Warnings.Font"), "Warnings.Font", rt_font, &errfont, N_("Font used in the Warnings dialog"), NULL, { 0 }, 0, 0 }, |
| 7178 |
RESED_EMPTY |
| 7179 |
}; |
| 7180 |
extern void *_SplashResImageSet(char *res, void *def); |
| 7181 |
static struct resed splash_re[] = { |
| 7182 |
{N_("Splash Foreground"), "Foreground", rt_color, &splashfg, N_("Foreground color in the About dialog"), NULL, { 0 }, 0, 0 }, |
| 7183 |
{N_("Splash Background"), "Background", rt_color, &splashbg, N_("Background color in the About dialog"), NULL, { 0 }, 0, 0 }, |
| 7184 |
{N_("Splash Font"), "Font", rt_font, &splash_font, N_("Serif font used in the About dialog"), NULL, { 0 }, 0, 0 }, |
| 7185 |
{N_("Splash ItalicFont"), "ItalicFont", rt_font, &splash_italicfont, N_("Italic serif font used in the About... dialog"), NULL, { 0 }, 0, 0 }, |
| 7186 |
{N_("Splash.MonoFont"), "MonoFont", rt_font, &splash_monofont, N_("Monospace font used in the About dialog"), NULL, { 0 }, 0, 0 }, |
| 7187 |
{N_("Splash Image"), "Image", rt_image, &splashresimage, N_("Image used in the splash screen and About dialog"), _SplashResImageSet, { 0 }, 0, 0 }, |
| 7188 |
RESED_EMPTY |
| 7189 |
}; |
| 7190 |
|
| 7191 |
static void FVCreateInnards(FontView *fv,GRect *pos) { |
| 7192 |
GWindow gw = fv->gw; |
| 7193 |
GWindowAttrs wattrs; |
| 7194 |
GGadgetData gd; |
| 7195 |
BDFFont *bdf; |
| 7196 |
int as,ds,ld; |
| 7197 |
extern int use_freetype_to_rasterize_fv; |
| 7198 |
SplineFont *sf = fv->b.sf; |
| 7199 |
|
| 7200 |
fv->lab_height = FV_LAB_HEIGHT-13+fv_fontpx; |
| 7201 |
|
| 7202 |
memset(&gd,0,sizeof(gd)); |
| 7203 |
gd.pos.y = pos->y; gd.pos.height = pos->height; |
| 7204 |
gd.pos.width = GDrawPointsToPixels(gw,_GScrollBar_Width); |
| 7205 |
gd.pos.x = pos->width; |
| 7206 |
gd.u.sbinit = NULL; |
| 7207 |
gd.flags = gg_visible|gg_enabled|gg_pos_in_pixels|gg_sb_vert; |
| 7208 |
gd.handle_controlevent = FVScroll; |
| 7209 |
fv->vsb = GScrollBarCreate(gw,&gd,fv); |
| 7210 |
|
| 7211 |
memset(&wattrs,0,sizeof(wattrs)); |
| 7212 |
wattrs.mask = wam_events|wam_cursor|wam_backcol; |
| 7213 |
wattrs.event_masks = ~(1<<et_charup); |
| 7214 |
wattrs.cursor = ct_pointer; |
| 7215 |
wattrs.background_color = view_bgcol; |
| 7216 |
fv->v = GWidgetCreateSubWindow(gw,pos,v_e_h,fv,&wattrs); |
| 7217 |
GDrawSetVisible(fv->v,true); |
| 7218 |
GDrawSetWindowTypeName(fv->v, "FontView"); |
| 7219 |
|
| 7220 |
fv->gic = GDrawCreateInputContext(fv->v,gic_root|gic_orlesser); |
| 7221 |
fv->gwgic = GDrawCreateInputContext(fv->gw,gic_root|gic_orlesser); |
| 7222 |
GDrawSetGIC(fv->v,fv->gic,0,20); |
| 7223 |
GDrawSetGIC(fv->gw,fv->gic,0,20); |
| 7224 |
|
| 7225 |
fv->fontset = calloc(_uni_fontmax,sizeof(GFont *)); |
| 7226 |
fv->fontset[0] = fv_font.fi; |
| 7227 |
GDrawSetFont(fv->v,fv->fontset[0]); |
| 7228 |
GDrawWindowFontMetrics(fv->v,fv->fontset[0],&as,&ds,&ld); |
| 7229 |
fv->lab_as = as; |
| 7230 |
fv->showhmetrics = default_fv_showhmetrics; |
| 7231 |
fv->showvmetrics = default_fv_showvmetrics && sf->hasvmetrics; |
| 7232 |
bdf = FVSplineFontPieceMeal(fv->b.sf,fv->b.active_layer,sf->display_size<0?-sf->display_size:default_fv_font_size,72, |
| 7233 |
(fv->antialias?pf_antialias:0)|(fv->bbsized?pf_bbsized:0)| |
| 7234 |
(use_freetype_to_rasterize_fv && !sf->strokedfont && !sf->multilayer?pf_ft_nohints:0), |
| 7235 |
NULL); |
| 7236 |
fv->filled = bdf; |
| 7237 |
if ( sf->display_size>0 ) { |
| 7238 |
for ( bdf=sf->bitmaps; bdf!=NULL && bdf->pixelsize!=sf->display_size ; |
| 7239 |
bdf=bdf->next ); |
| 7240 |
if ( bdf==NULL ) |
| 7241 |
bdf = fv->filled; |
| 7242 |
} |
| 7243 |
if ( sf->onlybitmaps && bdf==fv->filled && sf->bitmaps!=NULL ) |
| 7244 |
bdf = sf->bitmaps; |
| 7245 |
fv->cbw = -1; |
| 7246 |
FVChangeDisplayFont(fv,bdf); |
| 7247 |
} |
| 7248 |
|
| 7249 |
static FontView *FontView_Create(SplineFont *sf, int hide) { |
| 7250 |
FontView *fv = (FontView *) __FontViewCreate(sf); |
| 7251 |
GRect pos; |
| 7252 |
GWindow gw; |
| 7253 |
GWindowAttrs wattrs; |
| 7254 |
GGadgetData gd; |
| 7255 |
GRect gsize; |
| 7256 |
static GWindow icon = NULL; |
| 7257 |
static int nexty=0; |
| 7258 |
GRect size; |
| 7259 |
|
| 7260 |
FontViewInit(); |
| 7261 |
if ( icon==NULL ) { |
| 7262 |
#ifdef BIGICONS |
| 7263 |
icon = GDrawCreateBitmap(NULL,fontview_width,fontview_height,fontview_bits); |
| 7264 |
#else |
| 7265 |
icon = GDrawCreateBitmap(NULL,fontview2_width,fontview2_height,fontview2_bits); |
| 7266 |
#endif |
| 7267 |
} |
| 7268 |
|
| 7269 |
GDrawGetSize(GDrawGetRoot(NULL),&size); |
| 7270 |
|
| 7271 |
memset(&wattrs,0,sizeof(wattrs)); |
| 7272 |
wattrs.mask = wam_events|wam_cursor|wam_icon; |
| 7273 |
wattrs.event_masks = ~(1<<et_charup); |
| 7274 |
wattrs.cursor = ct_pointer; |
| 7275 |
wattrs.icon = icon; |
| 7276 |
pos.width = sf->desired_col_cnt*fv->cbw+1; |
| 7277 |
pos.height = sf->desired_row_cnt*fv->cbh+1; |
| 7278 |
pos.x = size.width-pos.width-30; pos.y = nexty; |
| 7279 |
nexty += 2*fv->cbh+50; |
| 7280 |
if ( nexty+pos.height > size.height ) |
| 7281 |
nexty = 0; |
| 7282 |
fv->gw = gw = GDrawCreateTopWindow(NULL,&pos,fv_e_h,fv,&wattrs); |
| 7283 |
FontViewSetTitle(fv); |
| 7284 |
GDrawSetWindowTypeName(fv->gw, "FontView"); |
| 7285 |
|
| 7286 |
if ( !fv_fs_init ) { |
| 7287 |
GResEditDoInit(&fontview_ri); |
| 7288 |
GResEditDoInit(&view_ri); |
| 7289 |
fv_fs_init = true; |
| 7290 |
} |
| 7291 |
|
| 7292 |
memset(&gd,0,sizeof(gd)); |
| 7293 |
gd.flags = gg_visible | gg_enabled; |
| 7294 |
helplist[0].invoke = FVMenuContextualHelp; |
| 7295 |
gd.u.menu2 = mblist; |
| 7296 |
fv->mb = GMenu2BarCreate( gw, &gd, NULL); |
| 7297 |
GGadgetGetSize(fv->mb,&gsize); |
| 7298 |
fv->mbh = gsize.height; |
| 7299 |
|
| 7300 |
|
| 7301 |
FontRequest rq; |
| 7302 |
GDrawDecomposeFont(fv_font.fi, &rq); |
| 7303 |
fv_fontpx = -rq.point_size; |
| 7304 |
if ( fv_fontpx < 0 ) |
| 7305 |
fv_fontpx = GDrawPointsToPixels(NULL, -fv_fontpx); |
| 7306 |
fv->infoh = 1+fv_fontpx; |
| 7307 |
|
| 7308 |
pos.x = 0; pos.y = fv->mbh+fv->infoh; |
| 7309 |
FVCreateInnards(fv,&pos); |
| 7310 |
|
| 7311 |
if ( !hide ) { |
| 7312 |
GDrawSetVisible(gw,true); |
| 7313 |
FontViewOpenKids(fv); |
| 7314 |
} |
| 7315 |
return( fv ); |
| 7316 |
} |
| 7317 |
|
| 7318 |
static FontView *FontView_Append(FontView *fv) { |
| 7319 |
|
| 7320 |
|
| 7321 |
FontView *test; |
| 7322 |
|
| 7323 |
if ( fv_list==NULL ) fv_list = fv; |
| 7324 |
else { |
| 7325 |
for ( test = fv_list; test->b.next!=NULL; test=(FontView *) test->b.next ); |
| 7326 |
test->b.next = (FontViewBase *) fv; |
| 7327 |
} |
| 7328 |
return( fv ); |
| 7329 |
} |
| 7330 |
|
| 7331 |
FontView *FontNew(void) { |
| 7332 |
return( FontView_Create(SplineFontNew(),false)); |
| 7333 |
} |
| 7334 |
|
| 7335 |
static void FontView_Free(FontView *fv) { |
| 7336 |
int i; |
| 7337 |
FontView *prev; |
| 7338 |
FontView *fvs; |
| 7339 |
|
| 7340 |
if ( fv->b.sf == NULL ) |
| 7341 |
BDFFontFree(fv->filled); |
| 7342 |
else if ( fv->b.nextsame==NULL && fv->b.sf->fv==&fv->b ) { |
| 7343 |
EncMapFree(fv->b.map); |
| 7344 |
if (fv->b.sf != NULL && fv->b.map == fv->b.sf->map) { fv->b.sf->map = NULL; } |
| 7345 |
SplineFontFree(fv->b.cidmaster?fv->b.cidmaster:fv->b.sf); |
| 7346 |
BDFFontFree(fv->filled); |
| 7347 |
} else { |
| 7348 |
EncMapFree(fv->b.map); |
| 7349 |
if (fv->b.sf != NULL && fv->b.map == fv->b.sf->map) { fv->b.sf->map = NULL; } |
| 7350 |
fv->b.map = NULL; |
| 7351 |
for ( fvs=(FontView *) (fv->b.sf->fv), i=0 ; fvs!=NULL; fvs = (FontView *) (fvs->b.nextsame) ) |
| 7352 |
if ( fvs->filled==fv->filled ) ++i; |
| 7353 |
if ( i==1 ) |
| 7354 |
BDFFontFree(fv->filled); |
| 7355 |
if ( fv->b.sf->fv==&fv->b ) { |
| 7356 |
if ( fv->b.cidmaster==NULL ) |
| 7357 |
fv->b.sf->fv = fv->b.nextsame; |
| 7358 |
else { |
| 7359 |
fv->b.cidmaster->fv = fv->b.nextsame; |
| 7360 |
for ( i=0; i<fv->b.cidmaster->subfontcnt; ++i ) |
| 7361 |
fv->b.cidmaster->subfonts[i]->fv = fv->b.nextsame; |
| 7362 |
} |
| 7363 |
} else { |
| 7364 |
for ( prev = (FontView *) (fv->b.sf->fv); prev->b.nextsame!=&fv->b; prev=(FontView *) (prev->b.nextsame) ); |
| 7365 |
prev->b.nextsame = fv->b.nextsame; |
| 7366 |
} |
| 7367 |
} |
| 7368 |
#ifndef _NO_FFSCRIPT |
| 7369 |
DictionaryFree(fv->b.fontvars); |
| 7370 |
free(fv->b.fontvars); |
| 7371 |
#endif |
| 7372 |
free(fv->b.selected); |
| 7373 |
free(fv->fontset); |
| 7374 |
#ifndef _NO_PYTHON |
| 7375 |
PyFF_FreeFV(&fv->b); |
| 7376 |
#endif |
| 7377 |
free(fv); |
| 7378 |
} |
| 7379 |
|
| 7380 |
static int FontViewWinInfo(FontView *fv, int *cc, int *rc) { |
| 7381 |
if ( fv==NULL || fv->colcnt==0 || fv->rowcnt==0 ) { |
| 7382 |
*cc = 16; *rc = 4; |
| 7383 |
return( -1 ); |
| 7384 |
} |
| 7385 |
|
| 7386 |
*cc = fv->colcnt; |
| 7387 |
*rc = fv->rowcnt; |
| 7388 |
|
| 7389 |
return( fv->rowoff*fv->colcnt ); |
| 7390 |
} |
| 7391 |
|
| 7392 |
|
| 7393 |
|
| 7394 |
|
| 7395 |
|
| 7396 |
|
| 7397 |
|
| 7398 |
|
| 7399 |
|
| 7400 |
static FontViewBase *FVAny(void) { return (FontViewBase *) fv_list; } |
| 7401 |
|
| 7402 |
static int FontIsActive(SplineFont *sf) { |
| 7403 |
FontView *fv; |
| 7404 |
|
| 7405 |
for ( fv=fv_list; fv!=NULL; fv=(FontView *) (fv->b.next) ) |
| 7406 |
if ( fv->b.sf == sf ) |
| 7407 |
return( true ); |
| 7408 |
|
| 7409 |
return( false ); |
| 7410 |
} |
| 7411 |
|
| 7412 |
static SplineFont *FontOfFilename(const char *filename) { |
| 7413 |
FontView *fv; |
| 7414 |
char *abspath = GFileGetAbsoluteName(filename); |
| 7415 |
|
| 7416 |
for ( fv=fv_list; fv!=NULL ; fv=(FontView *) (fv->b.next) ) { |
| 7417 |
if ( (fv->b.sf->filename!=NULL && strcmp(fv->b.sf->filename,abspath)==0) || |
| 7418 |
(fv->b.sf->origname!=NULL && strcmp(fv->b.sf->origname,abspath)==0) ) { |
| 7419 |
free(abspath); |
| 7420 |
return fv->b.sf; |
| 7421 |
} |
| 7422 |
} |
| 7423 |
free(abspath); |
| 7424 |
return( NULL ); |
| 7425 |
} |
| 7426 |
|
| 7427 |
static void FVExtraEncSlots(FontView *fv, int encmax) { |
| 7428 |
if ( fv->colcnt!=0 ) { |
| 7429 |
fv->rowltot = (encmax+1+fv->colcnt-1)/fv->colcnt; |
| 7430 |
GScrollBarSetBounds(fv->vsb,0,fv->rowltot,fv->rowcnt); |
| 7431 |
} |
| 7432 |
} |
| 7433 |
|
| 7434 |
static void FV_BiggerGlyphCache(FontView *fv, int gidcnt) { |
| 7435 |
if ( fv->filled!=NULL ) |
| 7436 |
BDFOrigFixup(fv->filled,gidcnt,fv->b.sf); |
| 7437 |
} |
| 7438 |
|
| 7439 |
static void FontView_Close(FontView *fv) { |
| 7440 |
if ( fv->gw!=NULL ) |
| 7441 |
GDrawDestroyWindow(fv->gw); |
| 7442 |
else |
| 7443 |
FontViewRemove(fv); |
| 7444 |
} |
| 7445 |
|
| 7446 |
|
| 7447 |
struct fv_interface gdraw_fv_interface = { |
| 7448 |
(FontViewBase *(*)(SplineFont *, int)) FontView_Create, |
| 7449 |
(FontViewBase *(*)(SplineFont *)) __FontViewCreate, |
| 7450 |
(void (*)(FontViewBase *)) FontView_Close, |
| 7451 |
(void (*)(FontViewBase *)) FontView_Free, |
| 7452 |
(void (*)(FontViewBase *)) FontViewSetTitle, |
| 7453 |
FontViewSetTitles, |
| 7454 |
FontViewRefreshAll, |
| 7455 |
(void (*)(FontViewBase *)) FontView_ReformatOne, |
| 7456 |
FontView_ReformatAll, |
| 7457 |
(void (*)(FontViewBase *)) FV_LayerChanged, |
| 7458 |
FV_ToggleCharChanged, |
| 7459 |
(int (*)(FontViewBase *, int *, int *)) FontViewWinInfo, |
| 7460 |
FontIsActive, |
| 7461 |
FVAny, |
| 7462 |
(FontViewBase *(*)(FontViewBase *)) FontView_Append, |
| 7463 |
FontOfFilename, |
| 7464 |
(void (*)(FontViewBase *,int)) FVExtraEncSlots, |
| 7465 |
(void (*)(FontViewBase *,int)) FV_BiggerGlyphCache, |
| 7466 |
(void (*)(FontViewBase *,BDFFont *)) FV_ChangeDisplayBitmap, |
| 7467 |
(void (*)(FontViewBase *)) FV_ShowFilled, |
| 7468 |
FV_ReattachCVs, |
| 7469 |
(void (*)(FontViewBase *)) FVDeselectAll, |
| 7470 |
(void (*)(FontViewBase *,int )) FVScrollToGID, |
| 7471 |
(void (*)(FontViewBase *,int )) FVScrollToChar, |
| 7472 |
(void (*)(FontViewBase *,int )) FV_ChangeGID, |
| 7473 |
SF_CloseAllInstrs |
| 7474 |
}; |
| 7475 |
|
| 7476 |
extern GResInfo charviewpoints_ri; |
| 7477 |
GResInfo view_ri = { |
| 7478 |
&fontview_ri, NULL,NULL, NULL, |
| 7479 |
NULL, |
| 7480 |
NULL, |
| 7481 |
NULL, |
| 7482 |
view_re, |
| 7483 |
N_("View"), |
| 7484 |
N_("This is an abstract class which defines common features of the\nFontView, CharView, BitmapView and MetricsView.\n\nPress the help key or F1 to open a web page about this tool.\n"), |
| 7485 |
"View", |
| 7486 |
"fontforge", |
| 7487 |
false, |
| 7488 |
false, |
| 7489 |
0, |
| 7490 |
GBOX_EMPTY, |
| 7491 |
GBOX_EMPTY, |
| 7492 |
NULL, |
| 7493 |
NULL, |
| 7494 |
NULL |
| 7495 |
}; |
| 7496 |
|
| 7497 |
GResInfo fontview_ri = { |
| 7498 |
&charviewpoints_ri, NULL,NULL, NULL, |
| 7499 |
NULL, |
| 7500 |
NULL, |
| 7501 |
NULL, |
| 7502 |
fontview_re, |
| 7503 |
N_("Font View"), |
| 7504 |
N_("This is the main fontforge window displaying a font"), |
| 7505 |
"FontView", |
| 7506 |
"fontforge", |
| 7507 |
false, |
| 7508 |
false, |
| 7509 |
0, |
| 7510 |
GBOX_EMPTY, |
| 7511 |
GBOX_EMPTY, |
| 7512 |
NULL, |
| 7513 |
NULL, |
| 7514 |
NULL |
| 7515 |
}; |
| 7516 |
extern GResInfo sftextarea_ri; |
| 7517 |
GResInfo splash_ri = { |
| 7518 |
&sftextarea_ri, NULL,NULL, NULL, |
| 7519 |
NULL, |
| 7520 |
NULL, |
| 7521 |
NULL, |
| 7522 |
splash_re, |
| 7523 |
N_("Splash Screen"), |
| 7524 |
N_("Splash screen and About dialog"), |
| 7525 |
"Splash", |
| 7526 |
"fontforge", |
| 7527 |
false, |
| 7528 |
false, |
| 7529 |
0, |
| 7530 |
GBOX_EMPTY, |
| 7531 |
GBOX_EMPTY, |
| 7532 |
NULL, |
| 7533 |
NULL, |
| 7534 |
NULL |
| 7535 |
}; |
| 7536 |
GResInfo miscwin2_ri = { |
| 7537 |
&splash_ri, NULL,NULL, NULL, |
| 7538 |
NULL, |
| 7539 |
NULL, |
| 7540 |
NULL, |
| 7541 |
miscwin2_re, |
| 7542 |
N_("Misc Windows 2"), |
| 7543 |
N_("Other colors and fonts in various windows (mostly dialogs)"), |
| 7544 |
"", |
| 7545 |
"fontforge", |
| 7546 |
false, |
| 7547 |
false, |
| 7548 |
0, |
| 7549 |
GBOX_EMPTY, |
| 7550 |
GBOX_EMPTY, |
| 7551 |
NULL, |
| 7552 |
NULL, |
| 7553 |
NULL |
| 7554 |
}; |
| 7555 |
GResInfo miscwin_ri = { |
| 7556 |
&miscwin2_ri, NULL,NULL, NULL, |
| 7557 |
NULL, |
| 7558 |
NULL, |
| 7559 |
NULL, |
| 7560 |
miscwin_re, |
| 7561 |
N_("Misc Windows"), |
| 7562 |
N_("Colors and fonts in other windows (mostly dialogs)"), |
| 7563 |
"", |
| 7564 |
"fontforge", |
| 7565 |
false, |
| 7566 |
false, |
| 7567 |
0, |
| 7568 |
GBOX_EMPTY, |
| 7569 |
GBOX_EMPTY, |
| 7570 |
NULL, |
| 7571 |
NULL, |
| 7572 |
NULL |
| 7573 |
}; |
| 7574 |
|
| 7575 |
|
| 7576 |
void MiscWinInit(void) { |
| 7577 |
GResEditDoInit(&miscwin_ri); |
| 7578 |
GResEditDoInit(&miscwin2_ri); |
| 7579 |
GResEditDoInit(&splash_ri); |
| 7580 |
} |
| 7581 |
|
| 7582 |
|
| 7583 |
|
| 7584 |
|
| 7585 |
|
| 7586 |
static void FVCopyInnards(FontView *fv,GRect *pos,int infoh, |
| 7587 |
FontView *fvorig,GWindow dw, int def_layer, struct fvcontainer *kf) { |
| 7588 |
|
| 7589 |
fv->notactive = true; |
| 7590 |
fv->gw = dw; |
| 7591 |
fv->infoh = infoh; |
| 7592 |
fv->b.container = kf; |
| 7593 |
fv->rowcnt = 4; fv->colcnt = 16; |
| 7594 |
fv->b.active_layer = def_layer; |
| 7595 |
FVCreateInnards(fv,pos); |
| 7596 |
memcpy(fv->b.selected,fvorig->b.selected,fv->b.map->enccount); |
| 7597 |
fv->rowoff = (fvorig->rowoff*fvorig->colcnt)/fv->colcnt; |
| 7598 |
} |
| 7599 |
|
| 7600 |
void KFFontViewInits(struct kf_dlg *kf,GGadget *drawable) { |
| 7601 |
GGadgetData gd; |
| 7602 |
GRect pos, gsize, sbsize; |
| 7603 |
GWindow dw = GDrawableGetWindow(drawable); |
| 7604 |
int infoh; |
| 7605 |
int ps; |
| 7606 |
FontView *fvorig = (FontView *) kf->sf->fv; |
| 7607 |
|
| 7608 |
FontViewInit(); |
| 7609 |
|
| 7610 |
kf->dw = dw; |
| 7611 |
|
| 7612 |
memset(&gd,0,sizeof(gd)); |
| 7613 |
gd.flags = gg_visible | gg_enabled; |
| 7614 |
helplist[0].invoke = FVMenuContextualHelp; |
| 7615 |
gd.u.menu2 = mblist; |
| 7616 |
kf->mb = GMenu2BarCreate( dw, &gd, NULL); |
| 7617 |
GGadgetGetSize(kf->mb,&gsize); |
| 7618 |
kf->mbh = gsize.height; |
| 7619 |
kf->guts = drawable; |
| 7620 |
|
| 7621 |
ps = kf->sf->display_size; kf->sf->display_size = -24; |
| 7622 |
kf->first_fv = __FontViewCreate(kf->sf); kf->first_fv->b.container = (struct fvcontainer *) kf; |
| 7623 |
kf->second_fv = __FontViewCreate(kf->sf); kf->second_fv->b.container = (struct fvcontainer *) kf; |
| 7624 |
|
| 7625 |
kf->infoh = infoh = 1+fv_fontpx; |
| 7626 |
kf->first_fv->mbh = kf->mbh; |
| 7627 |
pos.x = 0; pos.y = kf->mbh+infoh+kf->fh+4; |
| 7628 |
pos.width = 16*kf->first_fv->cbw+1; |
| 7629 |
pos.height = 4*kf->first_fv->cbh+1; |
| 7630 |
|
| 7631 |
GDrawSetUserData(dw,kf->first_fv); |
| 7632 |
FVCopyInnards(kf->first_fv,&pos,infoh,fvorig,dw,kf->def_layer,(struct fvcontainer *) kf); |
| 7633 |
pos.height = 4*kf->first_fv->cbh+1; |
| 7634 |
kf->second_fv->mbh = kf->mbh; |
| 7635 |
kf->label2_y = pos.y + pos.height+2; |
| 7636 |
pos.y = kf->label2_y + kf->fh + 2; |
| 7637 |
GDrawSetUserData(dw,kf->second_fv); |
| 7638 |
FVCopyInnards(kf->second_fv,&pos,infoh,fvorig,dw,kf->def_layer,(struct fvcontainer *) kf); |
| 7639 |
|
| 7640 |
kf->sf->display_size = ps; |
| 7641 |
|
| 7642 |
GGadgetGetSize(kf->second_fv->vsb,&sbsize); |
| 7643 |
gsize.x = gsize.y = 0; |
| 7644 |
gsize.width = pos.width + sbsize.width; |
| 7645 |
gsize.height = pos.y+pos.height; |
| 7646 |
GGadgetSetDesiredSize(drawable,NULL,&gsize); |
| 7647 |
} |
| 7648 |
|
| 7649 |
|
| 7650 |
|
| 7651 |
|
| 7652 |
struct gsd { |
| 7653 |
struct fvcontainer base; |
| 7654 |
FontView *fv; |
| 7655 |
int done; |
| 7656 |
int good; |
| 7657 |
GWindow gw; |
| 7658 |
}; |
| 7659 |
|
| 7660 |
static void gs_activateMe(struct fvcontainer *UNUSED(fvc), FontViewBase *UNUSED(fvb)) { |
| 7661 |
|
| 7662 |
} |
| 7663 |
|
| 7664 |
static void gs_charEvent(struct fvcontainer *fvc,void *event) { |
| 7665 |
struct gsd *gs = (struct gsd *) fvc; |
| 7666 |
FVChar(gs->fv,event); |
| 7667 |
} |
| 7668 |
|
| 7669 |
static void gs_doClose(struct fvcontainer *fvc) { |
| 7670 |
struct gsd *gs = (struct gsd *) fvc; |
| 7671 |
gs->done = true; |
| 7672 |
} |
| 7673 |
|
| 7674 |
#define CID_Guts 1000 |
| 7675 |
#define CID_TopBox 1001 |
| 7676 |
|
| 7677 |
static void gs_doResize(struct fvcontainer *fvc, FontViewBase *UNUSED(fvb), |
| 7678 |
int width, int height) { |
| 7679 |
struct gsd *gs = (struct gsd *) fvc; |
| 7680 |
|
| 7681 |
GRect size; |
| 7682 |
|
| 7683 |
memset(&size,0,sizeof(size)); |
| 7684 |
size.width = width; size.height = height; |
| 7685 |
GGadgetSetDesiredSize(GWidgetGetControl(gs->gw,CID_Guts), |
| 7686 |
NULL,&size); |
| 7687 |
GHVBoxFitWindow(GWidgetGetControl(gs->gw,CID_TopBox)); |
| 7688 |
} |
| 7689 |
|
| 7690 |
static struct fvcontainer_funcs glyphset_funcs = { |
| 7691 |
fvc_glyphset, |
| 7692 |
true, |
| 7693 |
gs_activateMe, |
| 7694 |
gs_charEvent, |
| 7695 |
gs_doClose, |
| 7696 |
gs_doResize |
| 7697 |
}; |
| 7698 |
|
| 7699 |
static int GS_OK(GGadget *g, GEvent *e) { |
| 7700 |
|
| 7701 |
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { |
| 7702 |
struct gsd *gs = GDrawGetUserData(GGadgetGetWindow(g)); |
| 7703 |
gs->done = true; |
| 7704 |
gs->good = true; |
| 7705 |
} |
| 7706 |
return( true ); |
| 7707 |
} |
| 7708 |
|
| 7709 |
static int GS_Cancel(GGadget *g, GEvent *e) { |
| 7710 |
struct gsd *gs; |
| 7711 |
|
| 7712 |
if ( e->type==et_controlevent && e->u.control.subtype == et_buttonactivate ) { |
| 7713 |
gs = GDrawGetUserData(GGadgetGetWindow(g)); |
| 7714 |
gs->done = true; |
| 7715 |
} |
| 7716 |
return( true ); |
| 7717 |
} |
| 7718 |
|
| 7719 |
static void gs_sizeSet(struct gsd *gs,GWindow dw) { |
| 7720 |
GRect size, gsize; |
| 7721 |
int width, height, y; |
| 7722 |
int cc, rc, topchar; |
| 7723 |
GRect subsize; |
| 7724 |
FontView *fv = gs->fv; |
| 7725 |
|
| 7726 |
if ( gs->fv->vsb==NULL ) |
| 7727 |
return; |
| 7728 |
|
| 7729 |
GDrawGetSize(dw,&size); |
| 7730 |
GGadgetGetSize(gs->fv->vsb,&gsize); |
| 7731 |
width = size.width - gsize.width; |
| 7732 |
height = size.height - gs->fv->mbh - gs->fv->infoh; |
| 7733 |
|
| 7734 |
y = gs->fv->mbh + gs->fv->infoh; |
| 7735 |
|
| 7736 |
topchar = fv->rowoff*fv->colcnt; |
| 7737 |
cc = (width-1) / fv->cbw; |
| 7738 |
if ( cc<1 ) cc=1; |
| 7739 |
rc = (height-1)/ fv->cbh; |
| 7740 |
if ( rc<1 ) rc = 1; |
| 7741 |
subsize.x = 0; subsize.y = 0; |
| 7742 |
subsize.width = cc*fv->cbw + 1; |
| 7743 |
subsize.height = rc*fv->cbh + 1; |
| 7744 |
GDrawResize(fv->v,subsize.width,subsize.height); |
| 7745 |
GDrawMove(fv->v,0,y); |
| 7746 |
GGadgetMove(fv->vsb,subsize.width,y); |
| 7747 |
GGadgetResize(fv->vsb,gsize.width,subsize.height); |
| 7748 |
|
| 7749 |
fv->colcnt = cc; fv->rowcnt = rc; |
| 7750 |
fv->width = subsize.width; fv->height = subsize.height; |
| 7751 |
fv->rowltot = (fv->b.map->enccount+fv->colcnt-1)/fv->colcnt; |
| 7752 |
GScrollBarSetBounds(fv->vsb,0,fv->rowltot,fv->rowcnt); |
| 7753 |
fv->rowoff = topchar/fv->colcnt; |
| 7754 |
if ( fv->rowoff>=fv->rowltot-fv->rowcnt ) |
| 7755 |
fv->rowoff = fv->rowltot-fv->rowcnt; |
| 7756 |
if ( fv->rowoff<0 ) fv->rowoff =0; |
| 7757 |
GScrollBarSetPos(fv->vsb,fv->rowoff); |
| 7758 |
|
| 7759 |
GDrawRequestExpose(fv->v,NULL,true); |
| 7760 |
} |
| 7761 |
|
| 7762 |
static int gs_sub_e_h(GWindow pixmap, GEvent *event) { |
| 7763 |
FontView *active_fv; |
| 7764 |
struct gsd *gs; |
| 7765 |
|
| 7766 |
if ( event->type==et_destroy ) |
| 7767 |
return( true ); |
| 7768 |
|
| 7769 |
active_fv = (FontView *) GDrawGetUserData(pixmap); |
| 7770 |
gs = (struct gsd *) (active_fv->b.container); |
| 7771 |
|
| 7772 |
if (( event->type==et_mouseup || event->type==et_mousedown ) && |
| 7773 |
(event->u.mouse.button>=4 && event->u.mouse.button<=7) ) { |
| 7774 |
return( GGadgetDispatchEvent(active_fv->vsb,event)); |
| 7775 |
} |
| 7776 |
|
| 7777 |
|
| 7778 |
switch ( event->type ) { |
| 7779 |
case et_expose: |
| 7780 |
FVDrawInfo(active_fv,pixmap,event); |
| 7781 |
break; |
| 7782 |
case et_char: |
| 7783 |
gs_charEvent(&gs->base,event); |
| 7784 |
break; |
| 7785 |
case et_mousedown: |
| 7786 |
return(false); |
| 7787 |
break; |
| 7788 |
case et_mouseup: case et_mousemove: |
| 7789 |
return(false); |
| 7790 |
case et_resize: |
| 7791 |
gs_sizeSet(gs,pixmap); |
| 7792 |
break; |
| 7793 |
default: break; |
| 7794 |
} |
| 7795 |
return( true ); |
| 7796 |
} |
| 7797 |
|
| 7798 |
static int gs_e_h(GWindow gw, GEvent *event) { |
| 7799 |
struct gsd *gs = GDrawGetUserData(gw); |
| 7800 |
|
| 7801 |
switch ( event->type ) { |
| 7802 |
case et_close: |
| 7803 |
gs->done = true; |
| 7804 |
break; |
| 7805 |
case et_char: |
| 7806 |
FVChar(gs->fv,event); |
| 7807 |
break; |
| 7808 |
default: break; |
| 7809 |
} |
| 7810 |
return( true ); |
| 7811 |
} |
| 7812 |
|
| 7813 |
char *GlyphSetFromSelection(SplineFont *sf,int def_layer,char *current) { |
| 7814 |
struct gsd gs; |
| 7815 |
GRect pos; |
| 7816 |
GWindowAttrs wattrs; |
| 7817 |
GGadgetCreateData gcd[5], boxes[3]; |
| 7818 |
GGadgetCreateData *varray[21], *buttonarray[8]; |
| 7819 |
GTextInfo label[5]; |
| 7820 |
int i,j,k,guts_row,gid,enc,len; |
| 7821 |
char *ret, *rpt; |
| 7822 |
SplineChar *sc; |
| 7823 |
GGadget *drawable; |
| 7824 |
GWindow dw; |
| 7825 |
GGadgetData gd; |
| 7826 |
GRect gsize, sbsize; |
| 7827 |
int infoh, mbh; |
| 7828 |
int ps; |
| 7829 |
FontView *fvorig = (FontView *) sf->fv; |
| 7830 |
GGadget *mb; |
| 7831 |
char *start, *pt; int ch; |
| 7832 |
|
| 7833 |
FontViewInit(); |
| 7834 |
|
| 7835 |
memset(&wattrs,0,sizeof(wattrs)); |
| 7836 |
memset(&gcd,0,sizeof(gcd)); |
| 7837 |
memset(&boxes,0,sizeof(boxes)); |
| 7838 |
memset(&label,0,sizeof(label)); |
| 7839 |
memset(&gs,0,sizeof(gs)); |
| 7840 |
|
| 7841 |
gs.base.funcs = &glyphset_funcs; |
| 7842 |
|
| 7843 |
wattrs.mask = wam_events|wam_cursor|wam_utf8_wtitle|wam_undercursor|wam_isdlg|wam_restrict; |
| 7844 |
wattrs.event_masks = ~(1<<et_charup); |
| 7845 |
wattrs.restrict_input_to_me = true; |
| 7846 |
wattrs.undercursor = 1; |
| 7847 |
wattrs.cursor = ct_pointer; |
| 7848 |
wattrs.utf8_window_title = _("Glyph Set by Selection") ; |
| 7849 |
wattrs.is_dlg = true; |
| 7850 |
pos.x = pos.y = 0; |
| 7851 |
pos.width = 100; |
| 7852 |
pos.height = 100; |
| 7853 |
gs.gw = GDrawCreateTopWindow(NULL,&pos,gs_e_h,&gs,&wattrs); |
| 7854 |
|
| 7855 |
i = j = 0; |
| 7856 |
|
| 7857 |
guts_row = j/2; |
| 7858 |
gcd[i].gd.flags = gg_enabled|gg_visible; |
| 7859 |
gcd[i].gd.cid = CID_Guts; |
| 7860 |
gcd[i].gd.u.drawable_e_h = gs_sub_e_h; |
| 7861 |
gcd[i].creator = GDrawableCreate; |
| 7862 |
varray[j++] = &gcd[i++]; varray[j++] = NULL; |
| 7863 |
|
| 7864 |
label[i].text = (unichar_t *) _("Select glyphs in the font view above.\nThe selected glyphs become your glyph class."); |
| 7865 |
label[i].text_is_1byte = true; |
| 7866 |
gcd[i].gd.label = &label[i]; |
| 7867 |
gcd[i].gd.flags = gg_enabled|gg_visible; |
| 7868 |
gcd[i].creator = GLabelCreate; |
| 7869 |
varray[j++] = &gcd[i++]; varray[j++] = NULL; |
| 7870 |
|
| 7871 |
gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_default; |
| 7872 |
label[i].text = (unichar_t *) _("_OK"); |
| 7873 |
label[i].text_is_1byte = true; |
| 7874 |
label[i].text_in_resource = true; |
| 7875 |
gcd[i].gd.label = &label[i]; |
| 7876 |
gcd[i].gd.handle_controlevent = GS_OK; |
| 7877 |
gcd[i++].creator = GButtonCreate; |
| 7878 |
|
| 7879 |
gcd[i].gd.flags = gg_visible | gg_enabled | gg_but_cancel; |
| 7880 |
label[i].text = (unichar_t *) _("_Cancel"); |
| 7881 |
label[i].text_is_1byte = true; |
| 7882 |
label[i].text_in_resource = true; |
| 7883 |
gcd[i].gd.label = &label[i]; |
| 7884 |
gcd[i].gd.handle_controlevent = GS_Cancel; |
| 7885 |
gcd[i++].creator = GButtonCreate; |
| 7886 |
|
| 7887 |
buttonarray[0] = GCD_Glue; buttonarray[1] = &gcd[i-2]; buttonarray[2] = GCD_Glue; |
| 7888 |
buttonarray[3] = GCD_Glue; buttonarray[4] = &gcd[i-1]; buttonarray[5] = GCD_Glue; |
| 7889 |
buttonarray[6] = NULL; |
| 7890 |
boxes[2].gd.flags = gg_enabled|gg_visible; |
| 7891 |
boxes[2].gd.u.boxelements = buttonarray; |
| 7892 |
boxes[2].creator = GHBoxCreate; |
| 7893 |
varray[j++] = &boxes[2]; varray[j++] = NULL; varray[j++] = NULL; |
| 7894 |
|
| 7895 |
boxes[0].gd.pos.x = boxes[0].gd.pos.y = 2; |
| 7896 |
boxes[0].gd.flags = gg_enabled|gg_visible; |
| 7897 |
boxes[0].gd.u.boxelements = varray; |
| 7898 |
boxes[0].gd.cid = CID_TopBox; |
| 7899 |
boxes[0].creator = GHVGroupCreate; |
| 7900 |
|
| 7901 |
GGadgetsCreate(gs.gw,boxes); |
| 7902 |
|
| 7903 |
GHVBoxSetExpandableRow(boxes[0].ret,guts_row); |
| 7904 |
GHVBoxSetExpandableCol(boxes[2].ret,gb_expandgluesame); |
| 7905 |
|
| 7906 |
drawable = GWidgetGetControl(gs.gw,CID_Guts); |
| 7907 |
dw = GDrawableGetWindow(drawable); |
| 7908 |
|
| 7909 |
memset(&gd,0,sizeof(gd)); |
| 7910 |
gd.flags = gg_visible | gg_enabled; |
| 7911 |
helplist[0].invoke = FVMenuContextualHelp; |
| 7912 |
gd.u.menu2 = mblist; |
| 7913 |
mb = GMenu2BarCreate( dw, &gd, NULL); |
| 7914 |
GGadgetGetSize(mb,&gsize); |
| 7915 |
mbh = gsize.height; |
| 7916 |
|
| 7917 |
ps = sf->display_size; sf->display_size = -24; |
| 7918 |
gs.fv = __FontViewCreate(sf); |
| 7919 |
|
| 7920 |
infoh = 1+fv_fontpx; |
| 7921 |
gs.fv->mbh = mbh; |
| 7922 |
pos.x = 0; pos.y = mbh+infoh; |
| 7923 |
pos.width = 16*gs.fv->cbw+1; |
| 7924 |
pos.height = 4*gs.fv->cbh+1; |
| 7925 |
|
| 7926 |
GDrawSetUserData(dw,gs.fv); |
| 7927 |
FVCopyInnards(gs.fv,&pos,infoh,fvorig,dw,def_layer,(struct fvcontainer *) &gs); |
| 7928 |
pos.height = 4*gs.fv->cbh+1; |
| 7929 |
memset(gs.fv->b.selected,0,gs.fv->b.map->enccount); |
| 7930 |
if ( current!=NULL && strcmp(current,_("{Everything Else}"))!=0 ) { |
| 7931 |
int first = true; |
| 7932 |
for ( start = current; *start==' '; ++start ); |
| 7933 |
while ( *start ) { |
| 7934 |
for ( pt=start; *pt!='\0' && *pt!=' '; ++pt ); |
| 7935 |
ch = *pt; *pt='\0'; |
| 7936 |
sc = SFGetChar(sf,-1,start); |
| 7937 |
*pt = ch; |
| 7938 |
if ( sc!=NULL && (enc = gs.fv->b.map->backmap[sc->orig_pos])!=-1 ) { |
| 7939 |
gs.fv->b.selected[enc] = true; |
| 7940 |
if ( first ) { |
| 7941 |
first = false; |
| 7942 |
gs.fv->rowoff = enc/gs.fv->colcnt; |
| 7943 |
} |
| 7944 |
} |
| 7945 |
start = pt; |
| 7946 |
while ( *start==' ' ) ++start; |
| 7947 |
} |
| 7948 |
} |
| 7949 |
sf->display_size = ps; |
| 7950 |
|
| 7951 |
GGadgetGetSize(gs.fv->vsb,&sbsize); |
| 7952 |
gsize.x = gsize.y = 0; |
| 7953 |
gsize.width = pos.width + sbsize.width; |
| 7954 |
gsize.height = pos.y+pos.height; |
| 7955 |
GGadgetSetDesiredSize(drawable,NULL,&gsize); |
| 7956 |
|
| 7957 |
GHVBoxFitWindow(boxes[0].ret); |
| 7958 |
GDrawSetVisible(gs.gw,true); |
| 7959 |
while ( !gs.done ) |
| 7960 |
GDrawProcessOneEvent(NULL); |
| 7961 |
|
| 7962 |
ret = rpt = NULL; |
| 7963 |
if ( gs.good ) { |
| 7964 |
for ( k=0; k<2; ++k ) { |
| 7965 |
len = 0; |
| 7966 |
for ( enc=0; enc<gs.fv->b.map->enccount; ++enc ) { |
| 7967 |
if ( gs.fv->b.selected[enc] && |
| 7968 |
(gid=gs.fv->b.map->map[enc])!=-1 && |
| 7969 |
(sc = sf->glyphs[gid])!=NULL ) { |
| 7970 |
char *repr = SCNameUniStr( sc ); |
| 7971 |
if ( ret==NULL ) |
| 7972 |
len += strlen(repr)+2; |
| 7973 |
else { |
| 7974 |
strcpy(rpt,repr); |
| 7975 |
rpt += strlen( repr ); |
| 7976 |
free(repr); |
| 7977 |
*rpt++ = ' '; |
| 7978 |
} |
| 7979 |
} |
| 7980 |
} |
| 7981 |
if ( k==0 ) |
| 7982 |
ret = rpt = malloc(len+1); |
| 7983 |
else if ( rpt!=ret && rpt[-1]==' ' ) |
| 7984 |
rpt[-1]='\0'; |
| 7985 |
else |
| 7986 |
*rpt='\0'; |
| 7987 |
} |
| 7988 |
} |
| 7989 |
FontViewFree(&gs.fv->b); |
| 7990 |
GDrawSetUserData(gs.gw,NULL); |
| 7991 |
GDrawSetUserData(dw,NULL); |
| 7992 |
GDrawDestroyWindow(gs.gw); |
| 7993 |
return( ret ); |
| 7994 |
} |
| 7995 |
|
| 7996 |
|
| 7997 |
|
| 7998 |
|