ICU 50.2 50.2
LayoutEngine.h
Go to the documentation of this file.
1/*
2 * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved
3 */
4
5#ifndef __LAYOUTENGINE_H
6#define __LAYOUTENGINE_H
7
8#include "LETypes.h"
9
14
16
17class LEFontInstance;
18class LEGlyphFilter;
19class LEGlyphStorage;
20
65public:
66#ifndef U_HIDE_INTERNAL_API
68 static const le_int32 kTypoFlagKern;
70 static const le_int32 kTypoFlagLiga;
71#endif /* U_HIDE_INTERNAL_API */
72
73protected:
80
89
98
107
114
122
123#ifndef U_HIDE_INTERNAL_API
140 LayoutEngine(const LEFontInstance *fontInstance,
141 le_int32 scriptCode,
142 le_int32 languageCode,
143 le_int32 typoFlags,
144 LEErrorCode &success);
145#endif /* U_HIDE_INTERNAL_API */
146
147 // Do not enclose the protected default constructor with #ifndef U_HIDE_INTERNAL_API
148 // or else the compiler will create a public default constructor.
157
180 virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
181 LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
182
209 virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
210
224 virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
225
246 virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
247
261 virtual const void *getFontTable(LETag tableTag, size_t &length) const;
262
266 virtual const void *getFontTable(LETag tableTag) const { size_t ignored; return getFontTable(tableTag, ignored); }
267
293 virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success);
294
295#ifndef U_HIDE_INTERNAL_API
308 static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
309
310
329 static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
330#endif /* U_HIDE_INTERNAL_API */
331
332public:
341 virtual ~LayoutEngine();
342
368 virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success);
369
380
391 void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
392
405 virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
406
417 void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
418
430 void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
431
443 void getGlyphPositions(float positions[], LEErrorCode &success) const;
444
459 void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
460
468 virtual void reset();
469
486 static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
487
492 static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
493
500
507
508};
509
511#endif
C API: Basic definitions for the ICU LayoutEngine.
LEErrorCode
Error codes returned by the LayoutEngine.
Definition LETypes.h:678
int32_t le_int32
A type used for signed, 32-bit integers.
Definition LETypes.h:34
UBool le_bool
A type used for boolean values.
Definition LETypes.h:77
uint32_t le_uint32
A type used for unsigned, 32-bit integers.
Definition LETypes.h:41
UChar LEUnicode
Used to represent 16-bit Unicode code points.
Definition LETypes.h:238
le_uint32 LETag
Used for four character tags.
Definition LETypes.h:93
le_uint32 LEGlyphID
Used for glyph indices.
Definition LETypes.h:112
This is a virtual base class that serves as the interface between a LayoutEngine and the platform fon...
This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
le_int32 fLanguageCode
The langauge code for the text.
virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success)
This method does the glyph processing.
const LEFontInstance * fFontInstance
The font instance for the text font.
static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success)
This is a convenience method that forces the advance width of mark glyphs to be zero,...
void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
This method copies the character index array into a caller supplied array.
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success)
This method does positioning adjustments like accent positioning and kerning.
le_int32 getGlyphCount() const
This method returns the number of glyphs in the glyph array.
static const le_int32 kTypoFlagLiga
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const
This method returns the X and Y position of the glyph at the given index.
virtual const void * getFontTable(LETag tableTag, size_t &length) const
This method gets a table from the font associated with the text.
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success)
This method does character to glyph mapping.
virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success)
This method does basic glyph positioning.
static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success)
This is a convenience method that forces the advance width of mark glyphs to be zero,...
virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const
This method copies the glyph array into a caller supplied array, ORing in extra bits.
le_int32 fTypoFlags
The typographic control flags.
LayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
This constructs an instance for a given font, script and language.
void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const
This method copies the character index array into a caller supplied array.
virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success)
This method will invoke the layout steps in their correct order by calling the computeGlyphs,...
static LayoutEngine * layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success)
Override of existing call that provides flags to control typography.
virtual void reset()
This method frees the glyph, character index and position arrays so that the LayoutEngine can be reus...
void getGlyphPositions(float positions[], LEErrorCode &success) const
This method copies the position array into a caller supplied array.
static LayoutEngine * layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success)
This method returns a LayoutEngine capable of laying out text in the given font, script and langauge.
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
This method does any required pre-processing to the input characters.
virtual ~LayoutEngine()
The destructor.
le_bool fFilterZeroWidth
TRUE if mapCharsToGlyphs should replace ZWJ / ZWNJ with a glyph with no contours.
static const le_int32 kTypoFlagKern
LayoutEngine()
This overrides the default no argument constructor to make it difficult for clients to call it.
le_int32 fScriptCode
The script code for the text.
LEGlyphStorage * fGlyphStorage
The object which holds the glyph storage.
virtual const void * getFontTable(LETag tableTag) const
void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const
This method copies the glyph array into a caller supplied array.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
UObject is the common ICU "boilerplate" class.
Definition uobject.h:229
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:96
#define U_LAYOUT_API
Set to export library symbols from inside the layout engine library, and to import them from outside.
Definition utypes.h:359
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129