home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xibm.zip / apa16 / apa16Text.h < prev    next >
C/C++ Source or Header  |  1991-12-30  |  4KB  |  128 lines

  1. #ifndef APA16_TEXTH
  2. #define    APA16_TEXTH 1
  3. /***********************************************************
  4.         Copyright IBM Corporation 1988
  5.  
  6.                       All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the name of IBM not be
  13. used in advertising or publicity pertaining to distribution of the
  14. software without specific, written prior permission.  
  15.  
  16. IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  18. IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22. SOFTWARE.
  23.  
  24. ******************************************************************/
  25. /* $Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16Text.h,v 5.0 1991/12/30 19:22:35 jfc Exp $ */
  26. /* $Source: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16Text.h,v $ */
  27. /* "@(#)apa16text.h    3.1 88/09/22 09:31:16" */
  28.  
  29. #if !defined(lint) && !defined(LOCORE)  && defined(RCS_HDRS)
  30. static char *rcsidapa16Text = "$Header: /afs/athena.mit.edu/astaff/project/x11r5/src/athena/ibm/apa16/RCS/apa16Text.h,v 5.0 1991/12/30 19:22:35 jfc Exp $";
  31. #endif
  32.  
  33. #define CLIPBYCHAR                            \
  34.     {                                \
  35.     xCharInfo    *metrics;                    \
  36.     int         width;                        \
  37.                                     \
  38.     if (!afChMapped(aFont,*charsOut))                \
  39.         afMap(aFont,count,charsOut,tmpCinfo, aFont->afFont->pGlyphs);\
  40.                                     \
  41.     metrics = &tmpCinfo[0]->metrics;                \
  42.     width = metrics->rightSideBearing- metrics->leftSideBearing;    \
  43.                                     \
  44.     if (afChMapped(aFont,*charsOut))                \
  45.         {                            \
  46.         BoxRec cbox;                        \
  47.                                     \
  48.         cbox.y1 = y-metrics->ascent;                \
  49.         cbox.y2 = y+metrics->descent;                \
  50.                                     \
  51.         /*BEWARE OF FUNNY SYNTAX IN NEXT TWO LINES*/        \
  52.         cbox.x2 = width + /*SIC see next line*/            \
  53.         (cbox.x1 = x+metrics->leftSideBearing);            \
  54.         /* THINK BEFORE CHANGING */                \
  55.                                     \
  56.         switch( (*pGC->pScreen->RectIn)(pRegion,&cbox))        \
  57.             {                        \
  58.             case rgnOUT:                    \
  59.                 break;                    \
  60.             case rgnIN:                    \
  61.                 COPY_RECT(bltCmd,            \
  62.                     cbox.x2, cbox.y2,        \
  63.                     afXoff(aFont,*charsOut),    \
  64.                     afYoff(aFont,*charsOut),    \
  65.                     width,                \
  66.                     metrics->ascent+metrics->descent);\
  67.                 break;                    \
  68.             case rgnPART:                    \
  69.                 {                    \
  70.                 RegionPtr pClipRgn;            \
  71.                                     \
  72.                 pClipRgn = (*pGC->pScreen->RegionCreate)\
  73.                     (&cbox,pRegion->numRects);    \
  74.                 (*pGC->pScreen->Intersect)         \
  75.                     (pClipRgn, pClipRgn, pRegion);    \
  76.                                     \
  77.                 for(pbox = pClipRgn->rects,        \
  78.                     nbox = pClipRgn->numRects;        \
  79.                     nbox>0;                \
  80.                     nbox--, pbox++){            \
  81.                       COPY_RECT(bltCmd,        \
  82.                         pbox->x2, pbox->y2,    \
  83.                         afXoff(aFont,*charsOut)+\
  84.                             pbox->x2-cbox.x2,\
  85.                         afYoff(aFont,*charsOut)+\
  86.                             pbox->y2-cbox.y2,\
  87.                         pbox->x2-pbox->x1,    \
  88.                         pbox->y2-pbox->y1);    \
  89.                 }                    \
  90.                 (*pGC->pScreen->RegionDestroy)(pClipRgn);\
  91.                 }                    \
  92.                 break;                    \
  93.                 }                    \
  94.     }                                \
  95.     x+= metrics->characterWidth;                    \
  96.     count--;                            \
  97.     charsOut++;                            \
  98.     tmpCinfo++;                            \
  99.     }
  100.  
  101. #define CLIPBYSTRING                            \
  102.     {                                \
  103.     xCharInfo    *metrics;                    \
  104.     int         width;                        \
  105.                                     \
  106.     if (!afChMapped(aFont,*charsOut)) {                \
  107.         afMap(aFont,count,charsOut,tmpCinfo,aFont->afFont->pGlyphs);\
  108.     }                                \
  109.     if (afChMapped(aFont,*charsOut)) {                \
  110.         metrics=    &tmpCinfo[0]->metrics;                \
  111.         width=    metrics->rightSideBearing-            \
  112.             metrics->leftSideBearing;            \
  113.                                     \
  114.         COPY_RECT(bltCmd,                        \
  115.         x+metrics->leftSideBearing+width,             \
  116.         y+metrics->descent,                    \
  117.         afXoff(aFont,*charsOut), afYoff(aFont,*charsOut),    \
  118.         width,metrics->ascent+metrics->descent);        \
  119.         x+= metrics->characterWidth;                \
  120.     }                                \
  121.     count--;                            \
  122.     charsOut++;                            \
  123.     tmpCinfo++;                            \
  124. }
  125.  
  126.  
  127. #endif /* ndef APA16_TEXTH */
  128.