+ Collaboration diagram for JFont:

Typedefs

typedef struct _jfont t_jfont
 An instance of a jgraphics font.
 

Enumerations

enum  t_jgraphics_font_slant { JGRAPHICS_FONT_SLANT_NORMAL, JGRAPHICS_FONT_SLANT_ITALIC }
 Enumeration of slanting options for font display. More...
 
enum  t_jgraphics_font_weight { JGRAPHICS_FONT_WEIGHT_NORMAL, JGRAPHICS_FONT_WEIGHT_BOLD }
 Enumeration of font weight options for font display. More...
 

Functions

t_jfontjfont_create (const char *family, t_jgraphics_font_slant slant, t_jgraphics_font_weight weight, double size)
 Create a new font object. More...
 
t_jfontjfont_reference (t_jfont *font)
 Create new reference to an existing font object. More...
 
void jfont_destroy (t_jfont *font)
 Release or free a font object. More...
 
long jfont_isequalto (t_jfont *font, t_jfont *other)
 Compare two fonts to see if they are equivalent. More...
 
void jfont_set_family (t_jfont *font, t_symbol *family)
 Set the name of the font family (e.g. More...
 
t_symboljfont_get_family (t_jfont *font)
 Get the name of the font family (e.g. More...
 
void jfont_set_slant (t_jfont *font, t_jgraphics_font_slant slant)
 Set the slant of the font. More...
 
t_jgraphics_font_slant jfont_get_slant (t_jfont *font)
 Get the slant of the font. More...
 
void jfont_set_weight (t_jfont *font, t_jgraphics_font_weight weight)
 Set the weight of the font. More...
 
t_jgraphics_font_weight jfont_get_weight (t_jfont *font)
 Get the weight of the font. More...
 
void jfont_set_font_size (t_jfont *font, double size)
 Set the size of a font object. More...
 
double jfont_get_font_size (t_jfont *font)
 Get the size of a font object. More...
 
void jfont_set_underline (t_jfont *font, char ul)
 Set the underlining of a font object. More...
 
char jfont_get_underline (t_jfont *font)
 Get the underline state of a font object. More...
 
void jfont_extents (t_jfont *font, t_jgraphics_font_extents *extents)
 Get extents of this font. More...
 
void jfont_text_measure (t_jfont *font, const char *utf8, double *width, double *height)
 Given a font, find out how much area is required to render a string of text. More...
 
void jfont_text_measuretext_wrapped (t_jfont *font, const char *utf8, double wrapwidth, long includewhitespace, double *width, double *height, long *numlines)
 Given a font, find out how much area is required to render a string of text, provided a horizontal maximum limit at which the text is wrapped. More...
 
void jfont_get_em_dimensions (t_jfont *font, double *width, double *height)
 Given a font, find out the width and height of the 'M' character. More...
 
t_max_err jfont_getfontlist (long *count, t_symbol ***list)
 Get a list of font names. More...
 
long jbox_get_font_weight (t_object *b)
 Get the slant box's font. More...
 
long jbox_get_font_slant (t_object *b)
 Get the slant box's font. More...
 
const char * systemfontname ()
 Retrieve the name of Max's system font. More...
 
const char * systemfontname_bold ()
 Retrieve the name of Max's bold system font. More...
 
const char * systemfontname_light ()
 Retrieve the name of Max's light system font. More...
 
t_symbolsystemfontsym ()
 Retrieve the name of Max's system font as a symbol. More...
 

Detailed Description

Enumeration Type Documentation

Enumeration of slanting options for font display.

Enumerator
JGRAPHICS_FONT_SLANT_NORMAL 

Normal slanting (typically this means no slanting)

JGRAPHICS_FONT_SLANT_ITALIC 

Italic slanting.

Enumeration of font weight options for font display.

Enumerator
JGRAPHICS_FONT_WEIGHT_NORMAL 

Normal font weight.

JGRAPHICS_FONT_WEIGHT_BOLD 

Bold font weight.

Function Documentation

long jbox_get_font_slant ( t_object b)

Get the slant box's font.

Parameters
bAn object's box.
Returns
A value from the t_jgraphics_font_slant enum.
long jbox_get_font_weight ( t_object b)

Get the slant box's font.

Parameters
bAn object's box.
Returns
A value from the t_jgraphics_font_weight enum.
t_jfont* jfont_create ( const char *  family,
t_jgraphics_font_slant  slant,
t_jgraphics_font_weight  weight,
double  size 
)

Create a new font object.

Parameters
familyThe name of the font family (e.g. Arial).
slantThe type of slant for the font.
weightThe type of weight for the font.
sizeThe size of the font.
Returns
The new font object.
void jfont_destroy ( t_jfont font)

Release or free a font object.

Parameters
fontThe font object to release.
void jfont_extents ( t_jfont font,
t_jgraphics_font_extents extents 
)

Get extents of this font.

Parameters
fontThe font object.
extentsThe font extents upon return/
void jfont_get_em_dimensions ( t_jfont font,
double *  width,
double *  height 
)

Given a font, find out the width and height of the 'M' character.

This is equivalent to jfont_text_measure(font, "M", width, height) but is faster.

Parameters
fontThe font object.
widthThe address of a variable to hold the width upon return.
heightThe address of a variable to hold the height upon return.
t_symbol* jfont_get_family ( t_jfont font)

Get the name of the font family (e.g.

Arial).

Parameters
fontThe font object.
Returns
A t_symbol representing the name of the font family.
double jfont_get_font_size ( t_jfont font)

Get the size of a font object.

Parameters
fontThe font object.
Returns
The size of the font.
t_jgraphics_font_slant jfont_get_slant ( t_jfont font)

Get the slant of the font.

Parameters
fontThe font object.
Returns
The current slant setting for the font.
char jfont_get_underline ( t_jfont font)

Get the underline state of a font object.

Parameters
fontThe font object.
Returns
Nonzero value if the font will be underlined.
t_jgraphics_font_weight jfont_get_weight ( t_jfont font)

Get the weight of the font.

Parameters
fontThe font object.
Returns
The current weight setting for the font.
t_max_err jfont_getfontlist ( long *  count,
t_symbol ***  list 
)

Get a list of font names.

Parameters
countThe addres of a variable to hold the count of font names in list upon return.
listThe address of a t_symbol** initialized to NULL. Upon return this will be set to an array of count t_symbol pointers. This array should be freed using sysmem_freeptr() when you are done with it.
Returns
A Max error code.
long jfont_isequalto ( t_jfont font,
t_jfont other 
)

Compare two fonts to see if they are equivalent.

Parameters
fontThe first font object that is being compared.
otherThe second font object that is being compared.
Returns
Nonzero value if the two fonts are equivalent.
t_jfont* jfont_reference ( t_jfont font)

Create new reference to an existing font object.

Parameters
fontThe font object for which to obtain a reference.
Returns
The new font object reference.
void jfont_set_family ( t_jfont font,
t_symbol family 
)

Set the name of the font family (e.g.

Arial).

Parameters
fontThe font object.
familyA t_symbol containing the name of the desired font family.
void jfont_set_font_size ( t_jfont font,
double  size 
)

Set the size of a font object.

Parameters
fontThe font object.
sizeThe new size for the font object.
void jfont_set_slant ( t_jfont font,
t_jgraphics_font_slant  slant 
)

Set the slant of the font.

Parameters
fontThe font object
slantThe desired slant.
void jfont_set_underline ( t_jfont font,
char  ul 
)

Set the underlining of a font object.

Parameters
fontThe font object.
ulPass true to underline, or false for no underlining.
void jfont_set_weight ( t_jfont font,
t_jgraphics_font_weight  weight 
)

Set the weight of the font.

Parameters
fontThe font object
weightThe desired weight (e.g. bold).
void jfont_text_measure ( t_jfont font,
const char *  utf8,
double *  width,
double *  height 
)

Given a font, find out how much area is required to render a string of text.

Parameters
fontThe font object.
utf8The text whose rendering will be measured.
widthThe address of a variable to hold the width upon return.
heightThe address of a variable to hold the height upon return.
void jfont_text_measuretext_wrapped ( t_jfont font,
const char *  utf8,
double  wrapwidth,
long  includewhitespace,
double *  width,
double *  height,
long *  numlines 
)

Given a font, find out how much area is required to render a string of text, provided a horizontal maximum limit at which the text is wrapped.

Parameters
fontThe font object.
utf8The text whose rendering will be measured.
wrapwidthThe maximum width, above which text should wrap onto a new line.
includewhitespaceIf non-zero, include whitespace in the measurement.
widthThe address of a variable to hold the width upon return.
heightThe address of a variable to hold the height upon return.
numlinesThe address of a variable to hold the number of lines of text after wrapping upon return.
const char* systemfontname ( )

Retrieve the name of Max's system font.

Returns
The name of Max's system font.
const char* systemfontname_bold ( )

Retrieve the name of Max's bold system font.

Returns
The name of Max's bold system font.
const char* systemfontname_light ( )

Retrieve the name of Max's light system font.

Returns
The name of Max's light system font.
t_symbol* systemfontsym ( )

Retrieve the name of Max's system font as a symbol.

Returns
The name of Max's system font.
  Copyright © 2015, Cycling '74