10 #ifndef __PARAGRAPHLAYOUT_H
12 #define __PARAGRAPHLAYOUT_H
24 #if ! UCONFIG_NO_BREAK_ITERATION
26 #include "layout/LETypes.h"
27 #include "layout/LEFontInstance.h"
28 #include "layout/LayoutEngine.h"
87 inline le_int32 countRuns()
const;
97 le_int32 getAscent()
const;
107 le_int32 getDescent()
const;
117 le_int32 getLeading()
const;
128 le_int32 getWidth()
const;
145 const VisualRun *getVisualRun(le_int32 runIndex)
const;
167 static const char fgClassID;
176 le_int32 fRunCapacity;
182 inline Line &operator=(
const Line & ) {
return *
this; };
184 void computeMetrics();
186 void append(
const LEFontInstance *font,
UBiDiDirection direction, le_int32 glyphCount,
187 const LEGlyphID glyphs[],
const float positions[],
const le_int32 glyphToCharMap[]);
220 inline const LEFontInstance *getFont()
const;
239 inline le_int32 getGlyphCount()
const;
251 inline const LEGlyphID *getGlyphs()
const;
266 inline const float *getPositions()
const;
278 inline const le_int32 *getGlyphToCharMap()
const;
288 inline le_int32 getAscent()
const;
298 inline le_int32 getDescent()
const;
308 inline le_int32 getLeading()
const;
330 static const char fgClassID;
332 const LEFontInstance *fFont;
335 const le_int32 fGlyphCount;
337 const LEGlyphID *fGlyphs;
338 const float *fPositions;
339 const le_int32 *fGlyphToCharMap;
347 inline VisualRun(
const LEFontInstance *font,
UBiDiDirection direction, le_int32 glyphCount,
348 const LEGlyphID glyphs[],
const float positions[],
const le_int32 glyphToCharMap[]);
396 ParagraphLayout(
const LEUnicode chars[], le_int32 count,
397 const FontRuns *fontRuns,
398 const ValueRuns *levelRuns,
399 const ValueRuns *scriptRuns,
400 const LocaleRuns *localeRuns,
402 LEErrorCode &status);
431 static le_bool isComplex(
const LEUnicode chars[], le_int32 count,
const FontRuns *fontRuns);
445 static le_bool isComplex(
const LEUnicode chars[], le_int32 count);
479 virtual le_int32 getAscent()
const;
489 virtual le_int32 getDescent()
const;
499 virtual le_int32 getLeading()
const;
507 inline void reflow();
509 #ifndef U_HIDE_INTERNAL_API
519 inline le_bool isDone()
const;
539 Line *nextLine(
float width);
562 static const char fgClassID;
566 LayoutEngine *engine;
567 const LEFontInstance *font;
579 ParagraphLayout() {};
580 ParagraphLayout(
const ParagraphLayout & ) : UObject( ){};
581 inline ParagraphLayout &operator=(
const ParagraphLayout & ) {
return *
this; };
583 void computeLevels(
UBiDiLevel paragraphLevel);
585 Line *computeVisualRuns();
586 void appendRun(Line *line, le_int32 run, le_int32 firstChar, le_int32 lastChar);
588 void computeScripts();
590 void computeLocales();
592 void computeSubFonts(
const FontRuns *fontRuns, LEErrorCode &status);
594 void computeMetrics();
596 le_int32 getLanguageCode(
const Locale *locale);
598 le_int32 getCharRun(le_int32 charIndex);
602 le_int32 previousBreak(le_int32 charIndex);
605 const LEUnicode *fChars;
608 const FontRuns *fFontRuns;
609 const ValueRuns *fLevelRuns;
610 const ValueRuns *fScriptRuns;
611 const LocaleRuns *fLocaleRuns;
614 le_bool fClientLevels;
615 le_bool fClientScripts;
616 le_bool fClientLocales;
624 le_int32 *fGlyphToCharMap;
625 le_int32 *fCharToMinGlyphMap;
626 le_int32 *fCharToMaxGlyphMap;
628 le_int32 fGlyphCount;
633 le_int32 *fStyleRunLimits;
634 le_int32 *fStyleIndices;
635 StyleRunInfo *fStyleRunInfo;
636 le_int32 fStyleRunCount;
638 BreakIterator *fBreakIterator;
642 le_int32 fFirstVisualRun;
643 le_int32 fLastVisualRun;
644 float fVisualRunLastX;
645 float fVisualRunLastY;
658 inline void ParagraphLayout::reflow()
663 inline ParagraphLayout::Line::Line()
664 :
UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(
NULL)
669 inline ParagraphLayout::Line::Line(
const Line & )
670 : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(
NULL)
707 return fGlyphToCharMap;
712 return fFont->getAscent();
717 return fFont->getDescent();
722 return fFont->getLeading();
725 inline ParagraphLayout::VisualRun::VisualRun()
731 inline ParagraphLayout::VisualRun::VisualRun(
const VisualRun &)
737 inline ParagraphLayout::VisualRun::VisualRun(
const LEFontInstance *font,
UBiDiDirection direction, le_int32 glyphCount,
738 const LEGlyphID glyphs[],
const float positions[],
const le_int32 glyphToCharMap[])
739 : fFont(font), fDirection(direction), fGlyphCount(glyphCount),
740 fGlyphs(glyphs), fPositions(positions), fGlyphToCharMap(glyphToCharMap)
le_int32 countRuns() const
Count the number of visual runs in the line.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
const le_int32 * getGlyphToCharMap() const
Get the glyph-to-character map for this visual run.
UBiDiDirection getDirection() const
Get the direction of the visual run.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
UScriptCode
Constants for ISO 15924 script codes.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
uint8_t UBiDiLevel
UBiDiLevel is the type of the level values in this Bidi implementation.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
This object represents a single visual run in a line of text in a paragraph.
C API: Unicode Script Information.
UBiDiDirection
UBiDiDirection values indicate the text direction.
This class represents a single line of text in a ParagraphLayout.
const float * getPositions() const
Get the (x, y) positions of the glyphs in the visual run.
U_CAPI UBiDiLevel ubidi_getParaLevel(const UBiDi *pBiDi)
Get the paragraph level of the text.
U_CAPI UBiDiDirection ubidi_getDirection(const UBiDi *pBiDi)
Get the directionality of the text.
#define NULL
Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
le_int32 getAscent() const
A convenience method which returns the ascent value for the font associated with this run...
const LEGlyphID * getGlyphs() const
Get the glyphs in the visual run.
#define U_LAYOUTEX_API
Set to export library symbols from inside the layout extensions library, and to import them from outs...
const LEFontInstance * getFont() const
Get the LEFontInstance object which represents the font of the visual run.
C++ API: base class for building classes which represent data that is associated with runs of text...
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
le_int32 getDescent() const
A convenience method which returns the descent value for the font associated with this run...
le_int32 getGlyphCount() const
Get the number of glyphs in the visual run.
UObject is the common ICU "boilerplate" class.
le_int32 getLeading() const
A convenience method which returns the leading value for the font associated with this run...
A Locale object represents a specific geographical, political, or cultural region.