2
0

bdftosnf.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: bdftosnf.h /main/4 1996/06/25 20:13:29 cde-fuj $ */
  24. /*
  25. * (c) Copyright 1995 FUJITSU LIMITED
  26. * This is source code modified by FUJITSU LIMITED under the Joint
  27. * Development Agreement for the CDEnext PST.
  28. * This is unpublished proprietary source code of FUJITSU LIMITED
  29. */
  30. #include<X11/Xfuncs.h>
  31. #ifndef MIN
  32. #define MIN(a,b) ((a)>(b)?(b):(a))
  33. #endif
  34. #ifndef MAX
  35. #define MAX(a,b) ((a)>(b)?(a):(b))
  36. #endif
  37. typedef struct _GlyphMap {
  38. char *bits;
  39. int h;
  40. int w;
  41. int widthBytes;
  42. } GlyphMap;
  43. /*
  44. * a structure to hold all the pointers to make it easy to pass them all
  45. * around. Much like the FONT structure in the server.
  46. */
  47. typedef struct _TempFont {
  48. FontInfoPtr pFI;
  49. CharInfoPtr pCI;
  50. unsigned char *pGlyphs;
  51. FontPropPtr pFP;
  52. CharInfoPtr pInkCI;
  53. CharInfoPtr pInkMin;
  54. CharInfoPtr pInkMax;
  55. } TempFont; /* not called font since collides with type in X.h */
  56. #ifdef vax
  57. # define DEFAULTGLPAD 1 /* default padding for glyphs */
  58. # define DEFAULTBITORDER LSBFirst /* default bitmap bit order */
  59. # define DEFAULTBYTEORDER LSBFirst /* default bitmap byte order */
  60. # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
  61. #elif defined(sun)
  62. # if (sun386 || sun5)
  63. # define DEFAULTGLPAD 4 /* default padding for glyphs */
  64. # define DEFAULTBITORDER LSBFirst /* default bitmap bit order */
  65. # define DEFAULTBYTEORDER LSBFirst /* default bitmap byte order */
  66. # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
  67. # else
  68. # define DEFAULTGLPAD 4 /* default padding for glyphs */
  69. # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */
  70. # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */
  71. # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
  72. # endif
  73. #elif defined(ibm032)
  74. # define DEFAULTGLPAD 1 /* default padding for glyphs */
  75. # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */
  76. # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */
  77. # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
  78. #elif defined(mips)
  79. # ifdef MIPSEL
  80. # define DEFAULTGLPAD 4 /* default padding for glyphs */
  81. # define DEFAULTBITORDER LSBFirst /* default bitmap bit order */
  82. # define DEFAULTBYTEORDER LSBFirst /* default bitmap byte order */
  83. # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
  84. # else
  85. # define DEFAULTGLPAD 4 /* default padding for glyphs */
  86. # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */
  87. # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */
  88. # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
  89. # endif
  90. #else
  91. # define DEFAULTGLPAD 1 /* default padding for glyphs */
  92. # define DEFAULTBITORDER MSBFirst /* default bitmap bit order */
  93. # define DEFAULTBYTEORDER MSBFirst /* default bitmap byte order */
  94. # define DEFAULTSCANUNIT 1 /* default bitmap scan unit */
  95. #endif
  96. #define GLWIDTHBYTESPADDED(bits,nbytes) \
  97. ((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
  98. :(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
  99. :(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
  100. :(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
  101. : 0)