jdk/src/share/native/sun/font/layout/GlyphIterator.h
changeset 2 90ce3da70b43
child 3935 afcdb712a9c5
equal deleted inserted replaced
0:fd16c54261b3 2:90ce3da70b43
       
     1 /*
       
     2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     3  *
       
     4  * This code is free software; you can redistribute it and/or modify it
       
     5  * under the terms of the GNU General Public License version 2 only, as
       
     6  * published by the Free Software Foundation.  Sun designates this
       
     7  * particular file as subject to the "Classpath" exception as provided
       
     8  * by Sun in the LICENSE file that accompanied this code.
       
     9  *
       
    10  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    13  * version 2 for more details (a copy is included in the LICENSE file that
       
    14  * accompanied this code).
       
    15  *
       
    16  * You should have received a copy of the GNU General Public License version
       
    17  * 2 along with this work; if not, write to the Free Software Foundation,
       
    18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19  *
       
    20  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    21  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    22  * have any questions.
       
    23  *
       
    24  */
       
    25 
       
    26 /*
       
    27  *
       
    28  * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
       
    29  *
       
    30  */
       
    31 
       
    32 #ifndef __GLYPHITERATOR_H
       
    33 #define __GLYPHITERATOR_H
       
    34 
       
    35 #include "LETypes.h"
       
    36 #include "OpenTypeTables.h"
       
    37 #include "GlyphDefinitionTables.h"
       
    38 
       
    39 struct InsertionRecord
       
    40 {
       
    41     InsertionRecord *next;
       
    42     le_int32 position;
       
    43     le_int32 count;
       
    44     LEGlyphID glyphs[ANY_NUMBER];
       
    45 };
       
    46 
       
    47 class LEGlyphStorage;
       
    48 class GlyphPositionAdjustments;
       
    49 
       
    50 class GlyphIterator {
       
    51 public:
       
    52     GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments,
       
    53         le_bool rightToLeft, le_uint16 theLookupFlags, FeatureMask theFeatureMask,
       
    54         const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader);
       
    55 
       
    56     GlyphIterator(GlyphIterator &that);
       
    57 
       
    58     GlyphIterator(GlyphIterator &that, FeatureMask newFeatureMask);
       
    59 
       
    60     GlyphIterator(GlyphIterator &that, le_uint16 newLookupFlags);
       
    61 
       
    62     virtual ~GlyphIterator();
       
    63 
       
    64     void reset(le_uint16 newLookupFlags, LETag newFeatureTag);
       
    65 
       
    66     le_bool next(le_uint32 delta = 1);
       
    67     le_bool prev(le_uint32 delta = 1);
       
    68     le_bool findFeatureTag();
       
    69 
       
    70     le_bool isRightToLeft() const;
       
    71     le_bool ignoresMarks() const;
       
    72 
       
    73     le_bool baselineIsLogicalEnd() const;
       
    74 
       
    75     LEGlyphID getCurrGlyphID() const;
       
    76     le_int32  getCurrStreamPosition() const;
       
    77 
       
    78     le_int32  getMarkComponent(le_int32 markPosition) const;
       
    79     le_bool   findMark2Glyph();
       
    80 
       
    81     void getCursiveEntryPoint(LEPoint &entryPoint) const;
       
    82     void getCursiveExitPoint(LEPoint &exitPoint) const;
       
    83 
       
    84     void setCurrGlyphID(TTGlyphID glyphID);
       
    85     void setCurrStreamPosition(le_int32 position);
       
    86     void setCurrGlyphBaseOffset(le_int32 baseOffset);
       
    87     void adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
       
    88                                            float xAdvanceAdjust,   float yAdvanceAdjust);
       
    89 
       
    90     void setCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
       
    91                                         float xAdvanceAdjust,   float yAdvanceAdjust);
       
    92 
       
    93     void setCursiveEntryPoint(LEPoint &entryPoint);
       
    94     void setCursiveExitPoint(LEPoint &exitPoint);
       
    95     void setCursiveGlyph();
       
    96 
       
    97     LEGlyphID *insertGlyphs(le_int32 count);
       
    98     le_int32 applyInsertions();
       
    99 
       
   100 private:
       
   101     le_bool filterGlyph(le_uint32 index) const;
       
   102     le_bool hasFeatureTag() const;
       
   103     le_bool nextInternal(le_uint32 delta = 1);
       
   104     le_bool prevInternal(le_uint32 delta = 1);
       
   105 
       
   106     le_int32  direction;
       
   107     le_int32  position;
       
   108     le_int32  nextLimit;
       
   109     le_int32  prevLimit;
       
   110 
       
   111     LEGlyphStorage &glyphStorage;
       
   112     GlyphPositionAdjustments *glyphPositionAdjustments;
       
   113 
       
   114     le_int32    srcIndex;
       
   115     le_int32    destIndex;
       
   116     le_uint16   lookupFlags;
       
   117     FeatureMask featureMask;
       
   118 
       
   119     const GlyphClassDefinitionTable *glyphClassDefinitionTable;
       
   120     const MarkAttachClassDefinitionTable *markAttachClassDefinitionTable;
       
   121 
       
   122     GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class
       
   123 };
       
   124 
       
   125 #endif