textengine.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright 2015 Autodesk, Inc. All rights reserved.
  6. //
  7. // Use of this software is subject to the terms of the Autodesk license
  8. // agreement provided at the time of installation or download, or which
  9. // otherwise accompanies this software in either electronic or hard copy form.
  10. //
  11. //////////////////////////////////////////////////////////////////////////////
  12. //
  13. // This is the Graphics Interface for view independent and dependent
  14. // elaboration of AcDb Entities.
  15. //
  16. // The AutoCAD Graphics Interface (AcGi) is a set of objects comprising
  17. // an API for elaborating the graphics representation of new AutoCAD
  18. // entitites. These objects support many geometric primitives,
  19. // transformation matrix querying, and graphical attributes.
  20. #ifndef _TEXTENGINE_H
  21. #define _TEXTENGINE_H 1
  22. #include "acgi.h"
  23. #include "AdAChar.h"
  24. #include "Adesk.h"
  25. #pragma pack (push, 8)
  26. typedef void (*PolylineCallback) (int, int const *, AcGePoint3d const *, void *);
  27. typedef void (*UnicodeCallback) (Adesk::LongPtr, wchar_t const *, int, void *);
  28. class AcGiTextEngine {
  29. public:
  30. static AcGiTextEngine * create();
  31. virtual ~AcGiTextEngine() { ; }
  32. // Returns the extents of the text string in unit coordinates.
  33. virtual void getExtents (AcGiTextStyle & ts,
  34. ACHAR const * pStr,
  35. int nLength,
  36. bool bPenUp,
  37. bool bRaw,
  38. AcGePoint2d & extents) = 0;
  39. // Tessellates the shape text and sends the tessellated vectors as a
  40. // single poly polyline call for the entire text string. Again, this
  41. // is in unit coordinates. The code to tessellate truetype text needs
  42. // to be added to this routine sometime in the future.
  43. virtual void tessellate (AcGiTextStyle & ts,
  44. ACHAR const * pStr,
  45. int nLength,
  46. bool bRaw,
  47. double deviation,
  48. void * pVoid,
  49. PolylineCallback pPolylineCallback) = 0;
  50. // Processes any control codes that are embedded in the passed in
  51. // string (give examples?). The converted unicode is passed back
  52. // through a unicode callback function. In addition, any
  53. // overscores/underscores that might result from the processing of
  54. // control codes will be drawn through the polyline callback. The
  55. // vectors representing the overlines and underlines will be in unit
  56. // coordinates as well. Currently, this is implemented for truetype
  57. // text only. Needs to be updated for shape text as well.
  58. virtual void tessellate (AcGiTextStyle & ts,
  59. ACHAR const * pString,
  60. int nLength,
  61. bool bRaw,
  62. void * pVoid,
  63. UnicodeCallback pUnicodeCallback,
  64. PolylineCallback pPolylineCallback) = 0;
  65. };
  66. #pragma pack (pop)
  67. #endif // not _TEXTENGINE_H