1 /* $XConsortium: t1test.c /main/4 1996/09/28 16:47:53 rws $ */
2 /* Copyright International Business Machines,Corp. 1991
5 * License to use, copy, modify, and distribute this software
6 * and its documentation for any purpose and without fee is
7 * hereby granted, provided that the above copyright notice
8 * appear in all copies and that both that copyright notice and
9 * this permission notice appear in supporting documentation,
10 * and that the name of IBM not be used in advertising or
11 * publicity pertaining to distribution of the software without
12 * specific, written prior permission.
14 * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
15 * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
16 * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
18 * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
19 * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
20 * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
21 * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
22 * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
23 * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
24 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
25 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
26 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
27 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
36 #define DECIPOINTSPERINCH 722.7
38 #define DEFAULTPOINTSIZE 120
52 CharInfoRec *glyphs[1];
58 Type1RegisterFontFileFunctions();
59 entry.name.name = "-adobe-utopia-medium-r-normal--0-0-0-0-p-0-iso8859-1";
69 if (1 != sscanf(&temp[2], "%c", glyphcode))
70 printf("glyph code?\n");
74 if (1 != sscanf(&temp[2], "%x", &code))
75 printf("glyph code?\n");
81 if (1 != sscanf(&temp[2], "%d", &code))
82 printf("glyph code?\n");
88 if (1 != sscanf(&temp[2], "%d", &h))
91 rc = Type1OpenScalable(NULL, &fontptr, 0, &entry, file, &vals, 0, 0);
95 if (1 != sscanf(&temp[2], "%s", file))
96 printf("file name?\n");
97 rc = Type1OpenScalable(NULL, &fontptr, 0, &entry, file, &vals, 0, 0);
101 if (1 != sscanf(&temp[2], "%s", file))
102 printf("file name?\n");
104 rc = Type1OpenScalable(NULL, &fontptr, 0, &entry, file, &vals, 0, 0);
105 if (rc != Successful) break;
107 rc = Type1OpenScalable(NULL, &fontptr, 0, &entry, file, &vals, 0, 0);
108 if (rc != Successful) break;
110 rc = Type1OpenScalable(NULL, &fontptr, 0, &entry, file, &vals, 0, 0);
112 printf("From font '%s':\n", file);
119 printf("unknown command '%c', must one of 'qfchdxt'\n", temp[0]);
122 if (rc == Successful) {
123 if (glyphcode[0] != '\0') {
124 (*fontptr->get_glyphs)(fontptr, 1, glyphcode, 0, &count, glyphs);
128 printf("Code %x not valid in this font\n", glyphcode[0]);
132 printf("Bad font (rc = %d, file='%s')\n", rc, file);
136 static void Display(glyph)
146 printf("Metrics: left=%d, right=%d, w=%d, above=%d, below=%d\n",
147 glyph->metrics.leftSideBearing,
148 glyph->metrics.rightSideBearing,
149 glyph->metrics.characterWidth,
150 glyph->metrics.ascent,
151 glyph->metrics.descent);
153 for (h=glyph->metrics.ascent + glyph->metrics.descent; --h >= 0;) {
154 w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing;
157 for (i=0; i<8; i++) {
172 FontScalablePtr vals;
174 FontResolutionPtr res;
175 int x_res = DEFAULTRES;
176 int y_res = DEFAULTRES;
177 int pointsize = DEFAULTPOINTSIZE; /* decipoints */
180 /* Must have x, y, and pixel */
181 if (!vals->x || !vals->y || !vals->pixel) {
182 res = GetClientResolutions(&num_res);
184 if (res->x_resolution)
185 x_res = res->x_resolution;
186 if (res->y_resolution)
187 y_res = res->y_resolution;
189 pointsize = res->point_size;
196 if (!vals->pixel) vals->point = pointsize;
197 else vals->point = (vals->pixel * DECIPOINTSPERINCH) / vals->y;
200 vals->pixel = (vals->point * vals->y) / DECIPOINTSPERINCH;
201 /* Make sure above arithmetic is normally in range and will
202 round properly. +++ */
206 int CheckFSFormat(format, fmask, bit, byte, scan, glyph, image)
207 int format,fmask,*bit,*byte,*scan,*glyph,*image;
210 *glyph = *scan = *image = 1;
222 FontResolutionPtr GetClientResolutions(resP)
231 extern char *malloc();
232 return(malloc(size));
240 FontDefaultFormat() { ; }
242 FontFileRegisterRenderer() { ; }
244 GenericGetBitmaps() { ; }
245 GenericGetExtents() { ; }
247 FontParseXLFDName() { ; }
248 FontComputeInfoAccelerators() { ; }