ftbbox.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /****************************************************************************
  2. *
  3. * ftbbox.h
  4. *
  5. * FreeType exact bbox computation (specification).
  6. *
  7. * Copyright (C) 1996-2023 by
  8. * David Turner, Robert Wilhelm, and Werner Lemberg.
  9. *
  10. * This file is part of the FreeType project, and may only be used,
  11. * modified, and distributed under the terms of the FreeType project
  12. * license, LICENSE.TXT. By continuing to use, modify, or distribute
  13. * this file you indicate that you have read the license and
  14. * understand and accept it fully.
  15. *
  16. */
  17. /**************************************************************************
  18. *
  19. * This component has a _single_ role: to compute exact outline bounding
  20. * boxes.
  21. *
  22. * It is separated from the rest of the engine for various technical
  23. * reasons. It may well be integrated in 'ftoutln' later.
  24. *
  25. */
  26. #ifndef FTBBOX_H_
  27. #define FTBBOX_H_
  28. #include <freetype/freetype.h>
  29. #ifdef FREETYPE_H
  30. #error "freetype.h of FreeType 1 has been loaded!"
  31. #error "Please fix the directory search order for header files"
  32. #error "so that freetype.h of FreeType 2 is found first."
  33. #endif
  34. FT_BEGIN_HEADER
  35. /**************************************************************************
  36. *
  37. * @section:
  38. * outline_processing
  39. *
  40. */
  41. /**************************************************************************
  42. *
  43. * @function:
  44. * FT_Outline_Get_BBox
  45. *
  46. * @description:
  47. * Compute the exact bounding box of an outline. This is slower than
  48. * computing the control box. However, it uses an advanced algorithm
  49. * that returns _very_ quickly when the two boxes coincide. Otherwise,
  50. * the outline Bezier arcs are traversed to extract their extrema.
  51. *
  52. * @input:
  53. * outline ::
  54. * A pointer to the source outline.
  55. *
  56. * @output:
  57. * abbox ::
  58. * The outline's exact bounding box.
  59. *
  60. * @return:
  61. * FreeType error code. 0~means success.
  62. *
  63. * @note:
  64. * If the font is tricky and the glyph has been loaded with
  65. * @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get
  66. * reasonable values for the BBox it is necessary to load the glyph at a
  67. * large ppem value (so that the hinting instructions can properly shift
  68. * and scale the subglyphs), then extracting the BBox, which can be
  69. * eventually converted back to font units.
  70. */
  71. FT_EXPORT( FT_Error )
  72. FT_Outline_Get_BBox( FT_Outline* outline,
  73. FT_BBox *abbox );
  74. /* */
  75. FT_END_HEADER
  76. #endif /* FTBBOX_H_ */
  77. /* END */
  78. /* Local Variables: */
  79. /* coding: utf-8 */
  80. /* End: */