Tk_AllocFontFromObj


HOME

Tk_AllocFontFromObj

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
SEE ALSO
KEYWORDS

___________________________

NAME

Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FreeFontFromObj, Tk_FreeFont − maintain database of fonts

SYNOPSIS

#include <tk.h>

Tk_Font
Tk_AllocFontFromObj(
interp, tkwin, objPtr)

Tk_Font
Tk_GetFont(
interp, tkwin, string)

Tk_Font
Tk_GetFontFromObj(
tkwin, objPtr)

const char *
Tk_NameOfFont(
tkfont)

Tk_Font
Tk_FreeFontFromObj(
tkwin, objPtr)

void
Tk_FreeFont(
tkfont)

ARGUMENTS

Tcl_Interp *interp (in)

Interpreter to use for error reporting. If NULL, then no error messages are left after errors.

Tk_Window tkwin (in)

Token for window in which font will be used.

Tcl_Obj *objPtr (in/out)

Gives name or description of font. See documentation for the font command for details on acceptable formats. Internal rep will be modified to cache corresponding Tk_Font.

const char *string (in)

Same as objPtr except description of font is passed as a string and resulting Tk_Font is not cached.

Tk_Font tkfont (in)

Opaque font token.

______________

DESCRIPTION

Tk_AllocFontFromObj finds the font indicated by objPtr and returns a token that represents the font. The return value can be used in subsequent calls to procedures such as Tk_GetFontMetrics, Tk_MeasureChars, and Tk_FreeFont. The Tk_Font token will remain valid until Tk_FreeFontFromObj or Tk_FreeFont is called to release it. ObjPtr can contain either a symbolic name or a font description; see the documentation for the font command for a description of the valid formats. If Tk_AllocFontFromObj is unsuccessful (because, for example, objPtr did not contain a valid font specification) then it returns NULL and leaves an error message in interp’s result if interp is not NULL. Tk_AllocFontFromObj caches information about the return value in objPtr, which speeds up future calls to procedures such as Tk_AllocFontFromObj and Tk_GetFontFromObj.

Tk_GetFont is identical to Tk_AllocFontFromObj except that the description of the font is specified with a string instead of an object. This prevents Tk_GetFont from caching the matching Tk_Font, so Tk_GetFont is less efficient than Tk_AllocFontFromObj.

Tk_GetFontFromObj returns the token for an existing font, given the window and description used to create the font. Tk_GetFontFromObj does not actually create the font; the font must already have been created with a previous call to Tk_AllocFontFromObj or Tk_GetFont. The return value is cached in objPtr, which speeds up future calls to Tk_GetFontFromObj with the same objPtr and tkwin.

Tk_AllocFontFromObj and Tk_GetFont maintain a database of all fonts they have allocated. If the same font is requested multiple times (e.g. by different windows or for different purposes), then a single Tk_Font will be shared for all uses. The underlying resources will be freed automatically when no-one is using the font anymore.

The procedure Tk_NameOfFont is roughly the inverse of Tk_GetFont. Given a tkfont that was created by Tk_GetFont (or Tk_AllocFontFromObj), the return value is the string argument that was passed to Tk_GetFont to create the font. The string returned by Tk_NameOfFont is only guaranteed to persist until the tkfont is deleted. The caller must not modify this string.

When a font is no longer needed, Tk_FreeFontFromObj or Tk_FreeFont should be called to release it. For Tk_FreeFontFromObj the font to release is specified with the same information used to create it; for Tk_FreeFont the font to release is specified with its Tk_Font token. There should be exactly one call to Tk_FreeFontFromObj or Tk_FreeFont for each call to Tk_AllocFontFromObj or Tk_GetFont.

SEE ALSO

Tk_FontId(3)

KEYWORDS

font



More Linux Commands

manpages/Tcl_UtfToUpper.3.html
Tcl_UtfToUpper(3) - routines for manipulating the case of Un
The first three routines convert the case of individual Unicode characters: If ch represents a lower-case character, Tcl_UniCharToUpper returns the correspondin

manpages/XkbSetNamedIndicator.3.html
XkbSetNamedIndicator(3) - Names an indicator if it is not al
If a compatible version of the Xkb extension is not available in the server, XkbSetNamedIndicator returns False. Otherwise, it sends a request to the X server t

manpages/ufraw.1.html
ufraw(1) Convert camera RAW images to standard image files.
The Unidentified Flying Raw (UFRaw) is a utility to read and manipulate raw images from digital cameras. It reads raw images using Dave Coffins raw conversion u

manpages/pvscan.8.html
pvscan(8) - scan all disks for physical volumes (Man Page)
pvscan scans all supported LVM block devices in the system for physical volumes. OPTIONS See lvm(8) for common options. -e, --exported Only show physical volume

manpages/XConfigureWindow.3.html
XConfigureWindow(3) - configure windows and window changes s
XConfigureWindow.3 - The XConfigureWindow function uses the values specified in the XWindowChanges structure to reconfigure a windows size, position, border, an

manpages/Unicode::Collate::CJK::JISX0208.3pm.html
Unicode::Collate::CJK::JISX0208(3pm) - weighting JIS KANJI f
Unicode::Collate::CJK::JISX0208 provides weightJISX0208(), that is adequate for overrideCJK of Unicode::Collate and makes tailoring of 6355 kanji ( CJK Unified

manpages/XSupportsLocale.3.html
XSupportsLocale(3) - determine locale support and configure
The XSupportsLocale function returns True if Xlib functions are capable of operating under the current locale. If it returns False, Xlib locale-dependent functi

manpages/raw_sp.3ncurses.html
raw_sp(3ncurses) - curses screen-pointer extension (ManPage)
This implementation can be configured to provide a set of functions which improve the ability to manage multiple screens. This feature can be added to any of th

manpages/menu_term.3menu.html
menu_term(3menu) - set hooks for automatic invocation by app
These functions make it possible to set hook functions to be called at various points in the automatic processing of input event codes by menu_driver. The funct

manpages/gnutls_dtls_get_mtu.3.html
gnutls_dtls_get_mtu(3) - API function - Linux manual page...
This function will return the MTU size as set with gnutls_dtls_set_mtu(). This is not the actual MTU of data you can transmit. Use gnutls_dtls_get_data_mtu() fo

manpages/Ttk_PlaceBox.3.html
Ttk_PlaceBox(3) - Tk themed geometry utilities (Man Page)...
The Ttk_Box structure represents a rectangular region of a window: typedef struct { int x; int y; int width; int height; } Ttk_Box; All coordinates are relative

manpages/lrand48_r.3.html
lrand48_r(3) - generate uniformly distributed pseudo-random
These functions are the reentrant analogs of the functions described in drand48(3). Instead of modifying the global random generator state, they use the supplie





We can't live, work or learn in freedom unless the software we use is free.