paragraph.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. *******************************************************************************
  3. *
  4. * © 2016 and later: Unicode, Inc. and others.
  5. * License & terms of use: http://www.unicode.org/copyright.html#License
  6. *
  7. *******************************************************************************
  8. *******************************************************************************
  9. *
  10. * Copyright (C) 1999-2007, International Business Machines
  11. * Corporation and others. All Rights Reserved.
  12. *
  13. *******************************************************************************
  14. * file name: Paragraph.h
  15. *
  16. * created on: 09/06/2000
  17. * created by: Eric R. Mader
  18. */
  19. #ifndef __PARAGRAPH_H
  20. #define __PARAGRAPH_H
  21. #include "unicode/utypes.h"
  22. #include "unicode/ubidi.h"
  23. #include "layout/LEFontInstance.h"
  24. #include "layout/ParagraphLayout.h"
  25. #include "GUISupport.h"
  26. #include "RenderingSurface.h"
  27. U_NAMESPACE_USE
  28. #define MARGIN 10
  29. #if 0
  30. class LineInfo;
  31. #endif
  32. class Paragraph
  33. {
  34. public:
  35. Paragraph(const LEUnicode chars[], le_int32 charCount, const FontRuns *fontRuns, LEErrorCode &status);
  36. ~Paragraph();
  37. le_int32 getAscent();
  38. le_int32 getLineHeight();
  39. le_int32 getLineCount();
  40. void breakLines(le_int32 width, le_int32 height);
  41. void draw(RenderingSurface *surface, le_int32 firstLine, le_int32 lastLine);
  42. static Paragraph *paragraphFactory(const char *fileName, const LEFontInstance *font, GUISupport *guiSupport);
  43. private:
  44. void addLine(const ParagraphLayout::Line *line);
  45. ParagraphLayout **fParagraphLayout;
  46. le_int32 fParagraphCount;
  47. le_int32 fParagraphMax;
  48. le_int32 fParagraphGrow;
  49. le_int32 fLineCount;
  50. le_int32 fLinesMax;
  51. le_int32 fLinesGrow;
  52. const ParagraphLayout::Line **fLines;
  53. LEUnicode *fChars;
  54. le_int32 fLineHeight;
  55. le_int32 fAscent;
  56. le_int32 fWidth;
  57. le_int32 fHeight;
  58. UBiDiLevel fParagraphLevel;
  59. };
  60. inline le_int32 Paragraph::getLineHeight()
  61. {
  62. return fLineHeight;
  63. }
  64. inline le_int32 Paragraph::getLineCount()
  65. {
  66. return fLineCount;
  67. }
  68. inline le_int32 Paragraph::getAscent()
  69. {
  70. return fAscent;
  71. }
  72. #endif