home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / doc / GetFontStr.3 < prev    next >
Encoding:
Text File  |  1993-04-01  |  3.7 KB  |  93 lines

  1. '\"
  2. '\" Copyright (c) 1990-1992 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/wish/man/RCS/GetFontStr.3,v 1.6 93/04/01 09:41:27 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS Tk_GetFontStruct tkc
  25. .BS
  26. .SH NAME
  27. Tk_GetFontStruct, Tk_NameOfFontStruct, Tk_FreeFontStruct \- maintain database of fonts
  28. .SH SYNOPSIS
  29. .nf
  30. \fB#include <tk.h>\fR
  31. .sp
  32. XFontStruct *
  33. \fBTk_GetFontStruct(\fIinterp, tkwin, nameId\fB)\fR
  34. .sp
  35. char *
  36. \fBTk_NameOfFontStruct(\fIfontStructPtr\fB)\fR
  37. .sp
  38. \fBTk_FreeFontStruct(\fIfontStructPtr\fB)\fR
  39. .SH ARGUMENTS
  40. .AS "XFontStruct" *fontStructPtr
  41. .AP Tcl_Interp *interp in
  42. Interpreter to use for error reporting.
  43. .AP Tk_Window tkwin in
  44. Token for window in which font will be used.
  45. .AP Tk_Uid nameId in
  46. Name of desired font.
  47. .AP XFontStruct *fontStructPtr in
  48. Font structure to return name for or delete.
  49. .BE
  50.  
  51. .SH DESCRIPTION
  52. .PP
  53. \fBTk_GetFont\fR loads the font indicated
  54. by \fInameId\fR and returns a pointer to information about the
  55. font.  The pointer returned by \fBTk_GetFont\fR
  56. will remain valid until \fBTk_FreeFont\fR
  57. is called to release it.
  58. \fINameId\fR can be either a font name or pattern;  any
  59. value that could be passed to \fBXLoadQueryFont\fR may be
  60. passed to \fBTk_GetFont\fR.  If \fBTk_GetFont\fR is unsuccessful
  61. (because, for example, there is no font corresponding to
  62. \fInameId\fR) then it returns \fBNULL\fR and stores an error
  63. message in \fIinterp->result\fR.
  64. .PP
  65. \fBTk_GetFont\fR maintains a database of all fonts it has allocated.
  66. If the same \fInameId\fR is requested multiple times (e.g. by
  67. different windows or for different purposes), then additional
  68. calls for the same \fInameId\fR will be handled very quickly, without
  69. involving the X server.  For this reason, it is generally better
  70. to use \fBTk_GetFont\fR in place of X library procedures like
  71. \fBXLoadQueryFont\fR.
  72. .PP
  73. The procedure \fBTk_NameOfFontStruct\fR is roughly the inverse of
  74. \fBTk_GetFontStruct\fR.  If its \fIfontStructPtr\fR argument was created
  75. by \fBTk_GetFontStruct\fR, then the return value is the \fInameId\fR
  76. argument that was passed to \fBTk_GetFontStruct\fR to create the
  77. font.  If \fIfontStructPtr\fR was not created by a call
  78. to \fBTk_GetFontStruct\fR, then the return value is a hexadecimal string
  79. giving the X identifier for the associated font.
  80. Note:  the string returned by \fBTk_NameOfFontStruct\fR is
  81. only guaranteed to persist until the next call to \fBTk_NameOfFontStruct\fR.
  82. .PP
  83. When a font returned by \fBTk_GetFont\fR is no longer
  84. needed, \fBTk_FreeFont\fR should be called to release it.
  85. There should be exactly one call to \fBTk_FreeFont\fR for
  86. each call to \fBTk_GetFont\fR.  When a font is no longer in
  87. use anywhere (i.e. it has been freed as many times as it has been gotten)
  88. \fBTk_FreeFont\fR will release it to the X server and delete it from
  89. the database.
  90.  
  91. .SH KEYWORDS
  92. font
  93.