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"
169 static const char fgClassID;
184 inline Line &operator=(
const Line & ) {
return *
this; };
186 void computeMetrics();
241 inline le_int32 getGlyphCount()
const;
253 inline const LEGlyphID *getGlyphs()
const;
268 inline const float *getPositions()
const;
280 inline const le_int32 *getGlyphToCharMap()
const;
332 static const char fgClassID;
340 const float *fPositions;
509 inline void reflow();
511#ifndef U_HIDE_INTERNAL_API
564 static const char fgClassID;
581 ParagraphLayout() {};
582 ParagraphLayout(
const ParagraphLayout & ) : UObject( ){};
583 inline ParagraphLayout &operator=(
const ParagraphLayout & ) {
return *
this; };
585 void computeLevels(
UBiDiLevel paragraphLevel);
587 Line *computeVisualRuns();
588 void appendRun(Line *line, le_int32 run, le_int32 firstChar, le_int32 lastChar);
590 void computeScripts();
592 void computeLocales();
594 void computeSubFonts(
const FontRuns *fontRuns, LEErrorCode &status);
596 void computeMetrics();
598 le_int32 getLanguageCode(
const Locale *locale);
600 le_int32 getCharRun(le_int32 charIndex);
604 le_int32 previousBreak(le_int32 charIndex);
607 const LEUnicode *fChars;
610 const FontRuns *fFontRuns;
611 const ValueRuns *fLevelRuns;
612 const ValueRuns *fScriptRuns;
613 const LocaleRuns *fLocaleRuns;
616 le_bool fClientLevels;
617 le_bool fClientScripts;
618 le_bool fClientLocales;
626 le_int32 *fGlyphToCharMap;
627 le_int32 *fCharToMinGlyphMap;
628 le_int32 *fCharToMaxGlyphMap;
630 le_int32 fGlyphCount;
635 le_int32 *fStyleRunLimits;
636 le_int32 *fStyleIndices;
637 StyleRunInfo *fStyleRunInfo;
638 le_int32 fStyleRunCount;
640 BreakIterator *fBreakIterator;
644 le_int32 fFirstVisualRun;
645 le_int32 fLastVisualRun;
646 float fVisualRunLastX;
647 float fVisualRunLastY;
660inline void ParagraphLayout::reflow()
665inline ParagraphLayout::Line::Line()
666 :
UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(
NULL)
671inline ParagraphLayout::Line::Line(
const Line & )
672 : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(
NULL)
709 return fGlyphToCharMap;
714 return fFont->getAscent();
719 return fFont->getDescent();
724 return fFont->getLeading();
727inline ParagraphLayout::VisualRun::VisualRun()
733inline ParagraphLayout::VisualRun::VisualRun(
const VisualRun &)
739inline ParagraphLayout::VisualRun::VisualRun(
const LEFontInstance *font,
UBiDiDirection direction, le_int32 glyphCount,
740 const LEGlyphID glyphs[],
const float positions[],
const le_int32 glyphToCharMap[])
741 : fFont(font), fDirection(direction), fGlyphCount(glyphCount),
742 fGlyphs(glyphs), fPositions(positions), fGlyphToCharMap(glyphToCharMap)
C++ API: base class for building classes which represent data that is associated with runs of text.
The FontRuns class associates pointers to LEFontInstance objects with runs of text.
"Smart pointer" base class; do not use directly: use LocalPointer etc.
The LocaleRuns class associates pointers to Locale objects with runs of text.
A Locale object represents a specific geographical, political, or cultural region.
This class represents a single line of text in a ParagraphLayout.
~Line()
The constructor is private since these objects can only be created by ParagraphLayout.
const VisualRun * getVisualRun(le_int32 runIndex) const
Get a ParagraphLayout::VisualRun object for a given visual run in the line.
le_int32 countRuns() const
Count the number of visual runs in the line.
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.
le_int32 getWidth() const
Get the width of the line.
le_int32 getLeading() const
Get the leading of the line.
le_int32 getDescent() const
Get the descent of the line.
le_int32 getAscent() const
Get the ascent of the line.
This object represents a single visual run in a line of text in a paragraph.
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.
const LEFontInstance * getFont() const
Get the LEFontInstance object which represents the font of the visual run.
const le_int32 * getGlyphToCharMap() const
Get the glyph-to-character map for this visual run.
le_int32 getAscent() const
A convenience method which returns the ascent value for the font associated with this run.
UBiDiDirection getDirection() const
Get the direction of the visual run.
le_int32 getDescent() const
A convenience method which returns the descent value for the font associated with this run.
le_int32 getLeading() const
A convenience method which returns the leading value for the font associated with this run.
const LEGlyphID * getGlyphs() const
Get the glyphs in the visual run.
le_int32 getGlyphCount() const
Get the number of glyphs in the visual run.
const float * getPositions() const
Get the (x, y) positions of the glyphs in the visual run.
le_bool isDone() const
Convenience method for determining if paragraph layout processing is complete ( i....
virtual le_int32 getAscent() const
Return the max ascent value for all the fonts in the paragraph.
virtual le_int32 getDescent() const
Return the max descent value for all the fonts in the paragraph.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
~ParagraphLayout()
The destructor.
virtual le_int32 getLeading() const
Return the max leading value for all the fonts in the paragraph.
static le_bool isComplex(const LEUnicode chars[], le_int32 count)
Examine the given text and determine if it contains characters in any script which requires complex p...
ParagraphLayout(const LEUnicode chars[], le_int32 count, const FontRuns *fontRuns, const ValueRuns *levelRuns, const ValueRuns *scriptRuns, const LocaleRuns *localeRuns, UBiDiLevel paragraphLevel, le_bool vertical, LEErrorCode &status)
Construct a ParagraphLayout object for a styled paragraph.
Line * nextLine(float width)
Return a ParagraphLayout::Line object which represents next line in the paragraph.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
UObject is the common ICU "boilerplate" class.
The ValueRuns class associates integer values with runs of text.
UBiDiLevel ubidi_getParaLevel(const UBiDi *pBiDi)
Get the paragraph level of the text.
UBiDiDirection
UBiDiDirection values indicate the text direction.
@ UBIDI_LTR
Left-to-right text.
uint8_t UBiDiLevel
UBiDiLevel is the type of the level values in this Bidi implementation.
UBiDiDirection ubidi_getDirection(const UBiDi *pBiDi)
Get the directionality of the text.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
C API: Unicode Script Information.
UScriptCode
Constants for ISO 15924 script codes.
#define NULL
Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
#define U_LAYOUTEX_API
Set to export library symbols from inside the layout extensions library, and to import them from outs...
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.