PageRenderTime 41ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/afdko/Tools/Programs/public/lib/api/abfdesc.h

https://bitbucket.org/mrhso/afdko
C Header | 102 lines | 43 code | 11 blank | 48 comment | 0 complexity | e072020496dfb30b4861ab7d94d9996f MD5 | raw file
Possible License(s): Apache-2.0
  1. /* Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/). All Rights Reserved.
  2. This software is licensed as OpenSource, under the Apache License, Version 2.0. This license is available at: http://opensource.org/licenses/Apache-2.0. */
  3. /*
  4. * Abstract Font Descriptor.
  5. */
  6. #ifndef ABFDESC_H
  7. #define ABFDESC_H
  8. /* An abstract font descriptor is composed of a single fixed-length
  9. "abfFontDescHeader" followed by one or more variable-length
  10. "abfFontDescElement"s (see below). */
  11. typedef struct /* Font descriptor element */
  12. {
  13. /* The following "flags" field is used to represent font parameters having
  14. values of fixed size.
  15. Bits in the field indicate the presence (set) or absence (clear) for
  16. corresponding font parameter value(s) in the "values" array. Clear bits
  17. signify that the font parameter was either missing from the font or its
  18. value was equal to the default value for that font parameter (specified
  19. below).
  20. For correct correspondence with their values in the "values" array the
  21. fields must be considered in least significant to most significant bit
  22. order. All bits correspond to 1 value except the FontMatrix where it
  23. is an array of 6 values.
  24. Comments show default values: */
  25. unsigned short flags;
  26. #define ABF_DESC_CharstringType (1<<0) /* 2 */
  27. #define ABF_DESC_PaintType (1<<1) /* 0 */
  28. #define ABF_DESC_BlueScale (1<<2) /* 0.039625 */
  29. #define ABF_DESC_BlueShift (1<<3) /* 7 */
  30. #define ABF_DESC_BlueFuzz (1<<4) /* 1 */
  31. #define ABF_DESC_StdHW (1<<5) /* none */
  32. #define ABF_DESC_StdVW (1<<6) /* none */
  33. #define ABF_DESC_ForceBold (1<<7) /* 0=false */
  34. #define ABF_DESC_LanguageGroup (1<<8) /* 0 */
  35. #define ABF_DESC_ExpansionFactor (1<<9) /* 0.06 */
  36. #define ABF_DESC_initialRandomSeed (1<<10) /* 0 */
  37. #define ABF_DESC_defaultWidthX (1<<11) /* 0 */
  38. #define ABF_DESC_nominalWidthX (1<<12) /* 0 */
  39. #define ABF_DESC_lenSubrArray (1<<13) /* 0 (local subr count) */
  40. #define ABF_DESC_FontMatrix (1<<14) /* [.001 0 0 .001 0 0] */
  41. /* The following fields are used to represent font parameters having
  42. values of variable size.
  43. The values stored in the fields represent the number of elements in the
  44. "values" array that are used to represent each font parameter. If the
  45. value is zero the corresponding font value is not stored in the "values"
  46. array indicating that the font parameter was missing from the font.
  47. For correct correspondence with their values in the "values" array the
  48. fields must be considered in order starting with "BlueValues".
  49. Comments show [max element count]: */
  50. unsigned char BlueValues; /* [14] */
  51. unsigned char OtherBlues; /* [10] */
  52. unsigned char FamilyBlues; /* [14] */
  53. unsigned char FamilyOtherBlues; /* [10] */
  54. unsigned char StemSnapH; /* [12] */
  55. unsigned char StemSnapV; /* [12] */
  56. /* The values array contains the values corresponding to the font
  57. parameters with fixed and variable size values described above. The
  58. actual number of elements in the array is provided in the "valueCnt"
  59. field. */
  60. unsigned long valueCnt;
  61. float values[1]; /* [valueCnt] */
  62. } abfFontDescElement;
  63. typedef struct /* Font descriptor header */
  64. {
  65. unsigned short length; /* Total size in bytes of descriptor */
  66. unsigned short FDElementCnt;/* Count of "abfFontDescElement"s */
  67. float FontBBox[4];
  68. float StrokeWidth;
  69. float lenGSubrArray; /* Global subr count */
  70. } abfFontDescHeader;
  71. #define ABF_GET_FIRST_DESC(hdr) \
  72. (abfFontDescElement *)((char *)(hdr) + sizeof(abfFontDescHeader))
  73. /* The ABF_GET_FIRST_DESC() macro returns a pointer to the first
  74. abfFontDescElement in the font descriptor when supplied with a
  75. abfFontDescHeader pointer. */
  76. #define ABF_GET_NEXT_DESC(elem) \
  77. (abfFontDescElement *)((char *)(elem) + sizeof(abfFontDescElement) + \
  78. (((abfFontDescElement *)(elem))->valueCnt - 1)*sizeof(float))
  79. /* The ABF_GET_NEXT_DESC() macro returns a pointer to the next
  80. abfFontDescElement in the font descriptor when supplied with an
  81. abfFontDescElement pointer. The client must ensure that ABF_GET_NEXT_DESC()
  82. is not called more times than there are abfFontDescElement's in the font
  83. descriptor. The number of elements is available via the "FDElementCnt" field
  84. in the abfFontDescHeader. */
  85. #endif /* ABFDESC_H */