⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t1info.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 2 页
字号:
/* $TOG: t1info.c /main/20 1997/06/09 11:21:53 barstow $ *//* Copyright International Business Machines,Corp. 1991 * All Rights Reserved * * License, subject to the license given below, to use, * copy, modify, and distribute this software * and its * documentation for any purpose and without fee is hereby * granted, provided that the above copyright notice appear * in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, * and that the name of IBM not be used in advertising or * publicity pertaining to distribution of the software * without specific, written prior permission. * * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF * THIRD PARTY RIGHTS.  THE ENTIRE RISK AS TO THE QUALITY AND * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT * OR MAINTAIN, BELONGS TO THE LICENSEE.  SHOULD ANY PORTION OF * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION.  IN * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. * * Author: Carol H. Thompson  IBM Almaden Research Center *   Modeled on spinfo.c by Dave Lemke, Network Computing Devices, Inc *   which contains the following copyright and permission notices: * * Copyright 1990, 1991 Network Computing Devices; * Portions Copyright 1987 by Digital Equipment Corporation * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the names of Network Computing Devices or Digital  * not be used in advertising or publicity pertaining to distribution of the  * software without specific, written prior permission. Network Computing  * Devices and Digital make no representations about the suitability of this  * software for any purpose.  It is provided "as is" without express or  * implied warranty. * * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES OR DIGITAL BE * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *//*Copyright (c) 1987  X ConsortiumPermission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the"Software"), to deal in the Software without restriction, includingwithout limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and topermit persons to whom the Software is furnished to do so, subject tothe following conditions:The above copyright notice and this permission notice shall be includedin all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OROTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OROTHER DEALINGS IN THE SOFTWARE.Except as contained in this notice, the name of the X Consortium shallnot be used in advertising or otherwise to promote the sale, use orother dealings in this Software without prior written authorizationfrom the X Consortium.*/#include <stdio.h> #include "fntfilst.h"#include "FSproto.h"#include "t1intf.h"#include <math.h> #define DECIPOINTSPERINCH 722.7#define DEFAULTRES 75#define DEFAULTPOINTSIZE 120 enum scaleType {    atom, truncate_atom, pixel_size, point_size, resolution_x,    resolution_y, average_width}; typedef struct _fontProp {    char       *name;    long        atom;    enum scaleType type;}           fontProp; static fontProp fontNamePropTable[] = {  /* Example: */    "FOUNDRY", 0, atom,                  /* adobe */    "FAMILY_NAME", 0, atom,              /* times roman */    "WEIGHT_NAME", 0, atom,     	 /* bold */    "SLANT", 0, atom,			 /* i */    "SETWIDTH_NAME", 0, atom,            /* normal */    "ADD_STYLE_NAME", 0, atom,		 /* */    "PIXEL_SIZE", 0, pixel_size,         /* 18 */    "POINT_SIZE", 0, point_size,         /* 180 */    "RESOLUTION_X", 0, resolution_x,     /* 72 */    "RESOLUTION_Y", 0, resolution_y,     /* 72 */    "SPACING", 0, atom,                  /* p */    "AVERAGE_WIDTH", 0, average_width,   /* 0 */    "CHARSET_REGISTRY", 0, atom,         /* ISO8859 */    "CHARSET_ENCODING", 0, truncate_atom, /* 1 */}; /* NOTICE: Following array is closely related to the sequence of defines   following it. */static fontProp extraProps[] = {    "FONT", 0, 0,    "COPYRIGHT", 0, 0,    "RAW_PIXEL_SIZE", 0, 0,    "RAW_POINT_SIZE", 0, 0,    "RAW_ASCENT", 0, 0,    "RAW_DESCENT", 0, 0,    "RAW_AVERAGE_WIDTH", 0, 0,    "FACE_NAME", 0, 0,}; /* this is a bit kludgy */#define FONTPROP        0#define COPYRIGHTPROP   1#define RAWPIXELPROP	2#define RAWPOINTPROP	3#define RAWASCENTPROP	4#define RAWDESCENTPROP	5#define RAWWIDTHPROP	6#define FACE_NAMEPROP	7#define NNAMEPROPS (sizeof(fontNamePropTable) / sizeof(fontProp))#define NEXTRAPROPS (sizeof(extraProps) / sizeof(fontProp)) #define NPROPS  (NNAMEPROPS + NEXTRAPROPS) /*ARGSUSED*/static voidFillHeader(pInfo, Vals)    FontInfoPtr         pInfo;    FontScalablePtr     Vals;{    /* OpenScalable in T1FUNCS sets the following:    pInfo->firstCol,    pInfo->firstRow,    pInfo->lastCol, and    pInfo->lastRow. */    /* the following are ununsed    pInfo->pad. */     /* Items we should handle better someday +++ */    pInfo->defaultCh = 0;    pInfo->drawDirection = LeftToRight;    if (Vals->point_matrix[0] == Vals->point_matrix[3])	pInfo->anamorphic = 0;    else	pInfo->anamorphic = 1;    pInfo->inkMetrics = 0;  /* no ink metrics here */    pInfo->cachable = 1;    /* no licensing (yet) */} static voidadjust_min_max(minc, maxc, tmp)    xCharInfo  *minc,               *maxc,               *tmp;{#define MINMAX(field,ci) \        if (minc->field > (ci)->field) \             minc->field = (ci)->field; \        if (maxc->field < (ci)->field) \            maxc->field = (ci)->field;     MINMAX(ascent, tmp);    MINMAX(descent, tmp);    MINMAX(leftSideBearing, tmp);    MINMAX(rightSideBearing, tmp);    MINMAX(characterWidth, tmp);    /* Do MINMAX for attributes field.  Since that field is CARD16,       we'll cast to a signed integer */    if ((INT16)minc->attributes > (INT16)tmp->attributes)         minc->attributes = tmp->attributes;    if ((INT16)maxc->attributes < (INT16)tmp->attributes)        maxc->attributes = tmp->attributes; #undef  MINMAX} static voidComputeBounds(pInfo, pChars, Vals)    FontInfoPtr         pInfo;    CharInfoPtr         pChars;    FontScalablePtr     Vals;{    int i;    xCharInfo minchar, maxchar;    int numchars = 0;    int totchars;    int overlap;    int maxlap;     minchar.ascent = minchar.descent =        minchar.leftSideBearing = minchar.rightSideBearing =        minchar.characterWidth = minchar.attributes = 32767;    maxchar.ascent = maxchar.descent =        maxchar.leftSideBearing = maxchar.rightSideBearing =        maxchar.characterWidth = maxchar.attributes = -32767;     maxlap = -32767;    totchars = pInfo->lastCol - pInfo->firstCol + 1;    pChars += pInfo->firstCol - FIRSTCOL;    pInfo->allExist = 1;    for (i = 0; i < totchars; i++,pChars++) {        xCharInfo *pmetrics = &pChars->metrics;         if (pmetrics->attributes ||	    pmetrics->ascent != -pmetrics->descent ||	    pmetrics->leftSideBearing != pmetrics->rightSideBearing) {            numchars++;            adjust_min_max(&minchar, &maxchar, pmetrics);            overlap = pmetrics->rightSideBearing - pmetrics->characterWidth;            if (overlap > maxlap) maxlap = overlap;        }        else pInfo->allExist = 0;    }    /* If we're monospaced, round the average width field to the       nearest pixel */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -