ICU 55.1  55.1
LayoutEngine.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright IBM Corp. and others 1998-2014 - All Rights Reserved
3  */
4 
5 #ifndef __LAYOUTENGINE_H
6 #define __LAYOUTENGINE_H
7 
8 #include "LETypes.h"
9 
16 
17 class LEFontInstance;
18 class LEGlyphFilter;
19 class LEGlyphStorage;
20 
72 public:
73 #ifndef U_HIDE_INTERNAL_API
74 
75  static const le_int32 kTypoFlagKern;
77  static const le_int32 kTypoFlagLiga;
78 #endif /* U_HIDE_INTERNAL_API */
79 
80 protected:
87 
96 
105 
114 
121 
129 
130 #ifndef U_HIDE_INTERNAL_API
131 
147  LayoutEngine(const LEFontInstance *fontInstance,
148  le_int32 scriptCode,
149  le_int32 languageCode,
150  le_int32 typoFlags,
151  LEErrorCode &success);
152 #endif /* U_HIDE_INTERNAL_API */
153 
154  // Do not enclose the protected default constructor with #ifndef U_HIDE_INTERNAL_API
155  // or else the compiler will create a public default constructor.
164 
187  virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
188  LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
189 
216  virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
217 
231  virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
232 
253  virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
254 
268  virtual const void *getFontTable(LETag tableTag, size_t &length) const;
269 
273  virtual const void *getFontTable(LETag tableTag) const { size_t ignored; return getFontTable(tableTag, ignored); }
274 
300  virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror, LEGlyphStorage &glyphStorage, LEErrorCode &success);
301 
302 #ifndef U_HIDE_INTERNAL_API
303 
315  static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
316 
317 
336  static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
337 #endif /* U_HIDE_INTERNAL_API */
338 
339 public:
348  virtual ~LayoutEngine();
349 
375  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);
376 
387 
398  void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
399 
412  virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
413 
424  void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
425 
437  void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
438 
450  void getGlyphPositions(float positions[], LEErrorCode &success) const;
451 
466  void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
467 
475  virtual void reset();
476 
493  static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
494 
499  static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
500 
506  virtual UClassID getDynamicClassID() const;
507 
514 
515 };
516 
518 #endif
icu::LayoutEngine::LayoutEngine
LayoutEngine()
This overrides the default no argument constructor to make it difficult for clients to call it.
icu::LayoutEngine::getGlyphPositions
void getGlyphPositions(float positions[], LEErrorCode &success) const
This method copies the position array into a caller supplied array.
icu::LayoutEngine::fFilterZeroWidth
le_bool fFilterZeroWidth
TRUE if mapCharsToGlyphs should replace ZWJ / ZWNJ with a glyph with no contours.
Definition: LayoutEngine.h:128
icu::LayoutEngine::adjustGlyphPositions
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.
LETag
le_uint32 LETag
Used for four character tags.
Definition: LETypes.h:93
icu::LayoutEngine::LayoutEngine
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.
icu::LayoutEngine::layoutEngineFactory
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.
icu::LayoutEngine::layoutChars
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,...
icu::LayoutEngine::fGlyphStorage
LEGlyphStorage * fGlyphStorage
The object which holds the glyph storage.
Definition: LayoutEngine.h:86
icu::LayoutEngine::~LayoutEngine
virtual ~LayoutEngine()
The destructor.
icu::LayoutEngine::adjustMarkGlyphs
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,...
le_int32
int32_t le_int32
A type used for signed, 32-bit integers.
Definition: LETypes.h:34
icu::LayoutEngine::layoutEngineFactory
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.
icu::LayoutEngine
NOTE: This class is deprecated, please instead use HarfBuzz.
Definition: LayoutEngine.h:71
icu::LayoutEngine::fLanguageCode
le_int32 fLanguageCode
The langauge code for the text.
Definition: LayoutEngine.h:113
U_LAYOUT_API
#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
le_bool
UBool le_bool
A type used for boolean values.
Definition: LETypes.h:77
icu::LayoutEngine::getCharIndices
void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const
This method copies the character index array into a caller supplied array.
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
icu::LayoutEngine::fScriptCode
le_int32 fScriptCode
The script code for the text.
Definition: LayoutEngine.h:104
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
icu::LayoutEngine::fTypoFlags
le_int32 fTypoFlags
The typographic control flags.
Definition: LayoutEngine.h:120
icu::LayoutEngine::getFontTable
virtual const void * getFontTable(LETag tableTag, size_t &length) const
This method gets a table from the font associated with the text.
icu::LayoutEngine::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
icu::LayoutEngine::getGlyphs
void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const
This method copies the glyph array into a caller supplied array.
icu::LayoutEngine::kTypoFlagKern
static const le_int32 kTypoFlagKern
Definition: LayoutEngine.h:75
icu::LayoutEngine::computeGlyphs
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.
LEErrorCode
LEErrorCode
Error codes returned by the LayoutEngine.
Definition: LETypes.h:687
icu::LayoutEngine::getStaticClassID
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
icu::LayoutEngine::getGlyphPosition
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.
icu::LayoutEngine::getGlyphs
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.
icu::LayoutEngine::characterProcessing
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.
icu::LayoutEngine::positionGlyphs
virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success)
This method does basic glyph positioning.
icu::LayoutEngine::getGlyphCount
le_int32 getGlyphCount() const
This method returns the number of glyphs in the glyph array.
LEUnicode
UChar LEUnicode
Used to represent 16-bit Unicode code points.
Definition: LETypes.h:238
icu::LEFontInstance
This is a virtual base class that serves as the interface between a LayoutEngine and the platform fon...
Definition: LEFontInstance.h:82
icu::LayoutEngine::kTypoFlagLiga
static const le_int32 kTypoFlagLiga
Definition: LayoutEngine.h:77
icu::LayoutEngine::getFontTable
virtual const void * getFontTable(LETag tableTag) const
Definition: LayoutEngine.h:273
icu::LayoutEngine::getCharIndices
void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
This method copies the character index array into a caller supplied array.
icu::LayoutEngine::adjustMarkGlyphs
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,...
icu::LayoutEngine::fFontInstance
const LEFontInstance * fFontInstance
The font instance for the text font.
Definition: LayoutEngine.h:95
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
icu::LayoutEngine::reset
virtual void reset()
This method frees the glyph, character index and position arrays so that the LayoutEngine can be reus...
icu::LEGlyphStorage
This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
Definition: LEGlyphStorage.h:35
le_uint32
uint32_t le_uint32
A type used for unsigned, 32-bit integers.
Definition: LETypes.h:41
icu::LayoutEngine::mapCharsToGlyphs
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.
LETypes.h
C API: Basic definitions for the ICU LayoutEngine.
LEGlyphID
le_uint32 LEGlyphID
Used for glyph indices.
Definition: LETypes.h:112