pcf.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*
  2. * CDDL HEADER START
  3. *
  4. * The contents of this file are subject to the terms of the
  5. * Common Development and Distribution License (the "License").
  6. * You may not use this file except in compliance with the License.
  7. *
  8. * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
  9. * or http://www.opensolaris.org/os/licensing.
  10. * See the License for the specific language governing permissions
  11. * and limitations under the License.
  12. *
  13. * When distributing Covered Code, include this CDDL HEADER in each
  14. * file and include the License file at src/OPENSOLARIS.LICENSE.
  15. * If applicable, add the following below this CDDL HEADER, with the
  16. * fields enclosed by brackets "[]" replaced with your own identifying
  17. * information: Portions Copyright [yyyy] [name of copyright owner]
  18. *
  19. * CDDL HEADER END
  20. */
  21. /*
  22. * Copyright (c) 1999 by Sun Microsystems, Inc.
  23. * All rights reserved.
  24. */
  25. /*
  26. * Copyright (C) 1994 X Consortium
  27. *
  28. * Permission is hereby granted, free of charge, to any person obtaining a copy
  29. * of this software and associated documentation files (the "Software"), to
  30. * deal in the Software without restriction, including without limitation the
  31. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  32. * sell copies of the Software, and to permit persons to whom the Software is
  33. * furnished to do so, subject to the following conditions:
  34. *
  35. * The above copyright notice and this permission notice shall be included in
  36. * all copies or substantial portions of the Software.
  37. *
  38. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  39. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41. * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  42. * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
  43. * TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  44. *
  45. * Except as contained in this notice, the name of the X Consortium shall not
  46. * be used in advertising or otherwise to promote the sale, use or other deal-
  47. * ings in this Software without prior written authorization from the X Consor-
  48. * tium.
  49. *
  50. * X Window System is a trademark of X Consortium, Inc.
  51. */
  52. #ifndef _PCF_H
  53. #define _PCF_H
  54. /*#include "Xproto.h" */
  55. #include "general_header.h"
  56. #define XU_IGNORE -2
  57. #define XU_UCS4UNDEF -4
  58. #define XU_MOTION_CHAR 1
  59. #define XU_PSBM_CACHED 2
  60. #define XU_PSBM_NOTCACHED 3
  61. #define NOBITMAPREPL 0xfffd /* specific to cu12.pcf.gz "-mutt-clearlyu-medium-r-normal--17-120-100-100-p-123-iso10646-1" */
  62. #define FALLBACK_FONT "cu12.pcf"
  63. #define PPI (72) /* Postscript Points Per Inch */
  64. #define DEF_XRES PPI /* default X resolution (72 dpi) */
  65. #define DEF_YRES PPI /* default Y resolution (72 dpi) */
  66. #define START_NEW_PAGE -200.0
  67. typedef unsigned char pcf_bm_t;
  68. #ifdef WORD64
  69. typedef long INT64;
  70. typedef unsigned long CARD64;
  71. #define B32 :32
  72. #define B16 :16
  73. #ifdef UNSIGNEDBITFIELDS
  74. typedef unsigned int INT32;
  75. typedef unsigned int INT16;
  76. #else
  77. #ifdef __STDC__
  78. typedef signed int INT32;
  79. typedef signed int INT16;
  80. #else
  81. typedef int INT32;
  82. typedef int INT16;
  83. #endif
  84. #endif
  85. #else
  86. #define B32
  87. #define B16
  88. #ifdef LONG64
  89. typedef long INT64;
  90. typedef int INT32;
  91. #else
  92. typedef long INT32;
  93. #endif
  94. typedef short INT16;
  95. #endif
  96. #if defined(__STDC__) || defined(sgi) || defined(AIXV3)
  97. typedef signed char INT8;
  98. #else
  99. typedef char INT8;
  100. #endif
  101. #ifdef LONG64
  102. typedef unsigned long CARD64;
  103. typedef unsigned int CARD32;
  104. #else
  105. typedef unsigned long CARD32;
  106. #endif
  107. typedef unsigned short CARD16;
  108. typedef unsigned char CARD8;
  109. typedef CARD32 BITS32;
  110. typedef CARD16 BITS16;
  111. #ifndef I_NEED_OS2_H
  112. typedef CARD8 BYTE;
  113. typedef CARD8 BOOL;
  114. #else
  115. #define BYTE CARD8
  116. #define BOOL CARD8
  117. #endif
  118. #define bzero(b,n) (memset((b),0,(n)))
  119. typedef struct {
  120. INT16 leftSideBearing B16,
  121. rightSideBearing B16,
  122. characterWidth B16,
  123. ascent B16,
  124. descent B16;
  125. CARD16 attributes B16;
  126. } xCharInfo;
  127. typedef struct _CharInfo {
  128. xCharInfo metrics; /* info preformatted for Queries */
  129. char *bits; /* pointer to glyph image */
  130. }CharInfoRec;
  131. struct scaled_fontmetric {
  132. double ascent;
  133. double descent;
  134. double linespace;
  135. };
  136. struct fontmetric {
  137. int ptsz;
  138. int Xres;
  139. int Yres;
  140. int ascent;
  141. int descent;
  142. int linespace;
  143. int firstchar;
  144. int firstCol;
  145. int lastCol;
  146. int lastchar;
  147. };
  148. struct font_header {
  149. int ptsz;
  150. int Xres;
  151. int Yres;
  152. int ascent;
  153. int descent;
  154. int linespace;
  155. int firstchar;
  156. int firstCol;
  157. int lastCol;
  158. int lastchar;
  159. };
  160. struct charmetric {
  161. int width;
  162. int height;
  163. int widthBits;
  164. int widthBytes;
  165. int ascent;
  166. int descent;
  167. int LSBearing;
  168. int RSBearing;
  169. int origin_xoff;
  170. };
  171. struct scaled_charmetric {
  172. double width;
  173. double height;
  174. double widthBits;
  175. double ascent;
  176. double descent;
  177. double origin_xoff;
  178. };
  179. typedef struct fontmetric pcf_fontmet_t;
  180. typedef struct charmetric pcf_charmet_t;
  181. typedef struct scaled_fontmetric pcf_SCfontmet_t;
  182. typedef struct scaled_charmetric pcf_SCcharmet_t;
  183. typedef struct _CharInfo *CharInfoPtr;
  184. typedef struct font_header pcf_font_header;
  185. struct pcffont{
  186. char *name;
  187. char *file;
  188. char *cufsym;
  189. char *cufobj;
  190. int (*cuf)(ucs4_t);
  191. int loaded;
  192. double Xscale;
  193. double Yscale;
  194. pcf_fontmet_t Fmetrics;
  195. pcf_SCfontmet_t scFmetrics;
  196. CharInfoPtr *bitmaps; /* ...array of CharInfoPtr */
  197. };
  198. typedef struct pcffont pcffont_t;
  199. /*extern void scaling_factors(pcffont_t *, double , int , int );*/
  200. typedef enum {
  201. Linear8Bit, TwoD8Bit, Linear16Bit, TwoD16Bit
  202. } FontEncoding;
  203. int load_pcf(pcffont_t *font);
  204. pcf_SCcharmet_t *get_SCmetrics(pcffont_t *font, ucs4_t val);
  205. int pres_pcfbm(ucs4_t *, pcffont_t *, pcf_bm_t **, pcf_charmet_t *, pcf_SCcharmet_t *, int);
  206. void put_PSbitmap(ucs4_t code, pcf_bm_t *bitmap, pcf_charmet_t *Cmetrics, pcf_SCcharmet_t *Smetrics);
  207. void draw_bitmap(int line_ascent, int line_descent, int line_space, pcf_bm_t *bitmap, pcf_charmet_t *Cmetrics);
  208. #endif /* _PCF_H */