GEMLIB  0.44.0
Data Structures | Macros | Typedefs | Functions
MagiC/WDIALOG extension: Font selector Library

font selector functions More...

Data Structures

struct  UTXT_FN_args
 
struct  _fnts_item
 

Macros

#define fnts_add(a, b)   mt_fnts_add(a,b,aes_global)
 
#define fnts_close(a, b, c)   mt_fnts_close(a,b,c,aes_global)
 
#define fnts_create(a, b, c, d, e, f)   mt_fnts_create(a,b,c,d,e,f,aes_global)
 
#define fnts_delete(a, b)   mt_fnts_delete(a,b,aes_global)
 
#define fnts_do(a, b, c, d, e, f, g, h, i)   mt_fnts_do(a,b,c,d,e,f,g,h,i,aes_global)
 
#define fnts_evnt(a, b, c, d, e, f, g)   mt_fnts_evnt(a,b,c,d,e,f,g,aes_global)
 
#define fnts_get_info(a, b, c, d)   mt_fnts_get_info(a,b,c,d,aes_global)
 
#define fnts_get_name(a, b, c, d, e)   mt_fnts_get_name(a,b,c,d,e,aes_global)
 
#define fnts_get_no_styles(a, b)   mt_fnts_get_no_styles(a,b,aes_global)
 
#define fnts_get_style(a, b, c)   mt_fnts_get_style(a,b,c,aes_global)
 
#define fnts_open(a, b, c, d, e, f, g)   mt_fnts_open(a,b,c,d,e,f,g,aes_global)
 
#define fnts_remove(a)   mt_fnts_remove(a,aes_global)
 
#define fnts_update(a, b, c, d, e)   mt_fnts_update(a,b,c,d,e,aes_global)
 
#define FNTS_BTMP   1
 
#define FNTS_OUTL   2
 
#define FNTS_MONO   4
 
#define FNTS_PROP   8
 
#define FNTS_3D   1
 
#define FNTS_SNAME   0x01
 
#define FNTS_SSTYLE   0x02
 
#define FNTS_SSIZE   0x04
 
#define FNTS_SRATIO   0x08
 
#define FNTS_CHNAME   0x0100
 
#define FNTS_CHSTYLE   0x0200
 
#define FNTS_CHSIZE   0x0400
 
#define FNTS_CHRATIO   0x0800
 
#define FNTS_RATIO   0x1000
 
#define FNTS_BSET   0x2000
 
#define FNTS_BMARK   0x4000
 
#define FNTS_CANCEL   1
 
#define FNTS_OK   2
 
#define FNTS_SET   3
 
#define FNTS_MARK   4
 
#define FNTS_OPT   5
 
#define FNTS_OPTION   FNTS_OPT
 

Typedefs

typedef void * FNT_DIALOG
 
typedef void __CDECL(* UTXT_FN) (struct UTXT_FN_args)
 
typedef struct _fnts_item FNTS_ITEM
 

Functions

short mt_fnts_add (FNT_DIALOG *fnt_dialog, FNTS_ITEM *user_fonts, short *global)
 
short mt_fnts_close (FNT_DIALOG *fnt_dialog, short *x, short *y, short *global)
 
FNT_DIALOGmt_fnts_create (short vdi_handle, short no_fonts, short font_flags, short dialog_flags, char *sample, char *opt_button, short *global)
 
short mt_fnts_delete (FNT_DIALOG *fnt_dialog, short vdi_handle, short *global)
 
short mt_fnts_do (FNT_DIALOG *fnt_dialog, short button_flags, long id_in, long pt_in, long ratio_in, short *check_boxes, long *id, long *pt, long *ratio, short *global)
 
short mt_fnts_evnt (FNT_DIALOG *fnt_dialog, EVNT *events, short *button, short *check_boxes, long *id, long *pt, long *ratio, short *global)
 
short mt_fnts_get_info (FNT_DIALOG *fnt_dialog, long id, short *mono, short *outline, short *global)
 
short mt_fnts_get_name (FNT_DIALOG *fnt_dialog, long id, char *full_name, char *family_name, char *style_name, short *global)
 
short mt_fnts_get_no_styles (FNT_DIALOG *fnt_dialog, long id, short *global)
 
long mt_fnts_get_style (FNT_DIALOG *fnt_dialog, long id, short __index, short *global)
 
short mt_fnts_open (FNT_DIALOG *fnt_dialog, short button_flags, short x, short y, long id, long pt, long ratio, short *global)
 
void mt_fnts_remove (FNT_DIALOG *fnt_dialog, short *global)
 
short mt_fnts_update (FNT_DIALOG *fnt_dialog, short button_flags, long id, long pt, long ratio, short *global)
 

Detailed Description

font selector functions

This Font Selector library availability can be found calling mt_appl_getinfo(7). Bit 2 of ap_gout1, if equal to 1, says that mt_fnts_xx() functions are available.

Macro Definition Documentation

#define FNTS_3D   1

Display selector in 3D-look

#define fnts_add (   a,
 
)    mt_fnts_add(a,b,aes_global)

single-thread version of mt_fnts_add()

#define FNTS_BMARK   0x4000

Button "Mark" selectable

#define FNTS_BSET   0x2000

Button "Set" selectable

#define FNTS_BTMP   1

Display bitmap fonts

#define FNTS_CANCEL   1

TODO

#define FNTS_CHNAME   0x0100

Display checkbox for names

#define FNTS_CHRATIO   0x0800

Display checkbox for width/height ratio

#define FNTS_CHSIZE   0x0400

Display checkbox for height

#define FNTS_CHSTYLE   0x0200

Display checkbox for style

#define fnts_close (   a,
  b,
 
)    mt_fnts_close(a,b,c,aes_global)

single-thread version of mt_fnts_close()

#define fnts_create (   a,
  b,
  c,
  d,
  e,
 
)    mt_fnts_create(a,b,c,d,e,f,aes_global)

single-thread version of mt_fnts_create()

#define fnts_delete (   a,
 
)    mt_fnts_delete(a,b,aes_global)

single-thread version of mt_fnts_delete()

#define fnts_do (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)    mt_fnts_do(a,b,c,d,e,f,g,h,i,aes_global)

single-thread version of mt_fnts_do()

#define fnts_evnt (   a,
  b,
  c,
  d,
  e,
  f,
 
)    mt_fnts_evnt(a,b,c,d,e,f,g,aes_global)

single-thread version of mt_fnts_evnt()

#define fnts_get_info (   a,
  b,
  c,
 
)    mt_fnts_get_info(a,b,c,d,aes_global)

single-thread version of mt_fnts_get_info()

#define fnts_get_name (   a,
  b,
  c,
  d,
 
)    mt_fnts_get_name(a,b,c,d,e,aes_global)

single-thread version of mt_fnts_get_name()

#define fnts_get_no_styles (   a,
 
)    mt_fnts_get_no_styles(a,b,aes_global)

single-thread version of mt_fnts_get_no_styles()

#define fnts_get_style (   a,
  b,
 
)    mt_fnts_get_style(a,b,c,aes_global)

single-thread version of mt_fnts_get_style()

#define FNTS_MARK   4

TODO

#define FNTS_MONO   4

Display mono-spaced fonts

#define FNTS_OK   2

TODO

#define fnts_open (   a,
  b,
  c,
  d,
  e,
  f,
 
)    mt_fnts_open(a,b,c,d,e,f,g,aes_global)

single-thread version of mt_fnts_open()

#define FNTS_OPT   5

TODO

#define FNTS_OPTION   FNTS_OPT

see FNTS_OPT

#define FNTS_OUTL   2

Display vector fonts

#define FNTS_PROP   8

Display proportional fonts

#define FNTS_RATIO   0x1000

Width/height ratio adjustable

#define fnts_remove (   a)    mt_fnts_remove(a,aes_global)

single-thread version of mt_fnts_remove()

#define FNTS_SET   3

TODO

#define FNTS_SNAME   0x01

Select checkbox for names

#define FNTS_SRATIO   0x08

Select checkbox for width/height ratio

#define FNTS_SSIZE   0x04

Select checkbox for height

#define FNTS_SSTYLE   0x02

Select checkbox for style

#define fnts_update (   a,
  b,
  c,
  d,
 
)    mt_fnts_update(a,b,c,d,e,aes_global)

single-thread version of mt_fnts_update()

Typedef Documentation

typedef void* FNT_DIALOG

opaque structure (internal management structure)

typedef struct _fnts_item FNTS_ITEM

TODO

typedef void __CDECL(* UTXT_FN) (struct UTXT_FN_args)

TODO

Function Documentation

short mt_fnts_add ( FNT_DIALOG fnt_dialog,
FNTS_ITEM user_fonts,
short *  global_aes 
)

add user fonts

Parameters
fnt_dialogPointer to management structure
user_fontsPointer to user fonts
global_aesglobal AES array
Returns
0: Error 1: All OK
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability

With ADD USER FONTS a program can add its own user fonts to those displayed by the font selector. The IDs of these fonts must be higher than 65535. In addition the pointer to a display function must be entered into the structure element FNTS_ITEM::display.

short mt_fnts_close ( FNT_DIALOG fnt_dialog,
short *  x,
short *  y,
short *  global_aes 
)

closes the window of the font selector.

Parameters
fnt_dialogPointer to management structure
xwill contain the Last x-coordinate of the dialog
[option CHECK_NULLPTR] x may be NULL
ywill contain the Last y-coordinate of the dialog
[option CHECK_NULLPTR] y may be NULL
global_aesglobal AES array
Returns
1
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability

Note: Old WDIALOG versions do not return the window coordinates. In that case the binding enters -1, so that the dialog will be centred automatically at the next call.

FNT_DIALOG* mt_fnts_create ( short  vdi_handle,
short  no_fonts,
short  font_flags,
short  dialog_flags,
char *  sample,
char *  opt_button,
short *  global_aes 
)

This function initialises the font selector

Parameters
vdi_handleHandle of the workstation to be used
no_fontsNumber of available fonts or 0. If no_fonts is 0, vst_load_fonts() is called with vdi_handle. Otherwise an assumption is made that no_fonts is the number of all fonts available via vdi_handle, i.e. the number of all system fonts (work_out[10] for v_opnvwk()/vq_extnd()) plus the number of fonts loaded in later (return value of vst_load_fonts()).
font_flagsType of fonts to be displayed. It's a bitmap variable which have the following signification:
  • FNTS_BTMP (1) Display bitmap fonts
  • FNTS_OUTL (2) Display vector fonts
  • FNTS_MONO (4) Display mono-spaced fonts
  • FNTS_PROP (8) Display proportional fonts
dialog_flagsAppearance of the dialog as following:
  • FNTS_3D (1) Display selector in 3D-look
samplePointer to string for the sample text
opt_buttonPointer to string for optional button or 0L
global_aesglobal AES array
Returns
a Pointer to management structure
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
Note
Depending on system configuration, this function may well take 1 second (possibly even more), so it should be called at program start and not just immediately before displaying the font selector.

Please note: The font selector alters the attributes of the workstation described by vdi_handle. If one wants to use the workstation passed with mt_fnts_create() also for other purposes, the attributes have to be set first each time, as they may have been altered meantime by the font selector.

short mt_fnts_delete ( FNT_DIALOG fnt_dialog,
short  vdi_handle,
short *  global_aes 
)

releases the memory allocated for the font selector.

Parameters
fnt_dialogPointer to management structure
vdi_handleHandle of the Workstation or 0, if vst_unload_fonts() is not to be called
global_aesglobal AES array
Returns
1
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
short mt_fnts_do ( FNT_DIALOG fnt_dialog,
short  button_flags,
long  id_in,
long  pt_in,
long  ratio_in,
short *  check_boxes,
long *  id,
long *  pt,
long *  ratio,
short *  global_aes 
)

opens a modal dialog and only returns to the caller when one of the exit buttons ("Cancel", "OK", "Set", "Mark" or "Options") was activated.

Parameters
fnt_dialogPointer to management structure
button_flags
id_in
pt_in
ratio_in
check_boxeswill contain the Status of the checkboxes
[option CHECK_NULLPTR] check_boxes may be NULL
idwill contain the ID of the selected font
[option CHECK_NULLPTR] id may be NULL
ptwill contain the Height in 1/65536 point
[option CHECK_NULLPTR] pt may be NULL
ratiowill contain the Width/height ratio
[option CHECK_NULLPTR] ratio may be NULL
global_aesglobal AES array
Returns
Selected button (or 0)
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
short mt_fnts_evnt ( FNT_DIALOG fnt_dialog,
EVNT events,
short *  button,
short *  check_boxes,
long *  id,
long *  pt,
long *  ratio,
short *  global_aes 
)

evaluates the passed EVNT structure and internally calls mt_wdlg_evnt()

Parameters
fnt_dialogPointer to management structure
eventsPointer to EVNT structure
buttonwill contain the Selected button (or 0)
[option CHECK_NULLPTR] button may be NULL
check_boxeswill contain the Status of the checkboxes:
  • FNTS_SNAME 0x01 Checkbox for the names selected
  • FNTS_SSTYLE 0x02 Checkbox for the style selected
  • FNTS_SSIZE 0x04 Checkbox for the height selected
  • FNTS_SRATIO 0x08 Checkbox for the width/height ratio selected
[option CHECK_NULLPTR] check_boxes may be NULL
idwill contain the ID of the selected font
[option CHECK_NULLPTR] id may be NULL
ptwill contain the Height in 1/65536 point
[option CHECK_NULLPTR] pt may be NULL
ratiowill contain the Width/height ratio
[option CHECK_NULLPTR] ratio may be NULL
global_aesglobal AES array
Returns
0 (Exit button selected) or 1 (Nothing happened)
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability

If one of the exit buttons ("Cancel", "OK", "Set", "Mark" or "Options") was activated the function returns 0 and the button that the user has selected is returned in button.

short mt_fnts_get_info ( FNT_DIALOG fnt_dialog,
long  id,
short *  mono,
short *  outline,
short *  global_aes 
)

get font info

Parameters
fnt_dialogPointer to management structure
idspecifies the Font ID
monowill contain the Flag for mono-spaced font
[option CHECK_NULLPTR] mono may be NULL
outlinewill contain the Flag for vector font
[option CHECK_NULLPTR] outline may be NULL
global_aesglobal AES array
Returns
0 (Error) or >0 (Index for vqt_name())
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
short mt_fnts_get_name ( FNT_DIALOG fnt_dialog,
long  id,
char *  full_name,
char *  family_name,
char *  style_name,
short *  global_aes 
)

returns the full name, the family name and the style for the font given in parameter

Parameters
fnt_dialogPointer to management structure
idspecifies the Font ID
full_namePointer to the full name or 0L
family_namePointer to the family name or 0L
style_namePointer to den style name or 0L
global_aesglobal AES array
Returns
0 (Error) or 1 (All OK)
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
short mt_fnts_get_no_styles ( FNT_DIALOG fnt_dialog,
long  id,
short *  global_aes 
)

returns the number of fonts that belong to the same family as the font given as parameter.

Parameters
fnt_dialogPointer to management structure
idID of a font of the family, that may have been returned by mt_fnts_evnt() for instance.
global_aesglobal AES array
Returns
Number of styles belonging to the family.
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
long mt_fnts_get_style ( FNT_DIALOG fnt_dialog,
long  id,
short  index,
short *  global_aes 
)

font selector - get style id

Parameters
fnt_dialogPointer to management structure
idID of a font of the family
indexIndex within the family. index must be a number between 1 and the result of mt_fnts_get_no_styles().
global_aesglobal AES array
Returns
ID of the index -th font of the family
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
short mt_fnts_open ( FNT_DIALOG fnt_dialog,
short  button_flags,
short  x,
short  y,
long  id,
long  pt,
long  ratio,
short *  global_aes 
)

opens a window dialog with the font selector

Parameters
fnt_dialogPointer to management structure
button_flagsFlags for supported buttons:
  • FNTS_SNAME 0x01 Select checkbox for names
  • FNTS_SSTYLE 0x02 Select checkbox for style
  • FNTS_SSIZE 0x04 Select checkbox for height
  • FNTS_SRATIO 0x08 Select checkbox for width/height ratio
  • FNTS_CHNAME 0x0100 Display checkbox for names
  • FNTS_CHSTYLE 0x0200 Display checkbox for style
  • FNTS_CHSIZE 0x0400 Display checkbox for height
  • FNTS_CHRATIO 0x0800 Display checkbox for width/height ratio
  • FNTS_RATIO 0x1000 Width/height ratio adjustable
  • FNTS_BSET 0x2000 Button "Set" selectable
  • FNTS_BMARK 0x4000 Button "Mark" selectable
xx-coordinate of the window or -1 (centred)
yy-coordinate of the window or -1 (centred)
idFont ID
ptHeight in 1/65536 point
ratioWidth/height ratio in 1/65536
global_aesglobal AES array
Returns
Handle of the window or 0 (error)
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
void mt_fnts_remove ( FNT_DIALOG fnt_dialog,
short *  global_aes 
)

removes the fonts installed with mt_fnts_add()

Parameters
fnt_dialogPointer to management structure
global_aesglobal AES array
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
Note
If a program's user fonts have been installed, then mt_fnts_remove() must be called before mt_fnts_delete().
short mt_fnts_update ( FNT_DIALOG fnt_dialog,
short  button_flags,
long  id,
long  pt,
long  ratio,
short *  global_aes 
)

font selector - update window

Parameters
fnt_dialogPointer to management structure
button_flagsFlags for supported buttons:
  • FNTS_SNAME 0x01 Select checkbox for the names
  • FNTS_SSTYLE 0x02 Select checkbox for the style
  • FNTS_SSIZE 0x04 Select checkbox for the height
  • FNTS_SRATIO 0x08 Select checkbox for the width/height ratio
  • FNTS_CHNAME 0x0100 Display checkbox for the names
  • FNTS_CHSTYLE 0x0200 Display checkbox for the style
  • FNTS_CHSIZE 0x0400 Display checkbox for the height
  • FNTS_CHRATIO 0x0800 Display checkbox for the width/height ratio
  • FNTS_RATIO 0x1000 Width/height ratio adjustable
  • FNTS_BSET 0x2000 Button "setting" selectable
  • FNTS_BMARK 0x4000 Button "marking" selectable
idFont ID
ptHeight in 1/65536 point
ratioWidth/height ratio in 1/65536
global_aesglobal AES array
Returns
one of the following value:
  • -1: Function not present
  • 0: Error (insufficient memory), the font selector must then be closed with mt_fnts_close().
  • 1: All OK
Since
mt_appl_getinfo(7) give informations on mt_fnts_xx() functions availability
Note
This function was not present in older versions of WDIALOG. The binding ensures that in that case the function returns -1.