home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / Xlib_FreeFontInfo.c < prev    next >
C/C++ Source or Header  |  2000-06-15  |  2KB  |  65 lines

  1. #include "Xlib.h"
  2. #include "Xlib_private.h"
  3.  
  4. /*
  5.  
  6. Copyright 1986, 1998  The Open Group
  7.  
  8. All Rights Reserved.
  9.  
  10. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12.  
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  16. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  17. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  18. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19.  
  20. Except as contained in this notice, the name of The Open Group shall not be
  21. used in advertising or otherwise to promote the sale, use or other dealings
  22. in this Software without prior written authorization from The Open Group.
  23.  
  24. */
  25.  
  26.  
  27. /* Arguments
  28.  * 
  29.  *  names        Specifies the list of font names. 
  30.  *  free_info    Specifies the font information. 
  31.  *  actual_count    Specifies the actual number of font names. 
  32.  * 
  33.  * 
  34.  * Description
  35.  * 
  36.  * The XFreeFontInfo() function frees a font structure or an array of font structures, and optionally an array of font names. If
  37.  * NULL is passed for names, no font names are freed. If a font structure for an open font (returned by XLoadQueryFont()) is
  38.  * passed, the structure is freed but the font is not closed; use XUnloadFont() to close the font. 
  39.  */
  40.  
  41. int XFreeFontInfo (char **names, XFontStruct *info, int actualCount)
  42. {
  43.     register int i;
  44.  
  45.     DBUG_ENTER("XFreeFontInfo");
  46.     if (names) {
  47.         Xfree (names[0]-1);
  48.         for (i = 1; i < actualCount; i++) {
  49.             Xfree (names[i]);
  50.         }
  51.         Xfree((char *) names);
  52.     }
  53.     if (info) {
  54.         for (i = 0; i < actualCount; i++) {
  55.             if (info[i].per_char)
  56.                 Xfree ((char *) info[i].per_char);
  57.             if (info[i].properties)
  58.                 Xfree ((char *) info[i].properties);
  59.             }
  60.         Xfree((char *) info);
  61.     }
  62.     DBUG_RETURN(1);
  63. }
  64.  
  65.