home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / ppc / ppcFont.c < prev    next >
C/C++ Source or Header  |  1989-11-07  |  2KB  |  84 lines

  1. /*
  2.  * Copyright IBM Corporation 1987,1988,1989
  3.  *
  4.  * All Rights Reserved
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software and its
  7.  * documentation for any purpose and without fee is hereby granted,
  8.  * provided that the above copyright notice appear in all copies and that 
  9.  * both that copyright notice and this permission notice appear in
  10.  * supporting documentation, and that the name of IBM not be
  11.  * used in advertising or publicity pertaining to distribution of the
  12.  * software without specific, written prior permission.
  13.  *
  14.  * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  15.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  16.  * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  17.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  18.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  19.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  20.  * SOFTWARE.
  21.  *
  22. */
  23. /*
  24.  * ppcFont.c - ppc font related routines
  25.  */
  26.  
  27. #include "X.h"
  28. #include "Xmd.h"
  29. #include "Xproto.h"
  30.  
  31. #include "fontstruct.h"
  32. #include "dixfontstr.h"
  33. #include "scrnintstr.h"
  34.  
  35. #include "ppcCache.h"
  36.  
  37. Bool
  38. ppcRealizeFont( pScreen, pFont )
  39.     ScreenPtr pScreen;
  40.     FontPtr pFont;
  41.     {
  42.     int        index = pScreen->myNum;
  43.     FontInfoPtr    pfi = pFont->pFI;
  44.     CharInfoPtr    minb = &pfi->minbounds;
  45.     ppcBMInfoPtr    *bmtable;
  46.     int        numGlyphs;
  47.  
  48.     ppcCacheInit(pScreen);
  49.  
  50.     if ( ( minb->metrics.descent + minb->metrics.ascent ) > 32 )
  51.         {    /* this font has no cacheable characters */
  52.         return(mfbRealizeFont( pScreen, pFont ));
  53.         }
  54.  
  55.     numGlyphs = ( pfi->lastCol - pfi->firstCol + 1 ) *
  56.             ( pfi->lastRow - pfi->firstRow + 1 );
  57.  
  58.     
  59.     if ( ( bmtable = (ppcBMInfoPtr *)Xalloc(sizeof(ppcBMInfoPtr)*numGlyphs ) ) == NULL )
  60.         {
  61.         return(FALSE);
  62.         }
  63.  
  64.     /* initialize to null */
  65.     bzero(bmtable, sizeof(ppcBMInfoPtr)*numGlyphs);
  66.  
  67.     pFont->devPriv[index] = (pointer)bmtable;
  68.  
  69.     return(TRUE);
  70.     }
  71.  
  72. Bool
  73. ppcUnrealizeFont( pScreen, pFont )
  74.     ScreenPtr pScreen;
  75.     FontPtr pFont;
  76.     {
  77.     int        index = pScreen->myNum;
  78.  
  79.     if ( (int)pFont->devPriv[index] > 20 )
  80.         Xfree(pFont->devPriv[index]);
  81.     return(TRUE);
  82.     }
  83.  
  84.