123a0898aSmrg/* 223a0898aSmrg 323a0898aSmrgCopyright 1990, 1998 The Open Group 423a0898aSmrg 523a0898aSmrgPermission to use, copy, modify, distribute, and sell this software and its 623a0898aSmrgdocumentation for any purpose is hereby granted without fee, provided that 723a0898aSmrgthe above copyright notice appear in all copies and that both that 823a0898aSmrgcopyright notice and this permission notice appear in supporting 923a0898aSmrgdocumentation. 1023a0898aSmrg 1123a0898aSmrgThe above copyright notice and this permission notice shall be included 1223a0898aSmrgin all copies or substantial portions of the Software. 1323a0898aSmrg 1423a0898aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1523a0898aSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1623a0898aSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 1723a0898aSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 1823a0898aSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1923a0898aSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2023a0898aSmrgOTHER DEALINGS IN THE SOFTWARE. 2123a0898aSmrg 2223a0898aSmrgExcept as contained in this notice, the name of The Open Group shall 2323a0898aSmrgnot be used in advertising or otherwise to promote the sale, use or 2423a0898aSmrgother dealings in this Software without prior written authorization 2523a0898aSmrgfrom The Open Group. 2623a0898aSmrg 2723a0898aSmrg*/ 2823a0898aSmrg 2923a0898aSmrg/* 3023a0898aSmrg * Author: Keith Packard, MIT X Consortium 3123a0898aSmrg */ 3223a0898aSmrg 3323a0898aSmrg#ifdef HAVE_CONFIG_H 3423a0898aSmrg#include <config.h> 3523a0898aSmrg#endif 3623a0898aSmrg#include <X11/fonts/fontmisc.h> 3723a0898aSmrg#include <X11/fonts/fontstruct.h> 3823a0898aSmrg#include <X11/fonts/fontutil.h> 3923a0898aSmrg 4023a0898aSmrgvoid 4123a0898aSmrgFontComputeInfoAccelerators(FontInfoPtr pFontInfo) 4223a0898aSmrg{ 4323a0898aSmrg pFontInfo->noOverlap = FALSE; 4423a0898aSmrg if (pFontInfo->maxOverlap <= pFontInfo->minbounds.leftSideBearing) 4523a0898aSmrg pFontInfo->noOverlap = TRUE; 4623a0898aSmrg 4723a0898aSmrg if ((pFontInfo->minbounds.ascent == pFontInfo->maxbounds.ascent) && 4823a0898aSmrg (pFontInfo->minbounds.descent == pFontInfo->maxbounds.descent) && 4923a0898aSmrg (pFontInfo->minbounds.leftSideBearing == 5023a0898aSmrg pFontInfo->maxbounds.leftSideBearing) && 5123a0898aSmrg (pFontInfo->minbounds.rightSideBearing == 5223a0898aSmrg pFontInfo->maxbounds.rightSideBearing) && 5323a0898aSmrg (pFontInfo->minbounds.characterWidth == 5423a0898aSmrg pFontInfo->maxbounds.characterWidth) && 5523a0898aSmrg (pFontInfo->minbounds.attributes == pFontInfo->maxbounds.attributes)) { 5623a0898aSmrg pFontInfo->constantMetrics = TRUE; 5723a0898aSmrg if ((pFontInfo->maxbounds.leftSideBearing == 0) && 5823a0898aSmrg (pFontInfo->maxbounds.rightSideBearing == 5923a0898aSmrg pFontInfo->maxbounds.characterWidth) && 6023a0898aSmrg (pFontInfo->maxbounds.ascent == pFontInfo->fontAscent) && 6123a0898aSmrg (pFontInfo->maxbounds.descent == pFontInfo->fontDescent)) 6223a0898aSmrg pFontInfo->terminalFont = TRUE; 6323a0898aSmrg else 6423a0898aSmrg pFontInfo->terminalFont = FALSE; 6523a0898aSmrg } else { 6623a0898aSmrg pFontInfo->constantMetrics = FALSE; 6723a0898aSmrg pFontInfo->terminalFont = FALSE; 6823a0898aSmrg } 6923a0898aSmrg if (pFontInfo->minbounds.characterWidth == pFontInfo->maxbounds.characterWidth) 7023a0898aSmrg pFontInfo->constantWidth = TRUE; 7123a0898aSmrg else 7223a0898aSmrg pFontInfo->constantWidth = FALSE; 7323a0898aSmrg 7423a0898aSmrg if ((pFontInfo->minbounds.leftSideBearing >= 0) && 7523a0898aSmrg (pFontInfo->maxOverlap <= 0) && 7623a0898aSmrg (pFontInfo->minbounds.ascent >= -pFontInfo->fontDescent) && 7723a0898aSmrg (pFontInfo->maxbounds.ascent <= pFontInfo->fontAscent) && 7823a0898aSmrg (-pFontInfo->minbounds.descent <= pFontInfo->fontAscent) && 7923a0898aSmrg (pFontInfo->maxbounds.descent <= pFontInfo->fontDescent)) 8023a0898aSmrg pFontInfo->inkInside = TRUE; 8123a0898aSmrg else 8223a0898aSmrg pFontInfo->inkInside = FALSE; 8323a0898aSmrg} 8423a0898aSmrg 8541c30155Smrgint 8623a0898aSmrgFontCouldBeTerminal(FontInfoPtr pFontInfo) 8723a0898aSmrg{ 8823a0898aSmrg if ((pFontInfo->minbounds.leftSideBearing >= 0) && 8923a0898aSmrg (pFontInfo->maxbounds.rightSideBearing <= pFontInfo->maxbounds.characterWidth) && 9023a0898aSmrg (pFontInfo->minbounds.characterWidth == pFontInfo->maxbounds.characterWidth) && 9123a0898aSmrg (pFontInfo->maxbounds.ascent <= pFontInfo->fontAscent) && 9223a0898aSmrg (pFontInfo->maxbounds.descent <= pFontInfo->fontDescent) && 9323a0898aSmrg (pFontInfo->maxbounds.leftSideBearing != 0 || 9423a0898aSmrg pFontInfo->minbounds.rightSideBearing != pFontInfo->minbounds.characterWidth || 9523a0898aSmrg pFontInfo->minbounds.ascent != pFontInfo->fontAscent || 9623a0898aSmrg pFontInfo->minbounds.descent != pFontInfo->fontDescent)) { 9723a0898aSmrg /* blow off font with nothing but a SPACE */ 9841c30155Smrg if (pFontInfo->maxbounds.ascent == 0 && 9923a0898aSmrg pFontInfo->maxbounds.descent == 0) 10023a0898aSmrg return FALSE; 10123a0898aSmrg return TRUE; 10223a0898aSmrg } 10323a0898aSmrg return FALSE; 10423a0898aSmrg} 105