Annotation of researchv9/X11/src/X.V11R1/server/ddx/mi/mipolytext.c, revision 1.1.1.1

1.1       root        1: /*******************************************************************
                      2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
                      3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
                      4: 
                      5:                         All Rights Reserved
                      6: 
                      7: Permission to use, copy, modify, and distribute this software and its 
                      8: documentation for any purpose and without fee is hereby granted, 
                      9: provided that the above copyright notice appear in all copies and that
                     10: both that copyright notice and this permission notice appear in 
                     11: supporting documentation, and that the names of Digital or MIT not be
                     12: used in advertising or publicity pertaining to distribution of the
                     13: software without specific, written prior permission.  
                     14: 
                     15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     21: SOFTWARE.
                     22: 
                     23: ************************************************************************/
                     24: /* $Header: mipolytext.c,v 1.11 87/09/11 07:20:25 toddb Exp $ */
                     25: /*
                     26:  * mipolytext.c - text routines
                     27:  *
                     28:  * Author:     haynes
                     29:  *             Digital Equipment Corporation
                     30:  *             Western Software Laboratory
                     31:  * Date:       Thu Feb  5 1987
                     32:  */
                     33: 
                     34: #include       "X.h"
                     35: #include       "Xmd.h"
                     36: #include       "Xproto.h"
                     37: #include       "fontstruct.h"
                     38: #include       "dixfontstr.h"
                     39: #include       "gcstruct.h"
                     40: 
                     41: static unsigned int
                     42: miWidth(n, charinfo)
                     43:     CharInfoPtr charinfo[];
                     44:     unsigned int n;
                     45: {
                     46:     unsigned int i;
                     47:     unsigned int w = 0;
                     48: 
                     49:     for (i=0; i < n; i++) w += charinfo[i]->metrics.characterWidth;
                     50: 
                     51:     return w;
                     52: }
                     53: 
                     54: 
                     55: static int
                     56: miPolyText(pDraw, pGC, x, y, count, chars, fontEncoding)
                     57:     DrawablePtr pDraw;
                     58:     GCPtr      pGC;
                     59:     int                x, y;
                     60:     int                count;
                     61:     char       *chars;
                     62:     FontEncoding fontEncoding;
                     63: {
                     64:     CharInfoPtr *charinfo;
                     65:     unsigned int n, w;
                     66: 
                     67:     if(!(charinfo = (CharInfoPtr *)ALLOCATE_LOCAL(count*sizeof(CharInfoPtr ))))
                     68:        return x ;
                     69:     GetGlyphs(pGC->font, count, chars, fontEncoding, &n, charinfo);
                     70:     w = miWidth(n, charinfo);
                     71:     if (n != 0)
                     72:         (*pGC->PolyGlyphBlt)(
                     73:            pDraw, pGC, x, y, n, charinfo, pGC->font->pGlyphs);
                     74: 
                     75:     DEALLOCATE_LOCAL(charinfo);
                     76:     return x+w;
                     77: }
                     78: 
                     79: 
                     80: int
                     81: miPolyText8(pDraw, pGC, x, y, count, chars)
                     82:     DrawablePtr pDraw;
                     83:     GCPtr      pGC;
                     84:     int                x, y;
                     85:     int        count;
                     86:     char       *chars;
                     87: {
                     88:     return miPolyText(pDraw, pGC, x, y, count, chars, Linear8Bit);
                     89: }
                     90: 
                     91: 
                     92: int
                     93: miPolyText16(pDraw, pGC, x, y, count, chars)
                     94:     DrawablePtr pDraw;
                     95:     GCPtr      pGC;
                     96:     int                x, y;
                     97:     int                count;
                     98:     unsigned short *chars;
                     99: {
                    100:     if (pGC->font->pFI->lastRow == 0)
                    101:        return miPolyText(pDraw, pGC, x, y, count, (char *)chars, Linear16Bit);
                    102:     else
                    103:        return miPolyText(pDraw, pGC, x, y, count, (char *)chars, TwoD16Bit);
                    104: }
                    105: 
                    106: 
                    107: static int
                    108: miImageText(pDraw, pGC, x, y, count, chars, fontEncoding)
                    109:     DrawablePtr pDraw;
                    110:     GCPtr      pGC;
                    111:     int        x, y;
                    112:     int        count;
                    113:     char       *chars;
                    114:     FontEncoding fontEncoding;
                    115: {
                    116:     CharInfoPtr *charinfo;
                    117:     unsigned int n;
                    118:     FontPtr font = pGC->font;
                    119:     unsigned int w;
                    120: 
                    121:     if(!(charinfo = (CharInfoPtr *)ALLOCATE_LOCAL(count*sizeof(CharInfoPtr))))
                    122:        return x;
                    123:     GetGlyphs(font, count, chars, fontEncoding, &n, charinfo);
                    124:     w = miWidth(n, charinfo);
                    125:     if (n !=0 )
                    126:         (*pGC->ImageGlyphBlt)(pDraw, pGC, x, y, n, charinfo, font->pGlyphs);
                    127:     DEALLOCATE_LOCAL(charinfo);
                    128:     return x+w;
                    129: }
                    130: 
                    131: 
                    132: void
                    133: miImageText8(pDraw, pGC, x, y, count, chars)
                    134:     DrawablePtr pDraw;
                    135:     GCPtr      pGC;
                    136:     int                x, y;
                    137:     int                count;
                    138:     char       *chars;
                    139: {
                    140:     miImageText(pDraw, pGC, x, y, count, chars, Linear8Bit);
                    141: }
                    142: 
                    143: 
                    144: void
                    145: miImageText16(pDraw, pGC, x, y, count, chars)
                    146:     DrawablePtr pDraw;
                    147:     GCPtr      pGC;
                    148:     int                x, y;
                    149:     int                count;
                    150:     unsigned short *chars;
                    151: {
                    152:     if (pGC->font->pFI->lastRow == 0)
                    153:        miImageText(pDraw, pGC, x, y, count, (char *)chars, Linear16Bit);
                    154:     else
                    155:        miImageText(pDraw, pGC, x, y, count, (char *)chars, TwoD16Bit);
                    156: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.