• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *******************************************************************************
3  *
4  *   Copyright (C) 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 
22 #include "unicode/utypes.h"
23 #include "unicode/ubidi.h"
24 
25 #include "layout/LEFontInstance.h"
26 #include "layout/ParagraphLayout.h"
27 
28 #include "GUISupport.h"
29 #include "RenderingSurface.h"
30 
31 U_NAMESPACE_USE
32 
33 #define MARGIN 10
34 
35 #if 0
36 class LineInfo;
37 #endif
38 
39 class Paragraph
40 {
41 public:
42     Paragraph(const LEUnicode chars[], le_int32 charCount, const FontRuns *fontRuns, LEErrorCode &status);
43 
44     ~Paragraph();
45 
46     le_int32 getAscent();
47     le_int32 getLineHeight();
48     le_int32 getLineCount();
49     void breakLines(le_int32 width, le_int32 height);
50     void draw(RenderingSurface *surface, le_int32 firstLine, le_int32 lastLine);
51 
52     static Paragraph *paragraphFactory(const char *fileName, const LEFontInstance *font, GUISupport *guiSupport);
53 
54 private:
55     void addLine(const ParagraphLayout::Line *line);
56 
57     ParagraphLayout **fParagraphLayout;
58 
59     le_int32          fParagraphCount;
60     le_int32          fParagraphMax;
61     le_int32          fParagraphGrow;
62 
63     le_int32          fLineCount;
64     le_int32          fLinesMax;
65     le_int32          fLinesGrow;
66 
67     const ParagraphLayout::Line **fLines;
68           LEUnicode *fChars;
69 
70     le_int32         fLineHeight;
71     le_int32         fAscent;
72     le_int32         fWidth;
73     le_int32         fHeight;
74     UBiDiLevel       fParagraphLevel;
75 };
76 
getLineHeight()77 inline le_int32 Paragraph::getLineHeight()
78 {
79     return fLineHeight;
80 }
81 
getLineCount()82 inline le_int32 Paragraph::getLineCount()
83 {
84     return fLineCount;
85 }
86 
getAscent()87 inline le_int32 Paragraph::getAscent()
88 {
89     return fAscent;
90 }
91 
92 #endif
93 
94 
95