src/pcf.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- PCF_FORMAT_MATCH
- PCF_GLYPH_PAD_INDEX
- PCF_GLYPH_PAD
- PCF_SCAN_UNIT_INDEX
- PCF_SCAN_UNIT
- PCF_BYTE_ORDER
- PCF_BIT_ORDER
- PCF_FORMAT_BITS
- PCF_SIZE_TO_INDEX
- PCF_INDEX_TO_SIZE
1 /*
2 * pcf.h - a header file for pcf.c
3 * by Hirotsugu Kakugawa
4 *
5 */
6 /*
7 * Copyright (C) 1996-1998 Hirotsugu Kakugawa.
8 * All rights reserved.
9 *
10 * This file is part of the VFlib Library. This library is free
11 * software; you can redistribute it and/or modify it under the terms of
12 * the GNU Library General Public License as published by the Free
13 * Software Foundation; either version 2 of the License, or (at your
14 * option) any later version. This library is distributed in the hope
15 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
16 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17 * PURPOSE. See the GNU Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23 #ifndef __VFLIB_PCF_H__
24 #define __VFLIB_PCF_H__
25
26 #define FONTCLASS_NAME "pcf"
27
28 #ifndef PCF_DEFAULT_EXTENSIONS
29 # define PCF_DEFAULT_EXTENSIONS ".pcf"
30 #endif
31
32 #define PCF_ENV_FONT_DIR "VFLIB_PCF_FONTS"
33
34
35 typedef char INT1;
36 typedef int INT2;
37 typedef long INT4;
38 typedef long CARD4;
39
40 struct s_pcf_table {
41 CARD4 type;
42 CARD4 format;
43 CARD4 size;
44 CARD4 offset;
45 };
46 typedef struct s_pcf_table *PCF_TABLE;
47
48 #define PCF_MSB_FIRST 0
49 #define PCF_LSB_FIRST 1
50
51 #define PCF_FILE_VERSION 0x70636601 /* `p', `c', `f', 1 */
52 #define PCF_FORMAT_MASK 0xffffff00
53 #define PCF_FORMAT_MATCH(x,y) (((x)&PCF_FORMAT_MASK)==((y)&PCF_FORMAT_MASK))
54
55 #define PCF_DEFAULT_FORMAT 0x00000000
56 #define PCF_INKBOUNDS 0x00000200
57 #define PCF_ACCEL_W_INKBOUNDS 0x00000100
58 #define PCF_COMPRESSED_METRICS 0x00000100
59
60 #define PCF_GLYPH_PAD_MASK (3<<0)
61 #define PCF_BYTE_MASK (1<<2)
62 #define PCF_BIT_MASK (1<<3)
63 #define PCF_SCAN_UNIT_MASK (3<<4)
64 #define PCF_GLYPH_PAD_INDEX(f) ((f) & PCF_GLYPH_PAD_MASK)
65 #define PCF_GLYPH_PAD(f) (1 << PCF_GLYPH_PAD_INDEX(f))
66 #define PCF_SCAN_UNIT_INDEX(f) (((f)&PCF_SCAN_UNIT_MASK) >> 4)
67 #define PCF_SCAN_UNIT(f) (1 << PCF_SCAN_UNIT_INDEX(f))
68
69 #define PCF_BYTE_ORDER(f) (((f)&PCF_BYTE_MASK) ? PCF_MSB_FIRST:PCF_LSB_FIRST)
70 #define PCF_BIT_ORDER(f) (((f)&PCF_BIT_MASK) ? PCF_MSB_FIRST:PCF_LSB_FIRST)
71 #define PCF_FORMAT_BITS(f) ((f) & (PCF_GLYPH_PAD_MASK | PCF_BYTE_MASK \
72 | PCF_BIT_MASK | PCF_SCAN_UNIT_MASK))
73 #define PCF_SIZE_TO_INDEX(s) (((s)==4) ? 2 : (((s)==2) ? 1 : 0))
74 #define PCF_INDEX_TO_SIZE(b) (1<<b)
75
76 #define PCF_PROPERTIES (1<<0)
77 #define PCF_ACCELERATORS (1<<1)
78 #define PCF_METRICS (1<<2)
79 #define PCF_BITMAPS (1<<3)
80 #define PCF_INK_METRICS (1<<4)
81 #define PCF_BDF_ENCODINGS (1<<5)
82 #define PCF_SWIDTHS (1<<6)
83 #define PCF_GLYPH_NAMES (1<<7)
84 #define PCF_BDF_ACCELERATORS (1<<8)
85
86 #define PCF_GLYPHPADOPTIONS 4
87
88
89 struct s_pcf_char {
90 int leftSideBearing;
91 int rightSideBearing;
92 int characterWidth;
93 int ascent;
94 int descent;
95 int attributes;
96 int bbx_width, bbx_height;
97 int off_x, off_y;
98 int mv_x, mv_y;
99 unsigned char *bitmap;
100 int raster;
101 };
102 typedef struct s_pcf_char *PCF_CHAR;
103
104 struct s_pcf {
105 char *path_name;
106 char *uncompress;
107 double point_size;
108 int pixel_size;
109 int size;
110 double dpi_x, dpi_y;
111 double slant;
112 int charset;
113 int firstCol, lastCol, firstRow, lastRow;
114 int defaultCh;
115 int ascent, descent;
116 int fontAscent, fontDescent;
117 int font_bbx_width, font_bbx_height;
118 int font_bbx_xoff, font_bbx_yoff;
119 int nchars;
120 PCF_CHAR char_table;
121 unsigned char*bitmap_block;
122 int nencodings;
123 INT2 *encoding;
124 SEXP_ALIST props;
125 };
126 typedef struct s_pcf *PCF;
127
128 #include "sexp.h"
129
130 #endif /*__VFLIB_PCF_H__*/
131
132 /*EOF*/