]> git.saurik.com Git - apple/icu.git/blob - icuSources/samples/layout/paragraph.h
ICU-8.11.2.tar.gz
[apple/icu.git] / icuSources / samples / layout / paragraph.h
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 1999-2005, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 *******************************************************************************
8 * file name: Paragraph.h
9 *
10 * created on: 09/06/2000
11 * created by: Eric R. Mader
12 */
13 #ifndef __PARAGRAPH_H
14 #define __PARAGRAPH_H
15
16 #include "unicode/utypes.h"
17 #include "unicode/ubidi.h"
18
19 #include "layout/LEFontInstance.h"
20 #include "layout/ParagraphLayout.h"
21
22 #include "GUISupport.h"
23 #include "RenderingSurface.h"
24 //#include "FontMap.h"
25
26 U_NAMESPACE_USE
27
28 #define MARGIN 10
29
30 #if 0
31 class LineInfo;
32 #endif
33
34 class Paragraph
35 {
36 public:
37 Paragraph(const LEUnicode chars[], le_int32 charCount, const FontRuns *fontRuns, LEErrorCode &status);
38
39 ~Paragraph();
40
41 le_int32 getAscent();
42 le_int32 getLineHeight();
43 le_int32 getLineCount();
44 void breakLines(le_int32 width, le_int32 height);
45 void draw(RenderingSurface *surface, le_int32 firstLine, le_int32 lastLine);
46
47 static Paragraph *paragraphFactory(const char *fileName, const LEFontInstance *font, GUISupport *guiSupport);
48
49 private:
50 void addLine(const ParagraphLayout::Line *line);
51
52 ParagraphLayout **fParagraphLayout;
53
54 le_int32 fParagraphCount;
55 le_int32 fParagraphMax;
56 le_int32 fParagraphGrow;
57
58 le_int32 fLineCount;
59 le_int32 fLinesMax;
60 le_int32 fLinesGrow;
61
62 const ParagraphLayout::Line **fLines;
63 LEUnicode *fChars;
64
65 le_int32 fLineHeight;
66 le_int32 fAscent;
67 le_int32 fWidth;
68 le_int32 fHeight;
69 UBiDiLevel fParagraphLevel;
70 };
71
72 inline le_int32 Paragraph::getLineHeight()
73 {
74 return fLineHeight;
75 }
76
77 inline le_int32 Paragraph::getLineCount()
78 {
79 return fLineCount;
80 }
81
82 inline le_int32 Paragraph::getAscent()
83 {
84 return fAscent;
85 }
86
87 #endif
88
89