1 /* Copyright (C) 2000-2012 by George Williams */
2 /*
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are met:
5 
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer.
8 
9  * Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12 
13  * The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15 
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef FONTFORGE_GDRAW_H
29 #define FONTFORGE_GDRAW_H
30 
31 #include "charset.h"
32 #include "gimage.h"
33 
34 enum font_style { fs_none, fs_italic=1, fs_smallcaps=2, fs_condensed=4, fs_extended=8, fs_vertical=16 };
35 enum font_type { ft_unknown, ft_serif, ft_sans, ft_mono, ft_cursive, ft_max };
36 
37 typedef struct {
38     const unichar_t *family_name;	/* may be more than one */
39     int16 point_size;			/* negative values are in pixels */
40     int16 weight;
41     enum font_style style;
42     char *utf8_family_name;
43 } FontRequest;
44 
45 typedef struct font_instance FontInstance, GFont;
46 enum gic_style { gic_overspot=2, gic_root=1, gic_hidden=0, gic_orlesser=4, gic_type=3 };
47 typedef struct ginput_context GIC;
48 
49 typedef struct ggc {
50     struct gwindow *w;
51     Color fg;
52     Color bg;
53     GRect clip;
54     unsigned int bitmap_col: 1;			/* window is mapped for bitmap */
55     int16 skip_len, dash_len;
56     int16 line_width;
57     int16 ts;
58     int32 ts_xoff, ts_yoff;
59     int dash_offset;
60     GFont *fi;
61 } GGC;
62 
63 typedef struct gtextbounds {
64     int16 lbearing;		/* of first character */
65 				/* origin to left edge of first char's raster */
66     int32 rbearing;		/* origin to right edge of last char's raster */
67     int16 as,ds;		/* maximum ascent and maximum descent */
68     				/*  (both numbers will be positive for "g" */
69 			        /* so total height = as+ds */
70     int16 fas, fds;		/* font ascent and descent */
71 			        /* total width = rbearing-lbearing */
72     int32 width;	        /* above are for the bounding rect, not the text */
73 			        /*  "width" which may be totally different */
74 } GTextBounds;
75 
76 enum selnames { sn_primary, sn_clipboard, sn_drag_and_drop, sn_user1, sn_user2, sn_max };
77 typedef struct gwindow *GWindow;
78 typedef struct gdisplay GDisplay;
79 typedef struct gtimer GTimer;
80 
81 enum keystate_mask { ksm_shift=1, ksm_capslock=2, ksm_control=4, ksm_meta=8,
82 	ksm_cmdsuse=0x8,
83 /* Suse X on a Mac maps command to meta. As of Mac 10.2, the command key is 0x10 */
84 /*  In 10.0 the command key was 0x20 */
85 	ksm_cmdmacosx=0x10,	/* But not the command key under suse ppc linux*/
86 	ksm_numlock=0x10,	/* It's numlock on my 386 system */
87 	ksm_super=0x40,		/* RedHat mask for the key with the windows flag on it */
88 	ksm_hyper=0x80,
89 /* Both Suse and Mac OS/X.2 now map option to 0x2000, but under 10.0 it was meta */
90 /* Under 10.4 it is the meta mask again */
91 /* Under 10.6 it is 0x2000 again. I wish they'd be consistent */
92 	ksm_option=0x2000,	/* sometimes */
93 	ksm_menumask=(ksm_control|ksm_meta|ksm_cmdmacosx|0xf0),
94 
95 	ksm_button1=(1<<8), ksm_button2=(1<<9), ksm_button3=(1<<10),
96 	ksm_button4=(1<<11), ksm_button5=(1<<12),
97 	ksm_buttons=(ksm_button1|ksm_button2|ksm_button3|ksm_button4|ksm_button5)
98 	};
99 enum mnemonic_focus { mf_normal, mf_tab, mf_mnemonic, mf_shortcut };
100 
101 enum event_type { et_noevent = -1, et_char, et_charup, // is 1
102 		  et_mousemove, et_mousedown, et_mouseup,
103 		  et_crossing,	/* these four are assumed to be consecutive */
104 		  et_focus, // is 7
105 		  et_expose, et_visibility, et_resize, et_timer,
106 		  et_close/*request by user*/, et_create,
107 		  et_map, et_destroy/*window being freed*/,
108 		  et_selclear,
109 		  et_drag, et_dragout, et_drop,
110 		  et_lastnativeevent=et_drop,
111 		  et_controlevent, et_user };
112 
113 enum visibility_state { vs_unobscured, vs_partially, vs_obscured };
114 
115 enum et_subtype { et_buttonpress, et_buttonactivate, et_radiochanged,
116 		  et_listselected, et_listdoubleclick,
117 		  et_scrollbarchange,
118 		  et_textchanged, et_textfocuschanged,
119 		  et_save, et_lastsubtype };
120 
121 enum sb { et_sb_top, et_sb_uppage, et_sb_up, et_sb_left=et_sb_up,
122 	  et_sb_down, et_sb_right=et_sb_down, et_sb_downpage,
123 	  et_sb_bottom,
124 	  et_sb_thumb, et_sb_thumbrelease };
125 
126 struct sbevent {
127     enum sb type;
128     int32 pos;
129 };
130 
131 typedef struct gevent {
132     enum event_type type;
133 #define _GD_EVT_CHRLEN	10
134     GWindow w;
135     union {
136 	struct {
137 	    char *device;		/* for wacom devices */
138 	    uint32 time;
139 	    uint16 state;
140 	    int16 x,y;
141 	    uint16 keysym;
142 	    int16 autorepeat;
143 	    unichar_t chars[_GD_EVT_CHRLEN];
144 	} chr;
145 	struct {
146 	    char *device;		/* for wacom devices */
147 	    uint32 time;
148 	    int16 state;
149 	    int16 x,y;
150 	    int16 button;
151 	    int16 clicks;
152 	    int32 pressure, xtilt, ytilt, separation;
153 	} mouse;
154 	struct {
155 	    GRect rect;
156 	} expose;
157 	struct {
158 	    enum visibility_state state;
159 	} visibility;
160 	struct {
161 	    GRect size;
162 	    int16 dx, dy, dwidth, dheight;
163 	    unsigned int moved: 1;
164 	    unsigned int sized: 1;
165 	} resize;
166 	struct {
167 	    char *device;		/* for wacom devices */
168 	    uint32 time;
169 	    int16 state;
170 	    int16 x,y;
171 	    unsigned int entered: 1;
172 	} crossing;
173 	struct {
174 	    unsigned int gained_focus: 1;
175 	    unsigned int mnemonic_focus: 2;
176 	} focus;
177 	struct {
178 	    unsigned int is_visible: 1;
179 	} map;
180 	struct {
181 	    enum selnames sel;
182 	} selclear;
183 	struct {
184 	    int32 x,y;
185 	} drag_drop;
186 	struct {
187 	    GTimer *timer;
188 	    void *userdata;
189 	} timer;
190 	struct {
191 	    enum et_subtype subtype;
192 	    struct ggadget *g;
193 	    union {
194 		struct sbevent sb;
195 		struct {
196 		    int gained_focus;
197 		} tf_focus;
198 		struct {
199 		    int from_pulldown;	/* -1 normally, else index into pulldown list */
200 		} tf_changed;
201 		struct {
202 		    int clicks;
203 		    int16 button, state;
204 		} button;
205 		struct {
206 		    int from_mouse, changed_index;
207 		} list;
208 	    } u;
209 	} control;
210 	struct {
211 	    long subtype;
212 	    void *userdata;
213 	} user;
214     } u;
215     void *native_window;
216 } GEvent;
217 
218 typedef enum cursor_types { ct_default, ct_pointer, ct_backpointer, ct_hand,
219 	ct_question, ct_cross, ct_4way, ct_text, ct_watch, ct_draganddrop,
220 	ct_invisible,
221 	ct_user, ct_user2 /* and so on */ } GCursor;
222 
223 enum window_attr_mask { wam_events=0x2, wam_bordwidth=0x4,
224 			wam_bordcol=0x8, wam_backcol=0x10, wam_cursor=0x20, wam_wtitle=0x40,
225 			wam_ititle=0x80, wam_icon=0x100, wam_nodecor=0x200,
226 			wam_positioned=0x400, wam_centered=0x800, wam_undercursor=0x1000,
227 			wam_noresize=0x2000, wam_restrict=0x4000, wam_redirect=0x8000,
228 			wam_isdlg=0x10000, wam_notrestricted=0x20000,
229 			wam_transient=0x40000,
230 			wam_utf8_wtitle=0x80000, wam_utf8_ititle=0x100000,
231 			wam_nocairo=0x200000, wam_verytransient=0x400000, wam_palette=0x800000 };
232 
233 typedef struct gwindow_attrs {
234     enum window_attr_mask mask;
235     uint32 event_masks;			/* (1<<et_char) | (1<<et_mouseup) etc */
236     int16 border_width;
237     Color border_color;			/* Color_UNKNOWN if unspecified */
238     Color background_color;
239     GCursor cursor;
240 	/* Remainder is only for top level windows */
241     const unichar_t *window_title;
242     const unichar_t *icon_title;
243     struct gwindow *icon;		/* A bitmap pixmap, or NULL */
244     unsigned int nodecoration: 1;	/* no wm decoration */
245     unsigned int positioned: 1;		/* position information is important */
246     unsigned int centered: 2;		/* center the window on the screen. pos.width&pos.height are used */
247     unsigned int undercursor: 1;	/* center the window under the cursor. */
248     unsigned int noresize: 1;		/* set min and max sizes to current size */
249     unsigned int restrict_input_to_me: 1;/* for dialogs, no input outside of dlg */
250     unsigned int redirect_chars_to_me: 1;/* ditto, we get any input outside of us */
251     unsigned int is_dlg: 1;		/* 1 for dlg, 0 for main window */
252     unsigned int not_restricted: 1;	/* gets events if if a restricted (modal) dlg is up */
253     GWindow redirect_from;		/* only redirect input from this window and its children */
254     GWindow transient;			/* the Transient_FOR hint */
255     const char *utf8_window_title;
256     const char *utf8_icon_title;
257 } GWindowAttrs;
258 
259 #define GWINDOWATTRS_EMPTY { 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL }
260 
261 typedef struct gdeveventmask {
262     int event_mask;
263     char *device_name;
264 } GDevEventMask;
265 
266 enum gzoom_flags { gzf_pos=1, gzf_size=2 };
267     /* bit flags for the hasCairo query */
268 enum gcairo_flags { gc_buildpath=1,	/* Has build path commands (postscript, cairo) */
269 		    gc_alpha=2,		/* Supports alpha channels & translucent colors (cairo, pdf) */
270 		    gc_xor=4,		/* Cairo can't do the traditional XOR drawing that X11 does */
271 		    gc_all = gc_buildpath|gc_alpha
272 		    };
273 
274 typedef int (*GDrawEH)(GWindow,GEvent *);
275 
276 extern unichar_t *GDrawKeysyms[];
277 extern GDisplay *screen_display;
278 
279 extern void GDrawDestroyDisplays(void);
280 extern void GDrawCreateDisplays(char *displayname,char *programname);
281 
282 extern int GDrawPointsToPixels(GWindow gw,int points);
283 extern int GDrawPixelsToPoints(GWindow gw,int pixels);
284 
285 extern void GDrawSetDefaultIcon(GWindow icon);
286 extern GWindow GDrawCreateTopWindow(GDisplay *gdisp, GRect *pos, int (*eh)(GWindow,GEvent *), void *user_data, GWindowAttrs *wattrs);
287 extern GWindow GDrawCreateSubWindow(GWindow w, GRect *pos, int (*eh)(GWindow,GEvent *), void *user_data, GWindowAttrs *wattrs);
288 extern GWindow GDrawCreatePixmap(GDisplay *gdisp, GWindow similar, uint16 width, uint16 height);
289 extern GWindow GDrawCreateBitmap(GDisplay *gdisp, uint16 width, uint16 height, uint8 *data);
290 extern GCursor GDrawCreateCursor(GWindow src,GWindow mask,Color fg,Color bg,
291 	int16 x, int16 y );
292 extern void GDrawDestroyWindow(GWindow w);
293 extern void GDrawDestroyCursor(GDisplay *gdisp, GCursor ct);
294 extern int  GDrawNativeWindowExists(GDisplay *gdisp, void *native);
295 extern void GDrawSetZoom(GWindow w, GRect *zoomsize, enum gzoom_flags);
296 extern void GDrawSetWindowBackground(GWindow w, Color color);
297 
298 /**
299  * Set the window type to the given name.
300  *
301  * You should not free the 'name' string, it is assumed to exist for
302  * the lifetime of the fontforge run, for example, as a constant
303  * string. No copy of name is performed.
304  */
305 extern void  GDrawSetWindowTypeName(GWindow w, char* name);
306 /**
307  * Get the window type string that was set with GDrawSetWindowTypeName()
308  * or NULL if no such string was set.
309  *
310  * No memory allocations are performed. You should not free the string
311  * that is returned.
312  */
313 extern char* GDrawGetWindowTypeName(GWindow w);
314 extern int  GDrawSetDither(GDisplay *gdisp, int dither);
315 extern void GDrawSetVisible(GWindow w, int visible);
316 extern int  GDrawIsVisible(GWindow w);
317 extern void GDrawTrueMove(GWindow w, int32 x, int32 y);
318 extern void GDrawMove(GWindow w, int32 x, int32 y);
319 extern void GDrawResize(GWindow w, int32 width, int32 height);
320 extern void GDrawMoveResize(GWindow w, int32 x, int32 y, int32 width, int32 height);
321 extern GWindow GDrawGetRoot(GDisplay *);
322 extern Color GDrawGetDefaultBackground(GDisplay *);
323 extern Color GDrawGetDefaultForeground(GDisplay *);
324 extern GRect *GDrawGetSize(GWindow w, GRect *ret);
325 extern GDrawEH GDrawGetEH(GWindow w);
326 extern void GDrawSetEH(GWindow w,GDrawEH e_h);
327 extern void GDrawGetPointerPosition(GWindow w, GEvent *mouse);
328 extern GWindow GDrawGetPointerWindow(GWindow w);
329 extern void GDrawRaise(GWindow w);
330 extern void GDrawRaiseAbove(GWindow w,GWindow below);
331 extern int  GDrawIsAbove(GWindow w,GWindow other);
332 extern void GDrawLower(GWindow w);
333 extern void GDrawSetWindowTitles(GWindow w, const unichar_t *title, const unichar_t *icontit);
334 extern void GDrawSetWindowTitles8(GWindow w, const char *title, const char *icontit);
335 extern unichar_t *GDrawGetWindowTitle(GWindow w);
336 extern char *GDrawGetWindowTitle8(GWindow w);
337 extern void GDrawSetTransientFor(GWindow transient,GWindow owner);
338 extern void GDrawSetCursor(GWindow w, GCursor ct);
339 extern GCursor GDrawGetCursor(GWindow w);
340 extern GWindow GDrawGetRedirectWindow(GDisplay *gd);
341 extern GWindow GDrawGetParentWindow(GWindow gw);
342 extern int GDrawWindowIsAncestor(GWindow ancester, GWindow descendent);
343 extern void GDrawSetUserData(GWindow gw, void *ud);
344 extern void *GDrawGetUserData(GWindow gw);
345 extern GDisplay *GDrawGetDisplayOfWindow(GWindow);
346 extern void GDrawTranslateCoordinates(GWindow from,GWindow to, GPoint *pt);
347 extern int32 GDrawEventInWindow(GWindow inme,GEvent *event);
348 extern void GDrawBeep(GDisplay *gdisp);
349 extern void GDrawFlush(GDisplay *gdisp);
350 
351 extern void GDrawGetClip(GWindow w, GRect *ret);
352 extern void GDrawSetClip(GWindow w, GRect *rct);
353 extern void GDrawPushClip(GWindow w, GRect *rct, GRect *old);
354 extern void GDrawPopClip(GWindow w, GRect *old);
355 extern void GDrawPushClipOnly(GWindow w);
356 extern void GDrawClipPreserve(GWindow w);
357 extern GGC *GDrawGetWindowGGC(GWindow w);
358 extern void GDrawSetDifferenceMode(GWindow w);
359 extern void GDrawSetDashedLine(GWindow w,int16 dash_len, int16 skip_len, int16 off);
360 extern void GDrawSetStippled(GWindow w,int16 ts, int32 yoff,int32 xoff);
361 extern void GDrawSetLineWidth(GWindow w,int16 width);
362 extern int16 GDrawGetLineWidth( GWindow w );
363 
364 extern void GDrawSetForeground(GWindow w,Color col);
365 extern void GDrawSetBackground(GWindow w,Color col);
366 
367 extern GFont *GDrawSetFont(GWindow gw, GFont *fi);
368 extern GFont *GDrawInstanciateFont(GWindow gw, FontRequest *rq);
369 extern GFont *GDrawAttachFont(GWindow gw, FontRequest *rq);
370 extern FontRequest *GDrawDecomposeFont(GFont *fi, FontRequest *rq);
371 extern void GDrawWindowFontMetrics(GWindow gw,GFont *fi,int *as, int *ds, int *ld);
372 
373 extern int32 GDrawGetTextBounds(GWindow gw,const unichar_t *text, int32 cnt, GTextBounds *size);
374 extern int32 GDrawGetTextWidth(GWindow gw, const unichar_t *text, int32 cnt);
375 extern int32 GDrawDrawText(GWindow gw, int32 x, int32 y, const unichar_t *txt, int32 cnt, Color col);
376 /* UTF8 routines */
377 extern int32 GDrawGetText8Bounds(GWindow gw, const char *text, int32 cnt, GTextBounds *size);
378 extern int32 GDrawGetText8Width(GWindow gw, const char *text, int32 cnt);
379 extern int32 GDrawGetText8Height(GWindow gw, const char *text, int32 cnt);
380 extern int32 GDrawDrawText8(GWindow gw, int32 x, int32 y, const char *txt, int32 cnt, Color col);
381 
382 extern GIC *GDrawCreateInputContext(GWindow w,enum gic_style def_style);
383 extern void GDrawSetGIC(GWindow w,GIC *gic,int x, int y);
384 extern int GDrawKeyState(GWindow w, int keysym);
385 
386 extern void GDrawClear(GWindow w, GRect *rect);
387 extern void GDrawDrawLine(GWindow w, int32 x,int32 y, int32 xend,int32 yend, Color col);
388 extern void GDrawDrawArrow(GWindow w, int32 x,int32 y, int32 xend,int32 yend, int arrows, Color col);
389 extern void GDrawDrawRect(GWindow w, GRect *rect, Color col);
390 extern void GDrawFillRect(GWindow w, GRect *rect, Color col);
391 extern void GDrawFillRoundRect(GWindow w, GRect *rect, int radius, Color col);
392 extern void GDrawDrawElipse(GWindow w, GRect *rect, Color col);
393 extern void GDrawFillElipse(GWindow w, GRect *rect, Color col);
394 extern void GDrawDrawArc(GWindow w, GRect *rect, int32 sangle, int32 tangle, Color col);
395 extern void GDrawDrawPoly(GWindow w, GPoint *pts, int16 cnt, Color col);
396 extern void GDrawFillPoly(GWindow w, GPoint *pts, int16 cnt, Color col);
397 extern void GDrawScroll(GWindow w, GRect *rect, int32 hor, int32 vert);
398 extern void GDrawDrawImage(GWindow w, GImage *img, GRect *src, int32 x, int32 y);
399 extern void GDrawDrawGlyph(GWindow w, GImage *img, GRect *src, int32 x, int32 y);
400 extern void GDrawDrawScaledImage(GWindow w, GImage *img, int32 x, int32 y);
401 extern void GDrawDrawImageMagnified(GWindow w, GImage *img, GRect *src, int32 x, int32 y,
402 	int32 width, int32 height);
403 extern void GDrawDrawPixmap(GWindow w, GWindow pixmap, GRect *src, int32 x, int32 y);
404 
405 extern void GDrawGrabSelection(GWindow w,enum selnames sel);
406 extern void GDrawAddSelectionType(GWindow w,enum selnames sel,char *type,
407 	void *data,int32 cnt,int32 unitsize,void *(*gendata)(void *,int32 *len),
408 	void (*freedata)(void *));
409 extern void *GDrawRequestSelection(GWindow w,enum selnames sn, char *typename, int32 *len);
410 extern int GDrawSelectionHasType(GWindow w,enum selnames sn, char *typename);
411 extern void GDrawBindSelection(GDisplay *disp,enum selnames sel, char *atomname);
412 extern int GDrawSelectionOwned(GDisplay *disp,enum selnames sel);
413 
414 extern void GDrawPointerUngrab(GDisplay *disp);
415 extern void GDrawPointerGrab(GWindow w);
416 extern int GDrawEnableExposeRequests(GWindow w,int enabled);
417 extern void GDrawRequestExpose(GWindow w, GRect *rect, int doclear);
418 extern void GDrawSync(GDisplay *gdisp);
419 extern void GDrawForceUpdate(GWindow w);
420 extern void GDrawProcessOneEvent(GDisplay *disp);
421 extern void GDrawProcessPendingEvents(GDisplay *disp);
422 extern void GDrawProcessWindowEvents(GWindow w);
423 extern void GDrawSkipMouseMoveEvents(GWindow w,GEvent *last);
424 extern void GDrawEventLoop(GDisplay *disp);
425 extern void GDrawPostEvent(GEvent *e);
426 extern void GDrawPostDragEvent(GWindow gw,GEvent *e,enum event_type);
427 
428 extern GTimer *GDrawRequestTimer(GWindow w,int32 time_from_now,int32 frequency,
429 	void *userdata);
430 extern void GDrawCancelTimer(GTimer *timer);
431 
432 extern void GDrawSetBuildCharHooks(void (*hook)(GDisplay *), void (*inshook)(GDisplay *,unichar_t));
433 
434 extern int GDrawRequestDeviceEvents(GWindow w,int devcnt,struct gdeveventmask *de);
435 
436 extern enum gcairo_flags GDrawHasCairo(GWindow w);
437 extern void GDrawPathStartNew(GWindow w);
438 extern void GDrawPathStartSubNew(GWindow w);
439 extern int GDrawFillRuleSetWinding(GWindow w);
440 extern void GDrawPathClose(GWindow w);
441 extern void GDrawPathMoveTo(GWindow w,double x, double y);
442 extern void GDrawPathLineTo(GWindow w,double x, double y);
443 extern void GDrawPathCurveTo(GWindow w,
444 		    double cx1, double cy1,
445 		    double cx2, double cy2,
446 		    double x, double y);
447 extern void GDrawPathStroke(GWindow w,Color col);
448 extern void GDrawPathFill(GWindow w,Color col);
449 extern void GDrawPathFillAndStroke(GWindow w,Color fillcol, Color strokecol);
450 extern void GDrawEnableCairo(int on);
451 
452 extern void GDrawLayoutInit(GWindow w, char *text, int cnt, GFont *fi);
453 extern void GDrawLayoutDraw(GWindow w, int32 x, int32 y, Color fg);
454 extern void GDrawLayoutIndexToPos(GWindow w, int index, GRect *pos);
455 extern int  GDrawLayoutXYToIndex(GWindow w, int x, int y);
456 extern void GDrawLayoutExtents(GWindow w, GRect *size);
457 extern void GDrawLayoutSetWidth(GWindow w, int width);
458 extern int  GDrawLayoutLineCount(GWindow w);
459 extern int  GDrawLayoutLineStart(GWindow w,int line);
460 
461 extern void GDrawFatalError(const char *fmt,...);
462 extern void GDrawIError(const char *fmt,...);
463 extern void GDrawError(const char *fmt,...);
464 
465 extern int GImageGetScaledWidth(GWindow gw, GImage *img);
466 extern int GImageGetScaledHeight(GWindow gw, GImage *img);
467 
468 #endif /* FONTFORGE_GDRAW_H */
469