ICU 57.1  57.1
LEGlyphStorage.h
Go to the documentation of this file.
1 /*
2  **********************************************************************
3  * Copyright (C) 1998-2014, International Business Machines
4  * Corporation and others. All Rights Reserved.
5  **********************************************************************
6  */
7 
8 #ifndef __LEGLYPHSTORAGE_H
9 #define __LEGLYPHSTORAGE_H
10 
11 #include "LETypes.h"
12 #include "LEInsertionList.h"
13 
20 
34 class U_LAYOUT_API LEGlyphStorage : public UObject, protected LEInsertionCallback
35 {
36 private:
42  le_int32 fGlyphCount;
43 
49  LEGlyphID *fGlyphs;
50 
56  le_int32 *fCharIndices;
57 
63  float *fPositions;
64 
70  le_uint32 *fAuxData;
71 
72 
78  LEInsertionList *fInsertionList;
79 
85  le_int32 fSrcIndex;
86 
92  le_int32 fDestIndex;
93 
94 protected:
110  virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[]);
111 
112 public:
113 
122 
129 
137  inline le_int32 getGlyphCount() const;
138 
149  void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
150 
163  void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
164 
175  void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
176 
188  void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
189 
201  void getGlyphPositions(float positions[], LEErrorCode &success) const;
202 
217  void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
218 
231  void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success);
232 
244 
255 
264  void getAuxData(le_uint32 auxData[], LEErrorCode &success) const;
265 
276  LEGlyphID getGlyphID(le_int32 glyphIndex, LEErrorCode &success) const;
277 
288  le_int32 getCharIndex(le_int32 glyphIndex, LEErrorCode &success) const;
289 
290 
301  le_uint32 getAuxData(le_int32 glyphIndex, LEErrorCode &success) const;
302 
313  inline LEGlyphID &operator[](le_int32 glyphIndex) const;
314 
332  LEGlyphID *insertGlyphs(le_int32 atIndex, le_int32 insertCount, LEErrorCode& success);
333 
352  LEGlyphID *insertGlyphs(le_int32 atIndex, le_int32 insertCount);
353 
367  void moveGlyph(le_int32 fromPosition, le_int32 toPosition, le_uint32 marker);
368 
382 
392  void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, LEErrorCode &success);
393 
403  void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, LEErrorCode &success);
404 
415  void setPosition(le_int32 glyphIndex, float x, float y, LEErrorCode &success);
416 
427  void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success);
428 
438  void setAuxData(le_int32 glyphIndex, le_uint32 auxData, LEErrorCode &success);
439 
451 
463 
475 
487 
498 
506  void adoptGlyphCount(le_int32 newGlyphCount);
507 
516  void reset();
517 
523  virtual UClassID getDynamicClassID() const;
524 
531 };
532 
534 {
535  return fGlyphCount;
536 }
537 
539 {
540  return fGlyphs[glyphIndex];
541 }
542 
543 
545 #endif
546 
C API: Basic definitions for the ICU LayoutEngine.
LEErrorCode
Error codes returned by the LayoutEngine.
Definition: LETypes.h:687
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
le_uint32 LEGlyphID
Used for glyph indices.
Definition: LETypes.h:112
This class encapsulates the per-glyph storage used by the ICU LayoutEngine.
void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const
This method copies the glyph array into a caller supplied array.
~LEGlyphStorage()
The destructor.
void reset()
This method frees the glyph, character index, position and auxillary data arrays so that the LayoutEn...
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.
void getGlyphPositions(float positions[], LEErrorCode &success) const
This method copies the position array into a caller supplied array.
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const
This method copies the character index array into a caller supplied array.
void adoptGlyphCount(LEGlyphStorage &from)
Change the glyph count of this object to be the same as the one in from.
LEGlyphID * insertGlyphs(le_int32 atIndex, le_int32 insertCount, LEErrorCode &success)
Call this method to replace a single glyph in the glyph array with multiple glyphs.
le_int32 applyInsertions()
This method causes all of the glyph insertions recorded by insertGlyphs to be applied to the glyph ar...
LEGlyphID * insertGlyphs(le_int32 atIndex, le_int32 insertCount)
Call this method to replace a single glyph in the glyph array with multiple glyphs.
LEGlyphID & operator[](le_int32 glyphIndex) const
This operator allows direct access to the glyph array using the index operator.
void adoptAuxDataArray(LEGlyphStorage &from)
Delete the auxillary data array and replace it with the one in from.
void adoptPositionArray(LEGlyphStorage &from)
Delete the position array and replace it with the one in from.
void adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success)
Adjust the X, Y position for a particular glyph.
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
void setAuxData(le_int32 glyphIndex, le_uint32 auxData, LEErrorCode &success)
Set the auxillary data for a particular glyph.
void adoptGlyphArray(LEGlyphStorage &from)
Delete the glyph array and replace it with the one in from.
void setCharIndex(le_int32 glyphIndex, le_int32 charIndex, LEErrorCode &success)
Set the char index for a particular glyph.
virtual le_bool applyInsertion(le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[])
This implements LEInsertionCallback.
void adoptGlyphCount(le_int32 newGlyphCount)
Change the glyph count of this object to the given value.
le_int32 allocateAuxData(LEErrorCode &success)
This method allocates the storage for the auxillary glyph data.
le_int32 getGlyphCount() const
This method returns the number of glyphs in the glyph array.
le_int32 allocatePositions(LEErrorCode &success)
This method allocates the storage for the glyph positions.
LEGlyphID getGlyphID(le_int32 glyphIndex, LEErrorCode &success) const
Get the glyph ID for a particular glyph.
LEGlyphStorage()
Allocates an empty LEGlyphStorage object.
void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
This method copies the character index array into a caller supplied array.
void allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success)
This method allocates the glyph array, the char indices array and the insertion list.
le_uint32 getAuxData(le_int32 glyphIndex, LEErrorCode &success) const
Get the auxillary data for a particular glyph.
void setGlyphID(le_int32 glyphIndex, LEGlyphID glyphID, LEErrorCode &success)
Set the glyph ID for a particular glyph.
void getAuxData(le_uint32 auxData[], LEErrorCode &success) const
Copy the entire auxillary data array.
void setPosition(le_int32 glyphIndex, float x, float y, LEErrorCode &success)
Set the X, Y position for a particular glyph.
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.
void moveGlyph(le_int32 fromPosition, le_int32 toPosition, le_uint32 marker)
This method is used to reposition glyphs during Indic v2 processing.
void adoptCharIndicesArray(LEGlyphStorage &from)
Delete the char indices array and replace it with the one in from.
le_int32 getCharIndex(le_int32 glyphIndex, LEErrorCode &success) const
Get the char index for a particular glyph.
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
#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