os/textandloc/fontservices/textshaperplugin/IcuSource/layout/GlyphIterator.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2  *
     3  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
     4  *
     5  */
     6 
     7 #ifndef __GLYPHITERATOR_H
     8 #define __GLYPHITERATOR_H
     9 
    10 /**
    11  * \file
    12  * \internal
    13  */
    14 
    15 #include "LETypes.h"
    16 #include "OpenTypeTables.h"
    17 #include "GlyphDefinitionTables.h"
    18 
    19 U_NAMESPACE_BEGIN
    20 
    21 class LEGlyphStorage;
    22 class GlyphPositionAdjustments;
    23 
    24 class GlyphIterator : public UMemory {
    25 public:
    26     GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags, LETag theFeatureTag,
    27         const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader);
    28 
    29     GlyphIterator(GlyphIterator &that);
    30 
    31     GlyphIterator(GlyphIterator &that, LETag newFeatureTag);
    32 
    33     GlyphIterator(GlyphIterator &that, le_uint16 newLookupFlags);
    34 
    35     virtual ~GlyphIterator();
    36 
    37     void reset(le_uint16 newLookupFlags, LETag newFeatureTag);
    38 
    39     le_bool next(le_uint32 delta = 1);
    40     le_bool prev(le_uint32 delta = 1);
    41     le_bool findFeatureTag();
    42 
    43     le_bool isRightToLeft() const;
    44     le_bool ignoresMarks() const;
    45 
    46     le_bool baselineIsLogicalEnd() const;
    47 
    48     LEGlyphID getCurrGlyphID() const;
    49     le_int32  getCurrStreamPosition() const;
    50 
    51     le_int32  getMarkComponent(le_int32 markPosition) const;
    52     le_bool   findMark2Glyph();
    53 
    54     void getCursiveEntryPoint(LEPoint &entryPoint) const;
    55     void getCursiveExitPoint(LEPoint &exitPoint) const;
    56 
    57     void setCurrGlyphID(TTGlyphID glyphID);
    58     void setCurrStreamPosition(le_int32 position);
    59     void setCurrGlyphBaseOffset(le_int32 baseOffset);
    60     void adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
    61                                            float xAdvanceAdjust,   float yAdvanceAdjust);
    62 
    63     void setCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
    64                                         float xAdvanceAdjust,   float yAdvanceAdjust);
    65 
    66     void setCursiveEntryPoint(LEPoint &entryPoint);
    67     void setCursiveExitPoint(LEPoint &exitPoint);
    68     void setCursiveGlyph();
    69 
    70     LEGlyphID *insertGlyphs(le_int32 count, LEErrorCode& success);
    71     le_int32 applyInsertions();
    72 
    73 private:
    74     le_bool filterGlyph(le_uint32 index) const;
    75     le_bool hasFeatureTag() const;
    76     le_bool nextInternal(le_uint32 delta = 1);
    77     le_bool prevInternal(le_uint32 delta = 1);
    78 
    79     le_int32  direction;
    80     le_int32  position;
    81     le_int32  nextLimit;
    82     le_int32  prevLimit;
    83 
    84     LEGlyphStorage &glyphStorage;
    85     GlyphPositionAdjustments *glyphPositionAdjustments;
    86     le_int32 srcIndex;
    87     le_int32 destIndex;
    88     le_uint16 lookupFlags;
    89     LETag    featureTag;
    90     const GlyphClassDefinitionTable *glyphClassDefinitionTable;
    91     const MarkAttachClassDefinitionTable *markAttachClassDefinitionTable;
    92 
    93     GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class
    94 };
    95 
    96 U_NAMESPACE_END
    97 #endif