|
|
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: mfbfont.c,v 1.14 87/09/03 13:50:48 toddb Exp $ */ ! 25: #include "X.h" ! 26: #include "Xmd.h" ! 27: #include "Xproto.h" ! 28: #include "fontstruct.h" ! 29: #include "dixfontstr.h" ! 30: #include "scrnintstr.h" ! 31: ! 32: #include "mfb.h" ! 33: ! 34: /* ! 35: * Take advantage of the per-screen private information field in the font to ! 36: * encode the results of fairly complex tests of the font's metric fields. ! 37: * ValidateFont need merely examine the code to select the output routines to ! 38: * be pointed to in the GC. ! 39: */ ! 40: Bool ! 41: mfbRealizeFont( pscr, pFont) ! 42: ScreenPtr pscr; ! 43: FontPtr pFont; ! 44: { ! 45: /* ! 46: * pGC->font is now known to be valid ! 47: */ ! 48: int index = pscr->myNum; ! 49: FontInfoPtr pfi = pFont->pFI; ! 50: CharInfoPtr maxb = &pfi->maxbounds; ! 51: CharInfoPtr minb = &pfi->minbounds; ! 52: ! 53: /* ! 54: * pick the fastest output routines that can do the job. ! 55: */ ! 56: if ( maxb->metrics.rightSideBearing - ! 57: minb->metrics.leftSideBearing > 32 /* big glyphs */ ! 58: || pfi->drawDirection != FontLeftToRight ! 59: || pfi->noOverlap == 0) ! 60: pFont->devPriv[ index] = (pointer)FT_VARPITCH; ! 61: else /* an optimizable case */ ! 62: { ! 63: if ( maxb->metrics.leftSideBearing == ! 64: minb->metrics.leftSideBearing /* fixed pitch */ ! 65: && maxb->metrics.leftSideBearing == 0 /* fixed pitch */ ! 66: && maxb->metrics.rightSideBearing == ! 67: minb->metrics.rightSideBearing /* fixed pitch */ ! 68: && maxb->metrics.characterWidth == ! 69: minb->metrics.characterWidth /* fixed pitch */ ! 70: && maxb->metrics.ascent == ! 71: minb->metrics.ascent /* fixed height */ ! 72: && maxb->metrics.descent == ! 73: minb->metrics.descent) /* fixed height */ ! 74: pFont->devPriv[ index] = (pointer)FT_FIXPITCH; ! 75: else ! 76: pFont->devPriv[ index] = (pointer)FT_SMALLPITCH; ! 77: } ! 78: return (TRUE); ! 79: } ! 80: ! 81: /* ! 82: * no storage allocated in mfbRealizeFont, so there is nothing to do ! 83: */ ! 84: Bool ! 85: mfbUnrealizeFont( pscr, pFont) ! 86: ScreenPtr pscr; ! 87: FontPtr pFont; ! 88: { ! 89: return (TRUE); ! 90: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.