bmpblk_font.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
  2. * Use of this source code is governed by a BSD-style license that can be
  3. * found in the LICENSE file.
  4. *
  5. * This describes the internal format used to pack a set of character glpyhs so
  6. * we can render strings by drawing one character at a time.
  7. *
  8. * The format is this:
  9. *
  10. * +-------------------------+
  11. * | FontArrayHeader |
  12. * +-------------------------+
  13. * | FontArrayEntryHeader[0] |
  14. * +-------------------------+
  15. * | raw image data[0] |
  16. * +-------------------------+
  17. * | FontArrayEntryHeader[1] |
  18. * +-------------------------+
  19. * | raw image data[1] |
  20. * +-------------------------+
  21. * | FontArrayEntryHeader[2] |
  22. * +-------------------------+
  23. * | raw image data[2] |
  24. * +-------------------------+
  25. * ...
  26. * +-------------------------+
  27. * | FontArrayEntryHeader[n] |
  28. * +-------------------------+
  29. * | raw image data[n] |
  30. * +-------------------------+
  31. *
  32. * The FontArrayHeader describes how many characters will be encoded.
  33. * Each character encoding consists of a FontArrayEntryHeader followed
  34. * immediately by the raw image data for that character.
  35. */
  36. #ifndef VBOOT_REFERENCE_BMPBLK_FONT_H_
  37. #define VBOOT_REFERENCE_BMPBLK_FONT_H_
  38. #include "bmpblk_header.h"
  39. #define FONT_SIGNATURE "FONT"
  40. #define FONT_SIGNATURE_SIZE 4
  41. typedef struct FontArrayHeader {
  42. uint8_t signature[FONT_SIGNATURE_SIZE];
  43. uint32_t num_entries; /* Number of chars encoded here. */
  44. } __attribute__((packed)) FontArrayHeader;
  45. typedef struct FontArrayEntryHeader {
  46. uint32_t ascii; /* What to show. Could even be UTF? */
  47. ImageInfo info; /* Describes the bitmap. */
  48. /*
  49. * The image to use follows immediately, NOT compressed. It's
  50. * uncompressed because each glyph is only a few hundred bytes, but
  51. * they have much in common (colormaps, for example). When we add the
  52. * whole font blob to the bmpblk, it will be compressed as a single
  53. * item there.
  54. */
  55. } __attribute__((packed)) FontArrayEntryHeader;
  56. #endif /* VBOOT_REFERENCE_BMPBLK_FONT_H_ */