Max 5 API Reference
![]() |
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_jfont * | jfont_create (const char *family, t_jgraphics_font_slant slant, t_jgraphics_font_weight weight, double size) |
Create a new font object. | |
t_jfont * | jfont_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 of slanting options for font display.
JGRAPHICS_FONT_SLANT_NORMAL |
Normal slanting (typically this means no slanting). |
JGRAPHICS_FONT_SLANT_ITALIC |
Italic slanting. |
Definition at line 665 of file jgraphics.h.
Enumeration of font weight options for font display.
JGRAPHICS_FONT_WEIGHT_NORMAL |
Normal font weight. |
JGRAPHICS_FONT_WEIGHT_BOLD |
Bold font weight. |
Definition at line 674 of file jgraphics.h.
long jbox_get_font_slant | ( | t_object * | b | ) |
Get the slant box's font.
b | An object's box. |
long jbox_get_font_weight | ( | t_object * | b | ) |
Get the slant box's font.
b | An object's box. |
t_jfont* jfont_create | ( | const char * | family, | |
t_jgraphics_font_slant | slant, | |||
t_jgraphics_font_weight | weight, | |||
double | size | |||
) |
Create a new font object.
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. |
void jfont_destroy | ( | t_jfont * | font | ) |
Release or free a font object.
font | The font object to release. |
void jfont_extents | ( | t_jfont * | font, | |
t_jgraphics_font_extents * | extents | |||
) |
Get extents of this font.
font | The font object. | |
extents | The font extents upon return/ |
Get a list of font names.
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. |
Create new reference to an existing font object.
font | The font object for which to obtain a reference. |
void jfont_set_font_size | ( | t_jfont * | font, | |
double | size | |||
) |
Set the size of a font object.
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.
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.
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.
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. |