fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Color & Font functions

fl global color, font functions. These functions are declared in <FL/Fl.H> or <FL/fl_draw.H>. More...

Functions

static void Fl::set_color (Fl_Color, uchar, uchar, uchar)
 
static void Fl::set_color (Fl_Color i, unsigned c)
 
static unsigned Fl::get_color (Fl_Color i)
 
static void Fl::get_color (Fl_Color i, uchar &red, uchar &green, uchar &blue)
 
static void Fl::free_color (Fl_Color i, int overlay=0)
 
static const char * Fl::get_font (Fl_Font)
 
static const char * Fl::get_font_name (Fl_Font, int *attributes=0)
 
static int Fl::get_font_sizes (Fl_Font, int *&sizep)
 
static void Fl::set_font (Fl_Font, const char *)
 
static void Fl::set_font (Fl_Font, Fl_Font)
 
static Fl_Font Fl::set_fonts (const char *=0)
 
void fl_color (Fl_Color c)
 
void fl_color (int c)
 
void fl_color (uchar r, uchar g, uchar b)
 
Fl_Color fl_color ()
 
void fl_font (Fl_Font face, Fl_Fontsize fsize)
 
Fl_Font fl_font ()
 
Fl_Fontsize fl_size ()
 
int fl_height ()
 
FL_EXPORT int fl_height (int font, int size)
 
int fl_descent ()
 
FL_EXPORT double fl_width (const char *txt)
 
double fl_width (const char *txt, int n)
 
double fl_width (unsigned int c)
 
FL_EXPORT void fl_text_extents (const char *, int &dx, int &dy, int &w, int &h)
 
void fl_text_extents (const char *t, int n, int &dx, int &dy, int &w, int &h)
 
const FL_EXPORT char * fl_latin1_to_local (const char *t, int n=-1)
 
const FL_EXPORT char * fl_local_to_latin1 (const char *t, int n=-1)
 
const FL_EXPORT char * fl_mac_roman_to_local (const char *t, int n=-1)
 
const FL_EXPORT char * fl_local_to_mac_roman (const char *t, int n=-1)
 
FL_EXPORT Fl_Color fl_show_colormap (Fl_Color oldcol)
 Pops up a window to let the user pick a colormap entry. More...
 
ulong fl_xpixel (uchar r, uchar g, uchar b)
 
static uchar realcolor (uchar color, uchar mask)
 
ulong fl_xpixel (Fl_Color i)
 
Fl_Color fl_color_average (Fl_Color color1, Fl_Color color2, float weight)
 
Fl_Color fl_inactive (Fl_Color c)
 
Fl_Color fl_contrast (Fl_Color fg, Fl_Color bg)
 

Detailed Description

fl global color, font functions. These functions are declared in <FL/Fl.H> or <FL/fl_draw.H>.

Function Documentation

◆ fl_color() [1/4]

Fl_Color fl_color ( void  )
inline

Returns the last fl_color() that was set. This can be used for state save/restore.

Definition at line 70 of file fl_draw.H.

References Fl_Graphics_Driver::color(), and fl_graphics_driver.

◆ fl_color() [2/4]

void fl_color ( Fl_Color  c)
inline

Sets the color for all subsequent drawing operations. For colormapped displays, a color cell will be allocated out of fl_colormap the first time you use a color. If the colormap fills up then a least-squares algorithm is used to find the closest color. If no valid graphical context (fl_gc) is available, the foreground is not set for the current window.

Parameters
[in]ccolor

Definition at line 52 of file fl_draw.H.

References Fl_Graphics_Driver::color(), and fl_graphics_driver.

Referenced by Fl_Text_Display::clear_rect(), Shortcut_Button::draw(), Fl_FormsBitmap::draw(), Fl_FormsPixmap::draw(), draw(), Fl_Roller::draw(), Fl_Value_Slider::draw(), Fl_Light_Button::draw(), Fl_Positioner::draw(), Fl_Adjuster::draw(), Fl_Value_Output::draw(), Fl_Timer::draw(), Fl_Scrollbar::draw(), Fl_Pack::draw(), Fl_Dial::draw(), Fl_TooltipBox::draw(), Fl_Clock_Output::draw(), Fl_Menu_Button::draw(), Fl_Counter::draw(), Fl_Menu_Bar::draw(), Fl_Slider::draw(), Fl_Choice::draw(), Fl_Input_Choice::InputMenuButton::draw(), Fl_File_Icon::draw(), Fl_Scroll::draw(), Fl_Tree_Item::draw(), Fl_Window::draw(), Fl_Browser_::draw(), Fl_Help_View::draw(), Overlay_Window::draw(), Fl_Menu_Item::draw(), draw_arrow(), draw_arrow1(), draw_arrow2(), draw_arrow3(), draw_arrowbar(), draw_arrowbox(), draw_bararrow(), draw_barchart(), draw_circle(), Fl_Scroll::draw_clip(), draw_current_rect(), Fl_Text_Display::draw_cursor(), draw_doublearrow(), draw_downarrow(), Fl_Image::draw_empty(), draw_filenew(), draw_fileopen(), draw_fileprint(), draw_filesave(), draw_filesaveas(), draw_fltk(), Fl_Widget::draw_focus(), draw_horbarchart(), Fl_Tree_Item::draw_horizontal_connector(), draw_item_focus(), draw_line(), Fl_Text_Display::draw_line_numbers(), draw_linechart(), Fl_Window_Type::draw_overlay(), draw_piechart(), draw_plus(), draw_round_arrow(), draw_search(), Fl_Text_Display::draw_string(), draw_uparrow(), Fl_Tree_Item::draw_vertical_connector(), Fluid_Table::DrawData(), menuwindow::drawentry(), drawhand(), Fluid_Table::DrawHeader(), Fl_Input_::drawtext(), fl_color(), Fl_Copy_Surface::Fl_Copy_Surface(), fl_diamond_down_box(), fl_diamond_up_box(), fl_draw(), fl_drw_text(), fl_drw_text_beside(), fl_frame(), fl_frame2(), fl_normal_label(), fl_rect(), fl_rectf(), fl_return_arrow(), fl_rounded_box(), fl_rshadow_box(), fl_shadow_frame(), frame_rect(), frame_round(), Fl_Help_View::hv_draw(), Fl_Help_Font_Stack::init(), innards(), Fl_Check_Browser::item_draw(), Fl_File_Browser::item_draw(), Fl_Browser::item_draw(), Widget_Browser::item_draw(), Fl_Image::labeltype(), narrow_thin_box(), Fl::paste(), Fl_Help_Font_Stack::pop(), print_menu_cb(), Fl_Help_Font_Stack::push(), rectangle(), Fl::set_box_color(), set_outline_color(), shade_rect(), and shade_round().

◆ fl_color() [3/4]

void fl_color ( int  c)
inline

for back compatibility - use fl_color(Fl_Color c) instead

Definition at line 54 of file fl_draw.H.

References fl_color().

◆ fl_color() [4/4]

void fl_color ( uchar  r,
uchar  g,
uchar  b 
)
inline

Sets the color for all subsequent drawing operations. The closest possible match to the RGB color is used. The RGB color is used directly on TrueColor displays. For colormap visuals the nearest index in the gray ramp or color cube is used. If no valid graphical context (fl_gc) is available, the foreground is not set for the current window.

Parameters
[in]r,g,bcolor components

Definition at line 65 of file fl_draw.H.

References b, Fl_Graphics_Driver::color(), and fl_graphics_driver.

◆ fl_color_average()

Fl_Color fl_color_average ( Fl_Color  color1,
Fl_Color  color2,
float  weight 
)

Returns the weighted average color between the two given colors. The red, green and blue values are averages using the following formula:

color = color1 * weight + color2 * (1 - weight)

Thus, a weight value of 1.0 will return the first color, while a value of 0.0 will return the second color.

Parameters
[in]color1,color2boundary colors
[in]weightweighting factor

Definition at line 402 of file fl_color.cxx.

References b, fl_cmap, and fl_rgb_color().

Referenced by Fl_Text_Display::clear_rect(), down_box(), Fl_Light_Button::draw(), Fl_Clock_Output::draw(), CodeViewer::draw(), Fl_Window::draw(), Fl_Menu_Item::draw(), draw_fileprint(), draw_filesaveas(), Fl_Text_Display::draw_string(), Fl_Input_::drawtext(), fl_darker(), fl_inactive(), fl_lighter(), frame_rect_down(), frame_rect_up(), gtk_down_frame(), gtk_round_down_box(), gtk_round_up_box(), gtk_thin_down_frame(), gtk_thin_up_box(), gtk_thin_up_frame(), gtk_up_box(), gtk_up_frame(), Fl_File_Icon::load_fti(), shade_color(), shade_rect_top_bottom(), thin_down_box(), thin_up_box(), up_box(), and up_frame().

◆ fl_contrast()

Fl_Color fl_contrast ( Fl_Color  fg,
Fl_Color  bg 
)

Returns a color that contrasts with the background color. This will be the foreground color if it contrasts sufficiently with the background color. Otherwise, returns FL_WHITE or FL_BLACK depending on which color provides the best contrast.

Parameters
[in]fg,bgforeground and background colors
Returns
contrasting color

Definition at line 435 of file fl_color.cxx.

References FL_BLACK, fl_cmap, and FL_WHITE.

Referenced by Fl::background2(), color2_cb(), color_cb(), Fl_Progress::draw(), Fl_Choice::draw(), Fl_Button::draw(), Fl_Tree_Item::draw(), Fl_Help_View::draw(), Fl_Menu_Item::draw(), Fl_Widget::draw_focus(), draw_item_focus(), Fl_Text_Display::draw_string(), Fl_Input_::drawtext(), Fl_Help_View::format(), Fl_Choice::handle(), Fl_Check_Browser::item_draw(), Fl_File_Browser::item_draw(), Fl_Browser::item_draw(), Widget_Browser::item_draw(), labelcolor_cb(), textcolor_cb(), and Fl_PostScript_Graphics_Driver::transformed_draw_extra().

◆ fl_descent()

int fl_descent ( )
inline

Returns the recommended distance above the bottom of a fl_height() tall box to draw the text at so it looks centered vertically in that box.

Definition at line 533 of file fl_draw.H.

References Fl_Graphics_Driver::descent(), and fl_graphics_driver.

Referenced by Fl_Tree_Item::calc_item_height(), Fl_Tree_Item::draw(), Fl_Help_View::draw(), Fl_Text_Display::draw_string(), Fl_Input_::drawtext(), fl_draw(), and Fl_Help_View::hv_draw().

◆ fl_font() [1/2]

Fl_Font fl_font ( void  )
inline

Returns the face set by the most recent call to fl_font(). This can be used to save/restore the font.

Definition at line 515 of file fl_draw.H.

References fl_graphics_driver, and Fl_Graphics_Driver::font().

◆ fl_font() [2/2]

void fl_font ( Fl_Font  face,
Fl_Fontsize  fsize 
)
inline

Sets the current font, which is then used in various drawing routines. You may call this outside a draw context if necessary to call fl_width(), but on X this will open the display.

The font is identified by a face and a size. The size of the font is measured in pixels and not "points". Lines should be spaced size pixels apart or more.

Definition at line 509 of file fl_draw.H.

References fl_graphics_driver, and Fl_Graphics_Driver::font().

Referenced by Fl_Tree_Item::calc_item_height(), Shortcut_Button::draw(), Fl_Value_Slider::draw(), Fl_Value_Output::draw(), Fl_Timer::draw(), Fl_TooltipBox::draw(), Fl_Counter::draw(), Fl_Chart::draw(), Fl_Tree_Item::draw(), Fluid_Table::draw_cell(), draw_height(), Fl_Text_Display::draw_line_numbers(), Fl_Text_Display::draw_string(), Fl_Tree::draw_tree(), draw_width(), menuwindow::drawentry(), fl_drw_text(), fl_drw_text_beside(), fl_height(), fl_normal_label(), fl_normal_measure(), Fl_Browser_Type::ideal_size(), Fl_Check_Browser_Type::ideal_size(), Fl_File_Browser_Type::ideal_size(), Fl_Spinner_Type::ideal_size(), Fl_Input_Type::ideal_size(), Fl_File_Input_Type::ideal_size(), Fl_Text_Display_Type::ideal_size(), Fl_Text_Editor_Type::ideal_size(), Fl_Help_View_Type::ideal_size(), Fl_Output_Type::ideal_size(), Fl_Input_Choice_Type::ideal_size(), Fl_Value_Input_Type::ideal_size(), Fl_Value_Output_Type::ideal_size(), Fl_Tabs_Type::ideal_spacing(), Fl_Help_Font_Stack::init(), innards(), Fl_Check_Browser::item_draw(), Fl_File_Browser::item_draw(), Fl_Browser::item_draw(), Widget_Browser::item_draw(), Fl_File_Browser::item_height(), Fl_Browser::item_height(), Fl_Check_Browser::item_width(), Fl_File_Browser::item_width(), Fl_Browser::item_width(), Widget_Browser::item_width(), Fl_TooltipBox::layout(), Fl_Input_::linesPerPage(), Fl_Help_Font_Stack::pop(), print_menu_cb(), Fl_Help_Font_Stack::push(), resizeform(), Fl_Input_::setfont(), Fl_Text_Display::string_width(), and Fl_File_Input::update_buttons().

◆ fl_height() [1/2]

◆ fl_height() [2/2]

FL_EXPORT int fl_height ( int  font,
int  size 
)

This function returns the actual height of the specified font and size. Normally the font height should always be 'size', but with the advent of XFT, there are (currently) complexities that seem to only be solved by asking the font what its actual font height is. (See STR#2115)

This function was originally undocumented in 1.1.x, and was used only by Fl_Text_Display. We're now documenting it in 1.3.x so that apps that need precise height info can get it with this function.

Returns
the height of the font in pixels.
Todo:
In the future, when the XFT issues are resolved, this function should simply return the 'size' value.

Definition at line 449 of file fl_draw.cxx.

References fl_font(), and fl_size().

Referenced by fl_draw(), and fl_measure().

◆ fl_inactive()

◆ fl_latin1_to_local()

const FL_EXPORT char* fl_latin1_to_local ( const char *  t,
int  n = -1 
)

Converts text from Windows/X11 latin1 character set to local encoding.

Parameters
[in]tcharacter string (latin1 encoding)
[in]noptional number of characters to convert (default is all)
Returns
pointer to internal buffer containing converted characters

Definition at line 114 of file fl_encoding_latin1.cxx.

◆ fl_local_to_latin1()

const FL_EXPORT char* fl_local_to_latin1 ( const char *  t,
int  n = -1 
)

Converts text from local encoding to Windowx/X11 latin1 character set.

Parameters
[in]tcharacter string (local encoding)
[in]noptional number of characters to convert (default is all)
Returns
pointer to internal buffer containing converted characters

Definition at line 119 of file fl_encoding_latin1.cxx.

◆ fl_local_to_mac_roman()

const FL_EXPORT char* fl_local_to_mac_roman ( const char *  t,
int  n = -1 
)

Converts text from local encoding to Mac Roman character set.

Parameters
[in]tcharacter string (local encoding)
[in]noptional number of characters to convert (default is all)
Returns
pointer to internal buffer containing converted characters

Definition at line 79 of file fl_encoding_mac_roman.cxx.

References buf, free(), latin2roman, malloc(), and n_buf.

◆ fl_mac_roman_to_local()

const FL_EXPORT char* fl_mac_roman_to_local ( const char *  t,
int  n = -1 
)

Converts text from Mac Roman character set to local encoding.

Parameters
[in]tcharacter string (Mac Roman encoding)
[in]noptional number of characters to convert (default is all)
Returns
pointer to internal buffer containing converted characters

Definition at line 100 of file fl_encoding_mac_roman.cxx.

References buf, free(), malloc(), n_buf, and roman2latin.

◆ fl_show_colormap()

FL_EXPORT Fl_Color fl_show_colormap ( Fl_Color  oldcol)

Pops up a window to let the user pick a colormap entry.

Parameters
[in]oldcolcolor to be highlighted when grid is shown.
Return values
Fl_Colorvalue of the chosen colormap entry.
See also
Fl_Color_Chooser

Definition at line 146 of file fl_show_colormap.cxx.

References ColorMenu::run().

Referenced by color2_cb(), color_cb(), labelcolor_cb(), and textcolor_cb().

◆ fl_size()

Fl_Fontsize fl_size ( )
inline

Returns the size set by the most recent call to fl_font(). This can be used to save/restore the font.

Definition at line 520 of file fl_draw.H.

References fl_graphics_driver, and Fl_Graphics_Driver::size().

Referenced by fl_height().

◆ fl_text_extents() [1/2]

FL_EXPORT void fl_text_extents ( const char *  ,
int &  dx,
int &  dy,
int &  w,
int &  h 
)

Determines the minimum pixel dimensions of a nul-terminated string.

Usage: given a string "txt" drawn using fl_draw(txt, x, y) you would determine its pixel extents on the display using fl_text_extents(txt, dx, dy, wo, ho) such that a bounding box that exactly fits around the text could be drawn with fl_rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the first "colored in" pixel of the string, from the draw origin.

No FLTK symbol expansion will be performed.

Definition at line 78 of file fl_font.cxx.

References dx, and dy.

◆ fl_text_extents() [2/2]

void fl_text_extents ( const char *  t,
int  n,
int &  dx,
int &  dy,
int &  w,
int &  h 
)
inline

Determines the minimum pixel dimensions of a sequence of n characters.

See also
fl_text_extents(const char*, int& dx, int& dy, int& w, int& h)

Definition at line 559 of file fl_draw.H.

References dx, dy, fl_graphics_driver, Fl_Image::h(), Fl_Graphics_Driver::text_extents(), and Fl_Image::w().

◆ fl_width() [1/3]

◆ fl_width() [2/3]

double fl_width ( const char *  txt,
int  n 
)
inline

Returns the typographical width of a sequence of n characters using the current font face and size.

Definition at line 539 of file fl_draw.H.

References fl_graphics_driver, and Fl_Graphics_Driver::width().

◆ fl_width() [3/3]

double fl_width ( unsigned int  c)
inline

Returns the typographical width of a single character using the current font face and size.

Note
if a valid fl_gc is NOT found then it uses the first window gc, or the screen gc if no fltk window is available when called.

Definition at line 544 of file fl_draw.H.

References fl_graphics_driver, and Fl_Graphics_Driver::width().

◆ fl_xpixel() [1/2]

ulong fl_xpixel ( Fl_Color  i)

Returns the X pixel number used to draw the given FLTK color index. This is the X pixel that fl_color() would use.

Parameters
[in]icolor index
Returns
X pixel number

Definition at line 203 of file fl_color.cxx.

References Fl_XColor::b, b, beenhere, figure_out_visual(), fl_bluemask, fl_blueshift, fl_cmap, fl_colormap, fl_display, fl_extrashift, fl_greenmask, fl_greenshift, fl_overlay, fl_redmask, fl_redshift, fl_visual, fl_xmap, fl_xpixel(), Fl_XColor::g, Fl_XColor::mapped, p, Fl_XColor::pixel, Fl_XColor::r, and realcolor().

Referenced by figure_out_visual(), and fl_drawUCS4().

◆ fl_xpixel() [2/2]

ulong fl_xpixel ( uchar  r,
uchar  g,
uchar  b 
)

Returns the X pixel number used to draw the given rgb color. This is the X pixel that fl_color() would use.

Parameters
[in]r,g,bcolor components
Returns
X pixel number

Definition at line 150 of file fl_color.cxx.

References b, beenhere, figure_out_visual(), fl_bluemask, fl_blueshift, fl_cmap, FL_COLOR_CUBE, fl_color_cube(), fl_extrashift, fl_greenmask, fl_greenshift, FL_NUM_BLUE, FL_NUM_GREEN, FL_NUM_RED, fl_overlay, fl_redmask, fl_redshift, fl_xmap, Fl_XColor::mapped, and Fl_XColor::pixel.

Referenced by Fl_Xlib_Graphics_Driver::color(), and fl_xpixel().

◆ free_color()

void Fl::free_color ( Fl_Color  i,
int  overlay = 0 
)
static

Frees the specified color from the colormap, if applicable. If overlay is non-zero then the color is freed from the overlay colormap.

Free color i if used, and clear mapping table entry.

Parameters
[in]icolor index
[in]overlay0 for normal, 1 for overlay color

Definition at line 316 of file fl_color.cxx.

References fl_colormap, fl_display, fl_xmap, and Fl_XColor::mapped.

Referenced by Fl::set_color().

◆ get_color() [1/2]

unsigned Fl::get_color ( Fl_Color  i)
static

Returns the RGB value(s) for the given FLTK color index.

This form returns the RGB values packed in a 32-bit unsigned integer with the red value in the upper 8 bits, the green value in the next 8 bits, and the blue value in bits 8-15. The lower 8 bits will always be 0.

Definition at line 359 of file fl_color.cxx.

References fl_cmap.

Referenced by Fl::background2(), calc_mask(), Fl_PostScript_Graphics_Driver::color(), Fl_Pixmap::color_average(), Fl_RGB_Image::color_average(), CodeViewer::draw(), fl_convert_pixmap(), fl_drawUCS4(), flcolortocgcolor(), Fl::reload_scheme(), and shade_color().

◆ get_color() [2/2]

void Fl::get_color ( Fl_Color  i,
uchar red,
uchar green,
uchar blue 
)
static

Returns the RGB value(s) for the given FLTK color index.

This form returns the red, green, and blue values separately in referenced variables.

See also unsigned get_color(Fl_Color c)

Definition at line 380 of file fl_color.cxx.

References fl_cmap.

◆ get_font()

const char * Fl::get_font ( Fl_Font  fnum)
static

Gets the string for this face. This string is different for each face. Under X this value is passed to XListFonts to get all the sizes of this face.

Definition at line 87 of file fl_set_font.cxx.

References fl_fonts, and Fl_Fontdesc::name.

Referenced by Fl::set_font().

◆ get_font_name()

const char * Fl::get_font_name ( Fl_Font  fnum,
int *  attributes = 0 
)
static

Get a human-readable string describing the family of this face. This is useful if you are presenting a choice to the user. There is no guarantee that each face has a different name. The return value points to a static buffer that is overwritten each call.

The integer pointed to by attributes (if the pointer is not zero) is set to zero, FL_BOLD or FL_ITALIC or FL_BOLD | FL_ITALIC. To locate a "family" of fonts, search forward and back for a set with non-zero attributes, these faces along with the face with a zero attribute before them constitute a family.

Definition at line 31 of file fl_set_fonts_mac.cxx.

References ENDOFBUFFER, f, FL_BOLD, fl_fonts, FL_ITALIC, fl_mac_os_version, NULL, p, and strlcpy.

Referenced by enumcbw().

◆ get_font_sizes()

int Fl::get_font_sizes ( Fl_Font  fnum,
int *&  sizep 
)
static

Return an array of sizes in sizep. The return value is the length of this array. The sizes are sorted from smallest to largest and indicate what sizes can be given to fl_font() that will be matched exactly (fl_font() will pick the closest size for other sizes). A zero in the first location of the array indicates a scalable font, where any size works, although the array may list sizes that work "better" than others. Warning: the returned array points at a static buffer that is overwritten each call. Under X this will open the display.

Definition at line 183 of file fl_set_fonts_mac.cxx.

References array, fl_fonts, and Fl_Fontdesc::name.

◆ realcolor()

static uchar realcolor ( uchar  color,
uchar  mask 
)
inlinestatic

Definition at line 179 of file fl_color.cxx.

References color().

Referenced by fl_xpixel().

◆ set_color() [1/2]

void Fl::set_color ( Fl_Color  i,
unsigned  c 
)
static

Sets an entry in the fl_color index table. You can set it to any 8-bit RGB color. The color is not allocated until fl_color(i) is used.

Set color mapping table entry i to color c

Parameters
[in]icolor index
[in]ccolor

Definition at line 340 of file fl_color.cxx.

References fl_cmap, and Fl::free_color().

◆ set_color() [2/2]

void Fl::set_color ( Fl_Color  i,
uchar  red,
uchar  green,
uchar  blue 
)
static

Sets an entry in the fl_color index table. You can set it to any 8-bit RGB color. The color is not allocated until fl_color(i) is used.

Definition at line 368 of file fl_color.cxx.

Referenced by Fl::background(), Fl::background2(), CodeViewer::draw(), fl_mapcolor(), Fl::foreground(), and set_selection_color().

◆ set_font() [1/2]

void Fl::set_font ( Fl_Font  fnum,
const char *  name 
)
static

Changes a face. The string pointer is simply stored, the string is not copied, so the string must be in static memory.

Definition at line 34 of file fl_set_font.cxx.

References Fl_Display_Device::display_device(), Fl_Surface_Device::driver(), f, Fl_Fontdesc::first, fl_fonts, FL_FREE_FONT, Fl_Fontdesc::fontname, malloc(), Fl_Fontdesc::n, name, Fl_Fontdesc::name, table_size, and Fl_Fontdesc::xlist.

Referenced by enumcbw(), fl_set_font_name(), Fl::set_font(), and Fl::set_fonts().

◆ set_font() [2/2]

void Fl::set_font ( Fl_Font  fnum,
Fl_Font  from 
)
static

Copies one face to another.

Definition at line 79 of file fl_set_font.cxx.

References Fl::get_font(), and Fl::set_font().

◆ set_fonts()

Fl_Font Fl::set_fonts ( const char *  xstarname = 0)
static

FLTK will open the display, and add every fonts on the server to the face table. It will attempt to put "families" of faces together, so that the normal one is first, followed by bold, italic, and bold italic.

The optional argument is a string to describe the set of fonts to add. Passing NULL will select only fonts that have the ISO8859-1 character set (and are thus usable by normal text). Passing "-*" will select all fonts with any encoding as long as they have normal X font names with dashes in them. Passing "*" will list every font that exists (on X this may produce some strange output). Other values may be useful but are system dependent. With WIN32 NULL selects fonts with ISO8859-1 encoding and non-NULL selects all fonts.

The return value is how many faces are in the table after this is done.

Definition at line 103 of file fl_set_fonts_mac.cxx.

References fl_free_font, FL_FREE_FONT, fl_mac_os_version, fname, free(), malloc(), name_compare(), NULL, and Fl::set_font().

color
void color(int n)
Definition: gl2opengl.h:29