1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
5 * (C) Copyright IBM Corp. 1998-2007 - All Rights Reserved
10 * paragraphLayout doesn't make much sense without
13 #include "layout/LETypes.h"
14 #include "layout/loengine.h"
15 #include "layout/plruns.h"
16 #include "layout/playout.h"
18 #include "unicode/locid.h"
20 #include "layout/LayoutEngine.h"
21 #include "layout/ParagraphLayout.h"
23 #if ! UCONFIG_NO_BREAK_ITERATION
27 U_CAPI pl_paragraph
* U_EXPORT2
28 pl_create(const LEUnicode chars
[],
30 const pl_fontRuns
*fontRuns
,
31 const pl_valueRuns
*levelRuns
,
32 const pl_valueRuns
*scriptRuns
,
33 const pl_localeRuns
*localeRuns
,
34 UBiDiLevel paragraphLevel
,
38 ParagraphLayout
*pl
= new ParagraphLayout(chars
, count
, (const FontRuns
*) fontRuns
,
39 (const ValueRuns
*) levelRuns
, (const ValueRuns
*) scriptRuns
, (const LocaleRuns
*) localeRuns
,
40 paragraphLevel
, vertical
, *status
);
42 return (pl_paragraph
*) pl
;
46 pl_close(pl_paragraph
*paragraph
)
48 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
53 U_CAPI le_bool U_EXPORT2
54 pl_isComplex(const LEUnicode chars
[],
57 return ParagraphLayout::isComplex(chars
, count
);
60 U_CAPI UBiDiLevel U_EXPORT2
61 pl_getParagraphLevel(pl_paragraph
*paragraph
)
63 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
69 return pl
->getParagraphLevel();
72 U_CAPI UBiDiDirection U_EXPORT2
73 pl_getTextDirection(pl_paragraph
*paragraph
)
75 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
81 return pl
->getTextDirection();
84 U_CAPI le_int32 U_EXPORT2
85 pl_getAscent(const pl_paragraph
*paragraph
)
87 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
93 return pl
->getAscent();
96 U_CAPI le_int32 U_EXPORT2
97 pl_getDescent(const pl_paragraph
*paragraph
)
99 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
105 return pl
->getDescent();
108 U_CAPI le_int32 U_EXPORT2
109 pl_getLeading(const pl_paragraph
*paragraph
)
111 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
117 return pl
->getLeading();
120 U_CAPI
void U_EXPORT2
121 pl_reflow(pl_paragraph
*paragraph
)
123 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
132 U_CAPI pl_line
* U_EXPORT2
133 pl_nextLine(pl_paragraph
*paragraph
, float width
)
135 ParagraphLayout
*pl
= (ParagraphLayout
*) paragraph
;
141 return (pl_line
*) pl
->nextLine(width
);
144 U_CAPI
void U_EXPORT2
145 pl_closeLine(pl_line
*line
)
147 ParagraphLayout::Line
*ll
= (ParagraphLayout::Line
*) line
;
152 U_CAPI le_int32 U_EXPORT2
153 pl_countLineRuns(const pl_line
*line
)
155 ParagraphLayout::Line
*ll
= (ParagraphLayout::Line
*) line
;
161 return ll
->countRuns();
164 U_CAPI le_int32 U_EXPORT2
165 pl_getLineAscent(const pl_line
*line
)
167 ParagraphLayout::Line
*ll
= (ParagraphLayout::Line
*) line
;
173 return ll
->getAscent();
176 U_CAPI le_int32 U_EXPORT2
177 pl_getLineDescent(const pl_line
*line
)
179 ParagraphLayout::Line
*ll
= (ParagraphLayout::Line
*) line
;
185 return ll
->getDescent();
188 U_CAPI le_int32 U_EXPORT2
189 pl_getLineLeading(const pl_line
*line
)
191 ParagraphLayout::Line
*ll
= (ParagraphLayout::Line
*) line
;
197 return ll
->getLeading();
200 U_CAPI le_int32 U_EXPORT2
201 pl_getLineWidth(const pl_line
*line
)
203 ParagraphLayout::Line
*ll
= (ParagraphLayout::Line
*) line
;
209 return ll
->getWidth();
212 U_CAPI
const pl_visualRun
* U_EXPORT2
213 pl_getLineVisualRun(const pl_line
*line
, le_int32 runIndex
)
215 ParagraphLayout::Line
*ll
= (ParagraphLayout::Line
*) line
;
221 return (pl_visualRun
*) ll
->getVisualRun(runIndex
);
224 U_CAPI
const le_font
* U_EXPORT2
225 pl_getVisualRunFont(const pl_visualRun
*run
)
227 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
233 return (const le_font
*) vr
->getFont();
236 U_CAPI UBiDiDirection U_EXPORT2
237 pl_getVisualRunDirection(const pl_visualRun
*run
)
239 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
245 return vr
->getDirection();
248 U_CAPI le_int32 U_EXPORT2
249 pl_getVisualRunGlyphCount(const pl_visualRun
*run
)
251 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
257 return vr
->getGlyphCount();
260 U_CAPI
const LEGlyphID
* U_EXPORT2
261 pl_getVisualRunGlyphs(const pl_visualRun
*run
)
263 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
269 return vr
->getGlyphs();
272 U_CAPI
const float * U_EXPORT2
273 pl_getVisualRunPositions(const pl_visualRun
*run
)
275 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
281 return vr
->getPositions();
284 U_CAPI
const le_int32
* U_EXPORT2
285 pl_getVisualRunGlyphToCharMap(const pl_visualRun
*run
)
287 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
293 return vr
->getGlyphToCharMap();
296 U_CAPI le_int32 U_EXPORT2
297 pl_getVisualRunAscent(const pl_visualRun
*run
)
299 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
305 return vr
->getAscent();
308 U_CAPI le_int32 U_EXPORT2
309 pl_getVisualRunDescent(const pl_visualRun
*run
)
311 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
317 return vr
->getDescent();
320 U_CAPI le_int32 U_EXPORT2
321 pl_getVisualRunLeading(const pl_visualRun
*run
)
323 ParagraphLayout::VisualRun
*vr
= (ParagraphLayout::VisualRun
*) run
;
329 return vr
->getLeading();