Max 5 API Reference

JFont
[JGraphics]

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.
t_jfontjfont_reference (t_jfont *font)
 Create new reference to an existing font object.
void jfont_destroy (t_jfont *font)
 Release or free a font object.
void jfont_set_font_size (t_jfont *font, double size)
 Set the size of a font object.
void jfont_set_underline (t_jfont *font, char ul)
 Set the underlining of a font object.
void jfont_extents (t_jfont *font, t_jgraphics_font_extents *extents)
 Get extents of this font.
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.
void jfont_text_measure_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.
t_max_err jfont_getfontlist (long *count, t_symbol ***list)
 Get a list of font names.
long jbox_get_font_weight (t_object *b)
 Get the slant box's font.
long jbox_get_font_slant (t_object *b)
 Get the slant box's font.

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:
b An 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:
b An 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:
family The name of the font family (e.g. Arial).
slant The type of slant for the font.
weight The type of weight for the font.
size The size of the font.
Returns:
The new font object.
void jfont_destroy ( t_jfont font  ) 

Release or free a font object.

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

Get extents of this font.

Parameters:
font The font object.
extents The font extents upon return/
t_max_err jfont_getfontlist ( long *  count,
t_symbol ***  list 
)

Get a list of font names.

Parameters:
count The addres of a variable to hold the count of font names in list upon return.
list The 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.
t_jfont* jfont_reference ( t_jfont font  ) 

Create new reference to an existing font object.

Parameters:
font The font object for which to obtain a reference.
Returns:
The new font object reference.
void jfont_set_font_size ( t_jfont font,
double  size 
)

Set the size of a font object.

Parameters:
font The font object.
size The new size for the font object.
void jfont_set_underline ( t_jfont font,
char  ul 
)

Set the underlining of a font object.

Parameters:
font The font object.
ul Pass true to underline, or false for no underlining.
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:
font The font object.
utf8 The text whose rendering will be measured.
width The address of a variable to hold the width upon return.
height The address of a variable to hold the height upon return.
void jfont_text_measure_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:
font The font object.
utf8 The text whose rendering will be measured.
wrapwidth The maximum width, above which text should wrap onto a new line.
includewhitespace If non-zero, include whitespace in the measurement.
width The address of a variable to hold the width upon return.
height The address of a variable to hold the height upon return.
numlines The address of a variable to hold the number of lines of text after wrapping upon return.

Copyright © 2008, Cycling '74