diff options
author | Jonathan Kew <jfkthame@googlemail.com> | 2008-02-08 17:28:24 +0000 |
---|---|---|
committer | Jonathan Kew <jfkthame@googlemail.com> | 2008-02-08 17:28:24 +0000 |
commit | d930e60f53da36d97d91f77e00d01c242f4aba37 (patch) | |
tree | 10508a97e179a73aaca1fcc9d79a3de24026bfd4 /Build/source/libs/graphite-engine/include | |
parent | fcfc8e4880e9573c7c7e54476667079a8269f0fb (diff) |
graphite update (synch with XeTeX repository rev.562)
git-svn-id: svn://tug.org/texlive/trunk@6568 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/graphite-engine/include')
8 files changed, 357 insertions, 92 deletions
diff --git a/Build/source/libs/graphite-engine/include/Makefile.am b/Build/source/libs/graphite-engine/include/Makefile.am index cba5cff10eb..83286118d8d 100644 --- a/Build/source/libs/graphite-engine/include/Makefile.am +++ b/Build/source/libs/graphite-engine/include/Makefile.am @@ -18,6 +18,7 @@ graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGraphiteProcess.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrEngine.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/IGrJustifier.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/ITextSource.h +graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/MemoryUsage.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentAux.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/Segment.h graphiteinclude_HEADERS += $(top_srcdir)/include/graphite/SegmentPainter.h diff --git a/Build/source/libs/graphite-engine/include/graphite/FileFont.h b/Build/source/libs/graphite-engine/include/graphite/FileFont.h index cffef0b79bc..bbb26266c71 100644 --- a/Build/source/libs/graphite-engine/include/graphite/FileFont.h +++ b/Build/source/libs/graphite-engine/include/graphite/FileFont.h @@ -209,7 +209,7 @@ public: m_yScale = scaleFromDpi(dpi); } - bool isValid() { return m_isValid; }; + bool isValid() { return m_fIsValid; }; protected: /** Default constructor is not used */ FileFont(); @@ -225,10 +225,11 @@ protected: // pixel-coord = design-coord * pixels-per-em / font-em-square float scaleFromDpi(int dpi) { - return (dpi * m_pointSize) / (72.0f * m_emSquare); + return (dpi * m_pointSize) / (72.0f * m_mEmSquare); } + // Member variables: - FILE *m_file; + FILE * m_pfile; unsigned long m_clrFore; unsigned long m_clrBack; @@ -238,14 +239,14 @@ protected: FontTableCache * m_pTableCache; // KRS: I think these should be cached otherwise Segment::LineContextSegment doesn't work - float m_ascent; - float m_descent; - float m_emSquare; + float m_mAscent; + float m_mDescent; + float m_mEmSquare; float m_pointSize; int m_dpiX; int m_dpiY; - bool m_isValid; - std::wstring m_faceName; + bool m_fIsValid; + std::wstring m_stuFaceName; byte * m_pHeader; byte * m_pTableDir; float m_xScale; diff --git a/Build/source/libs/graphite-engine/include/graphite/Font.h b/Build/source/libs/graphite-engine/include/graphite/Font.h index ef8fead89ec..64f62b3ff62 100644 --- a/Build/source/libs/graphite-engine/include/graphite/Font.h +++ b/Build/source/libs/graphite-engine/include/graphite/Font.h @@ -30,6 +30,7 @@ class FeatureSettingIterator; class Segment; class LayoutEnvironment; class ITextSource; +class FontMemoryUsage; typedef struct tagFontProps { @@ -211,6 +212,7 @@ class Font { friend class FeatureSettingIterator; friend class FeatLabelLangIterator; friend class LanguageIterator; + friend class FontMemoryUsage; public: virtual ~Font(); @@ -342,6 +344,9 @@ public: // Debugging: //static bool DbgCheckFontCache(); + static FontMemoryUsage calculateMemoryUsage(); + ///FontMemoryUsage calculateMemoryUsage(bool fBold = false, bool fItalic = false); + public: // For use in segment creation: void RenderLineFillSegment(Segment * pseg, ITextSource * pts, LayoutEnvironment & layout, @@ -355,7 +360,7 @@ protected: Font(); Font(const Font &); - FontFace & fontFace(); + FontFace & fontFace(bool fDumbFallback = false); // Feature access: FeatureIterator BeginFeature(); @@ -388,10 +393,22 @@ protected: private: FontFace * m_pfface; // set up with Graphite tables - void initialiseFontFace(); + + // Cache of common tables: + const void * m_pHead; + const void * m_pHmtx; + const void * m_pLoca; + const void * m_pGlyf; + size_t m_cbHmtxSize; + size_t m_cbLocaSize; + bool m_fTablesCached; + + void initialiseFontFace(bool fDumbFallback); + void EnsureTablesCached(); }; -inline Font::Font() : m_pfface(0) { } +inline Font::Font() : m_pfface(0), m_fTablesCached(false) +{ } } // namespace gr diff --git a/Build/source/libs/graphite-engine/include/graphite/GrFeature.h b/Build/source/libs/graphite-engine/include/graphite/GrFeature.h index ee7376fe1c4..4cc396a11d9 100644 --- a/Build/source/libs/graphite-engine/include/graphite/GrFeature.h +++ b/Build/source/libs/graphite-engine/include/graphite/GrFeature.h @@ -135,6 +135,8 @@ class GrIStream; class GrLangTable { + friend class FontMemoryUsage; + public: GrLangTable() { @@ -185,6 +187,7 @@ protected: data16 padBIG; }; FeatSet * m_prgfset; + int m_cfset; // needed for memory instrumentation only int FindIndex(isocode lgcode); }; diff --git a/Build/source/libs/graphite-engine/include/graphite/MemoryUsage.h b/Build/source/libs/graphite-engine/include/graphite/MemoryUsage.h new file mode 100644 index 00000000000..d59ff165f75 --- /dev/null +++ b/Build/source/libs/graphite-engine/include/graphite/MemoryUsage.h @@ -0,0 +1,156 @@ +/*--------------------------------------------------------------------*//*:Ignore this sentence. +Copyright (C) 2007 SIL International. All rights reserved. + +Distributable under the terms of either the Common Public License or the +GNU Lesser General Public License, as specified in the LICENSING.txt file. + +File: MemoryUsage.h +Responsibility: Sharon Correll +Last reviewed: not yet + +Description: + Data structures to hold the calculations for memory usage. +----------------------------------------------------------------------------------------------*/ + +#ifdef _MSC_VER +#pragma once +#endif +#ifndef MEMORYUSAGE_INCLUDED +#define MEMORYUSAGE_INCLUDED + +//:End Ignore + + +namespace gr +{ + +/*---------------------------------------------------------------------------------------------- + A data structure that holds information about the memory usage for font/engine objects +----------------------------------------------------------------------------------------------*/ +class FontMemoryUsage +{ + friend class FontCache; + friend class FontFace; + +public: + FontMemoryUsage() + { + initialize(); + } + void addEngine(GrEngine * pgreng); + void prettyPrint(std::ostream & strm); + +protected: + // member variables: + std::vector<size_t> vFontTotalsReg; + std::vector<size_t> vFontTotalsBold; + std::vector<size_t> vFontTotalsItalic; + std::vector<size_t> vFontTotalsBI; + std::vector<std::string> vstrFontNames; + std::vector<size_t> vFaceCount; + + size_t font; + size_t fontCache; + size_t fontFace; + + size_t eng_count; + size_t eng_overhead; + size_t eng_scalars; + size_t eng_strings; + size_t eng_pointers; + size_t eng_cmap; + size_t eng_nameTable; + + size_t pseudoMap; + + size_t clstbl_counters; + size_t clstbl_offsets; + size_t clstbl_glyphList; + + size_t glftbl_general; + size_t glftbl_compDefns; + size_t glftbl_attrTable; + size_t glftbl_attrOffsets; + + size_t lngtbl_general; + size_t lngtbl_entries; + size_t lngtbl_featureSets; + + size_t tman_general; + + size_t pass_count; + size_t pass_general; + size_t pass_fsm; + size_t pass_ruleExtras; + size_t pass_constraintOffsets; + size_t pass_constraintCode; + size_t pass_actionOffsets; + size_t pass_actionCode; + + size_t engst_general; + size_t engst_passState; + + size_t sstrm_count; + size_t sstrm_general; + size_t sstrm_chunkMapsUsed; + size_t sstrm_chunkMapsAlloc; + size_t sstrm_reprocBuf; + + size_t slot_count; + size_t slot_general; + size_t slot_abstract; + size_t slot_varLenBuf; + size_t slot_assocsUsed; + size_t slot_assocsAlloc; + size_t slot_attachUsed; + size_t slot_attachAlloc; + + // methods: + void initialize(); + int total(); + void add(FontMemoryUsage & fmu); +}; + +/*---------------------------------------------------------------------------------------------- + A data structure that holds information about the memory usage for segment objects. +----------------------------------------------------------------------------------------------*/ +class SegmentMemoryUsage +{ +public: + SegmentMemoryUsage() + { + initialize(); + } + void addSegment(Segment & seg); + void prettyPrint(std::ostream & strm); + +protected: + // member variables: + size_t seg_count; + size_t overhead; + size_t pointers; + size_t scalars; + size_t strings; + size_t metrics; + size_t associations; + size_t init; + size_t obsolete; + + size_t slot_count; + size_t slot_abstract; + size_t slot_varLenBuf; + size_t slot_scalars; + size_t slot_clusterMembers; + + size_t glyphInfo_count; + size_t glyphInfo; + + size_t wastedVector; // allocated space that is not used in vectors + + // methods: + void initialize(); +}; + +} // namespace gr + +#endif // !MEMORYUSAGE_INCLUDED diff --git a/Build/source/libs/graphite-engine/include/graphite/Segment.h b/Build/source/libs/graphite-engine/include/graphite/Segment.h index 4730db6b086..04c510e3488 100644 --- a/Build/source/libs/graphite-engine/include/graphite/Segment.h +++ b/Build/source/libs/graphite-engine/include/graphite/Segment.h @@ -26,11 +26,10 @@ Description: //:End Ignore -class GrEngine; - namespace gr { - +class GrEngine; +class SegmentMemoryUsage; class IGrJustifier; class GrTableManager; @@ -51,6 +50,7 @@ class Segment friend class GlyphInfo; friend class GlyphIterator; friend class GlyphSetIterator; + friend class SegmentMemoryUsage; public: // Static methods @@ -155,7 +155,7 @@ public: m_cslotRestartBackup = cslotRestartBackup; m_vnSkipOffsets.resize(vnSkipOffsets.size()); for (size_t i = 0; i < vnSkipOffsets.size(); i++) - m_vnSkipOffsets[i] = vnSkipOffsets[i]; + m_vnSkipOffsets[i] = sdata8(vnSkipOffsets[i]); } int NextRestartBackup() { @@ -163,11 +163,12 @@ public: } int RestartBackup() { - return (m_psegPrev)? m_psegPrev->NextRestartBackup(): 0; + //return (m_psegPrev)? m_psegPrev->NextRestartBackup(): 0; + return 0; } int SkipOffset(int ipass) { - return m_vnSkipOffsets[ipass]; + return int(m_vnSkipOffsets[ipass]); } DirCode PreviousStrongDir() { @@ -204,9 +205,9 @@ public: void SetFaceName(std::wstring stu, std::wstring stuBase) { - m_stuFaceName = stu; - m_stuBaseFaceName = stuBase; - m_fUseSepBase = (m_stuBaseFaceName.size() > 0); +// m_stuFaceName = stu; +// m_stuBaseFaceName = stuBase; +// m_fUseSepBase = (m_stuBaseFaceName.size() > 0); } void SetEngine(GrEngine * pgreng); @@ -239,6 +240,19 @@ public: void MarkSlotInPrevSeg(int ichw, int islot); void MarkSlotInNextSeg(int ichw, int islot); + void CleanUpAssocsVectors() + { + for (int iv = 0; iv < m_ichwAssocsLim - m_ichwAssocsMin; iv++) + { + std::vector<int> * pvislout = m_prgpvisloutAssocs[iv]; + if (pvislout->size() <= 1) + { + delete pvislout; + *(m_prgpvisloutAssocs + iv) = NULL; + } + } + } + GrSlotOutput * OutputSlot(int islout); void RecordInitializationForNextSeg(int cbNextSegDat, byte * pbNextSegDat) @@ -302,12 +316,17 @@ public: Rect ComponentRect(GrSlotOutput * pslout, int icomp); + void ClusterMembersForGlyph(int islout, int disloutCluster, std::vector<int> & visloutRet); + // for transduction logging: // implementations are empty unless TRACING is defined void LogUnderlyingToSurface(GrTableManager * ptman, std::ostream & strmOut, GrCharStream * pchstrm); void LogSurfaceToUnderlying(GrTableManager * ptman, std::ostream & strmOut); + // calculate memory usage + void calculateMemoryUsage(SegmentMemoryUsage & smu); + protected: // Member variables: long m_cref; // standard COM ref count @@ -340,17 +359,17 @@ protected: int m_dichPreContext; // what part of this segment affects the previous; // not really used for anything right now - Segment * m_psegPrev; // OBSOLETE - Segment * m_psegNext; +// Segment * m_psegPrev; // OBSOLETE +// Segment * m_psegNext; // Font information: - std::wstring m_stuFaceName; - std::wstring m_stuBaseFaceName; - bool m_fUseSepBase; +// std::wstring m_stuFaceName; +// std::wstring m_stuBaseFaceName; +// bool m_fUseSepBase; - float m_pixHeight; // character height of font in pixels (NOT = ascent + descent) - bool m_fBold; - bool m_fItalic; +// float m_pixHeight; // character height of font in pixels (NOT = ascent + descent) +// bool m_fBold; +// bool m_fItalic; LineBrk m_lbStart; LineBrk m_lbEnd; @@ -366,8 +385,8 @@ protected: float m_dysFontAscent; float m_dysFontDescent; float m_xysEmSquare; // em-square of the font in display units - float m_xsDPI; // DPI of device on which segment was measured - float m_ysDPI; +// float m_xsDPI; // DPI of device on which segment was measured +// float m_ysDPI; float m_dxsStretch; // difference between actual and natural width float m_dxsWidth; // width in absence of any stretch. -1 if not computed. @@ -404,23 +423,23 @@ protected: // Underlying-to-surface associations: int * m_prgisloutBefore; // logical first int * m_prgisloutAfter; // logical last - std::vector<int> * m_prgvisloutAssocs; // all; used by range selections + std::vector<int> ** m_prgpvisloutAssocs; // all; used by range selections int * m_prgisloutLigature; // similar to above, index of associated ligature, or kNegInfinity - int * m_prgiComponent; // component of the ligature that the corresponding character + sdata8 * m_prgiComponent; // component of the ligature that the corresponding character // represents; only meaningful if corresponding item in // m_prgisloutLigature is set - GrSlotStream * m_psstrm; // TODO: rework to remove this +// GrSlotStream * m_psstrm; // TODO: rework to remove this int m_cslout; GrSlotOutput * m_prgslout; // final output slots u_intslot * m_prgnSlotVarLenBuf; // var-length buffer for slots--one big buffer managed by the // segment, but pointed to by the slots - int m_cnUserDefn; +// int m_cnUserDefn; // this information is not stored in the segment itself int m_cnCompPerLig; - int m_cnFeat; +// int m_cnFeat; // this information is not stored in the segment itself int m_cginf; int m_isloutGinf0; // islout index for m_prgginf[0]; @@ -434,7 +453,7 @@ protected: // input that need to be reprocessed when starting // the next segment - std::vector<int> m_vnSkipOffsets; // skip offset for each pass when restarting + std::vector<sdata8> m_vnSkipOffsets; // skip offset for each pass when restarting DirCode m_dircPrevStrong; // previous strong directionality code DirCode m_dircPrevTerm; // previous terminator code, if any @@ -447,8 +466,8 @@ protected: void ComputeDimensions(); - void SetUpGlyphInfo(GrTableManager * ptman, gid16 chwLB, int nDirDepth, - int islotMin, int cslot); + void SetUpGlyphInfo(GrTableManager * ptman, GrSlotStream * psstrmFinal, + gid16 chwLB, int nDirDepth, int islotMin, int cslot); void SetUpLigInfo(GrTableManager * ptman, GlyphInfo & ginf, GrSlotOutput * pslout); void InitBeforeArrayFromPrevSeg(); // obsolete @@ -468,7 +487,7 @@ protected: int UnderlyingToPhysicalSurface(int ichw, bool fBefore); int LogicalToPhysicalSurface(int islout); void UnderlyingToPhysicalAssocs(int ichw, std::vector<int> & viginf); - std::vector<int> * UnderlyingToLogicalAssocs(int ichw); + std::vector<int> UnderlyingToLogicalAssocs(int ichw); int UnderlyingToLogicalInThisSeg(int ichw); bool SameSurfaceGlyphs(int ichw1, int ichw2); diff --git a/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h b/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h index 0b07d8b3e32..293ba291436 100644 --- a/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h +++ b/Build/source/libs/graphite-engine/include/graphite/SegmentAux.h @@ -105,11 +105,11 @@ protected: }; inline Segment & GlyphInfo::segment() throw () { - return *m_pseg; + return * m_pseg; } inline const Segment & GlyphInfo::segment() const throw () { - return *m_pseg; + return * m_pseg; } @@ -123,8 +123,8 @@ class GlyphIterator friend class GlyphInfo; friend class Segment; - // Pointers into the glyph infor store - GlyphInfo * _itr; + // Pointers into the glyph info store + GlyphInfo * m_pginf; protected: // Constructor @@ -132,39 +132,39 @@ protected: public: // Default constructor. - GlyphIterator() throw (): _itr(0) {} + GlyphIterator() throw (): m_pginf(0) {} explicit GlyphIterator(const GlyphSetIterator &); // Forward iterator requirements. - reference operator*() const { assert(_itr); return *_itr; } - pointer operator->() const { return _itr; } - GlyphIterator & operator++() throw() { ++_itr; return *this; } - GlyphIterator operator++(int) throw() { GlyphIterator tmp = *this; operator++(); return tmp; } + reference operator*() const { assert(m_pginf != 0); return *m_pginf; } + pointer operator->() const { return m_pginf; } + GlyphIterator & operator++() throw() { ++m_pginf; return *this; } + GlyphIterator operator++(int) throw() { GlyphIterator tmp = *this; operator++(); return tmp; } // Bidirectional iterator requirements - GlyphIterator & operator--() throw() { --_itr; return *this; } - GlyphIterator operator--(int) throw() { GlyphIterator tmp = *this; operator--(); return tmp; } + GlyphIterator & operator--() throw() { --m_pginf; return *this; } + GlyphIterator operator--(int) throw() { GlyphIterator tmp = *this; operator--(); return tmp; } // Random access iterator requirements - reference operator[](difference_type n) const { return _itr[n]; } - GlyphIterator & operator+=(difference_type n) throw() { _itr += n; return *this; } - GlyphIterator operator+(difference_type n) const throw() { GlyphIterator r = *this; return r += n; } - GlyphIterator & operator-=(difference_type n) throw() { _itr -= n; return *this; } - GlyphIterator operator-(difference_type n) const throw() { GlyphIterator r = *this; return r += -n; } + reference operator[](difference_type n) const { return m_pginf[n]; } + GlyphIterator & operator+=(difference_type n) throw() { m_pginf += n; return *this; } + GlyphIterator operator+(difference_type n) const throw() { GlyphIterator r = *this; return r += n; } + GlyphIterator & operator-=(difference_type n) throw() { m_pginf -= n; return *this; } + GlyphIterator operator-(difference_type n) const throw() { GlyphIterator r = *this; return r += -n; } // Relational operators. // Forward iterator requirements - bool operator==(const GlyphIterator & rhs) const throw() { return _itr == rhs._itr; } - bool operator!=(const GlyphIterator & rhs) const throw() { return !(*this == rhs); } + bool operator==(const GlyphIterator & rhs) const throw() { return m_pginf == rhs.m_pginf; } + bool operator!=(const GlyphIterator & rhs) const throw() { return !(*this == rhs); } // Random access iterator requirements - bool operator<(const GlyphIterator & rhs) const throw() { return _itr < rhs._itr; } - bool operator>(const GlyphIterator & rhs) const throw() { return _itr > rhs._itr; } - bool operator<=(const GlyphIterator & rhs) const throw() { return !(*this > rhs); } - bool operator>=(const GlyphIterator & rhs) const throw() { return !(*this < rhs); } + bool operator<(const GlyphIterator & rhs) const throw() { return m_pginf < rhs.m_pginf; } + bool operator>(const GlyphIterator & rhs) const throw() { return m_pginf > rhs.m_pginf; } + bool operator<=(const GlyphIterator & rhs) const throw() { return !(*this > rhs); } + bool operator>=(const GlyphIterator & rhs) const throw() { return !(*this < rhs); } - difference_type operator-(const GlyphIterator & rhs) const throw() { return _itr - rhs._itr; } + difference_type operator-(const GlyphIterator & rhs) const throw() { return m_pginf - rhs.m_pginf; } }; inline GlyphIterator operator+(const GlyphIterator::difference_type n, const GlyphIterator & rhs) @@ -174,6 +174,40 @@ inline GlyphIterator operator+(const GlyphIterator::difference_type n, const Gly /*---------------------------------------------------------------------------------------------- + This reference-counted vector is used as the basis of GlyphSetIterator. This is because + multiple iterators are based on the same vector, so it needs to hang around appropriately. +----------------------------------------------------------------------------------------------*/ +class RcVector +{ + friend class GlyphSetIterator; + +public: + RcVector(std::vector<int> & vn) + { + m_vn = vn; + m_cref = 0; + } + +protected: + void IncRefCount() const + { + m_cref++; + } + void DecRefCount() const + { + m_cref--; + if (m_cref <= 0) + delete this; + } + + const std::vector<int> & Vector() const { return m_vn; }; + + // member variables: + mutable int m_cref; + std::vector<int> m_vn; +}; + +/*---------------------------------------------------------------------------------------------- The GlyphSetIterator class allows the Graphite client to iterate over a non-contiguous set of glyphs for the segment, this is almost always the set of glyphs for a character. ----------------------------------------------------------------------------------------------*/ @@ -184,54 +218,87 @@ class GlyphSetIterator friend class Segment; // Segment containing the glyphs being iterated over. - const Segment * _seg_ptr; + const Segment * m_pseg; // Sometimes, in the case of character-to-glyph look-ups or attached // children, we need to represent a non-contiguous list; in these cases // we first map through a vector of output-slot objects into the actual // glyph-info store. - std::vector<int>::const_iterator _itr; + std::vector<int>::const_iterator m_vit; + + // Store a reliable copy of the vector we are iterating over: + const RcVector * m_qvislout; protected: // Constructor that includes output-slot mapping list, used for non-contiguous lists: - GlyphSetIterator(Segment & seg, size_t islout, const std::vector<int> & vislout) - : _seg_ptr(&seg), _itr(vislout.begin() + islout) - {} - + GlyphSetIterator(Segment & seg, size_t islout, RcVector * qvislout) + : m_pseg(&seg), m_vit(qvislout->Vector().begin() + islout) + { + m_qvislout = qvislout; + m_qvislout->IncRefCount(); + } public: // Default constructor--no output-slot mapping: - GlyphSetIterator() throw (): _seg_ptr(0), _itr(std::vector<int>::const_iterator()) - {} + GlyphSetIterator() throw() : m_pseg(0), m_vit(std::vector<int>::const_iterator()) + { + m_qvislout = NULL; + } + + // Copy constructor: + GlyphSetIterator(const GlyphSetIterator & sit) throw() + { + m_pseg = sit.m_pseg; + m_vit = sit.m_vit; + m_qvislout = sit.m_qvislout; + if (m_qvislout) + m_qvislout->IncRefCount(); + } + // Assignment operator: + GlyphSetIterator & operator=(const GlyphSetIterator & sit) throw() + { + m_pseg = sit.m_pseg; + m_vit = sit.m_vit; + m_qvislout = sit.m_qvislout; + if (m_qvislout) + m_qvislout->IncRefCount(); + return *this; + } + // Destructor: + ~GlyphSetIterator() + { + if (m_qvislout) + m_qvislout->DecRefCount(); + } // Forward iterator requirements. - reference operator*() const; - pointer operator->() const { return &(operator*()); } - GlyphSetIterator & operator++() throw() { ++_itr; return *this; } - GlyphSetIterator operator++(int) throw() { GlyphSetIterator tmp = *this; operator++(); return tmp; } + reference operator*() const; + pointer operator->() const { return &(operator*()); } + GlyphSetIterator & operator++() throw() { ++m_vit; return *this; } + GlyphSetIterator operator++(int) throw() { GlyphSetIterator tmp = *this; operator++(); return tmp; } // Bidirectional iterator requirements - GlyphSetIterator & operator--() throw() { --_itr; return *this; } - GlyphSetIterator operator--(int) throw() { GlyphSetIterator tmp = *this; operator--(); return tmp; } + GlyphSetIterator & operator--() throw() { --m_vit; return *this; } + GlyphSetIterator operator--(int) throw() { GlyphSetIterator tmp = *this; operator--(); return tmp; } // Random access iterator requirements - reference operator[](difference_type n) const { return *operator+(n); } - GlyphSetIterator & operator+=(difference_type n) throw() { _itr += n; return *this; } - GlyphSetIterator operator+(difference_type n) const throw() { GlyphSetIterator r = *this; return r += n; } - GlyphSetIterator & operator-=(difference_type n) throw() { operator+=(-n); return *this; } - GlyphSetIterator operator-(difference_type n) const throw() { GlyphSetIterator r = *this; return r += -n; } + reference operator[](difference_type n) const { return *operator+(n); } + GlyphSetIterator & operator+=(difference_type n) throw() { m_vit += n; return *this; } + GlyphSetIterator operator+(difference_type n) const throw() { GlyphSetIterator r = *this; return r += n; } + GlyphSetIterator & operator-=(difference_type n) throw() { operator+=(-n); return *this; } + GlyphSetIterator operator-(difference_type n) const throw() { GlyphSetIterator r = *this; return r += -n; } // Relational operators. // Forward iterator requirements - bool operator==(const GlyphSetIterator & rhs) const throw() { return _itr == rhs._itr; } - bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); } + bool operator==(const GlyphSetIterator & rhs) const throw() { return m_vit == rhs.m_vit; } + bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); } // Random access iterator requirements - bool operator<(const GlyphSetIterator & rhs) const throw() { return _itr < rhs._itr; } - bool operator>(const GlyphSetIterator & rhs) const throw() { return _itr > rhs._itr; } - bool operator<=(const GlyphSetIterator & rhs) const throw() { return !(*this > rhs); } - bool operator>=(const GlyphSetIterator & rhs) const throw() { return !(*this < rhs); } + bool operator<(const GlyphSetIterator & rhs) const throw() { return m_vit < rhs.m_vit; } + bool operator>(const GlyphSetIterator & rhs) const throw() { return m_vit > rhs.m_vit; } + bool operator<=(const GlyphSetIterator & rhs) const throw() { return !(*this > rhs); } + bool operator>=(const GlyphSetIterator & rhs) const throw() { return !(*this < rhs); } - difference_type operator-(const GlyphSetIterator & rhs) const throw() { return _itr - rhs._itr; } + difference_type operator-(const GlyphSetIterator & rhs) const throw() { return m_vit - rhs.m_vit; } }; inline GlyphSetIterator operator+(const GlyphSetIterator::difference_type n, const GlyphSetIterator & rhs) @@ -285,7 +352,7 @@ public: inline void setTrailingWs(TrWsHandling twsh) { m_twsh = twsh; } inline void setLoggingStream(std::ostream * pstrm) { m_pstrmLog = pstrm; } inline void setDumbFallback(bool f) { m_fDumbFallback = f; } - inline void setPrevSegment(Segment * pseg) { m_psegPrev = pseg; } + inline void setPrevSegment(Segment * pseg) { m_psegPrev = pseg; } inline void setSegmentForInit(Segment * pseg) { m_psegInit = pseg; } inline void setJustifier(IGrJustifier * pjust) { m_pjust = pjust; } diff --git a/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h b/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h index caa7d445690..29564a6c63d 100644 --- a/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h +++ b/Build/source/libs/graphite-engine/include/graphite/SegmentPainter.h @@ -26,7 +26,8 @@ Description: namespace gr { - class Segment; +class Segment; + /*---------------------------------------------------------------------------------------------- A SegmentPainter handles the UI-related operations on for segment. @@ -82,14 +83,12 @@ public: int charIndex, bool assocPrevMatch, bool assocPrevNeeded, int anchorIndex, bool movingRight, bool * inThisSeg); - // For calculating underlines: struct LineSeg { // hungarian: ls float left; float right; }; - static float ScaleX(float xs, Rect rs, Rect rd); static float ScaleY(float ys, Rect rs, Rect rd); @@ -157,6 +156,8 @@ protected: float * pxsBefore, float ysBeforeTop, float ysBeforeBottom, float * pxsAfter, float ysAfterTop, float ysAfterBottom); bool AtEdgeOfCluster(GrSlotOutput * pslout, int islout, bool fBefore); + bool AtEdgeOfCluster(GrSlotOutput * psloutBase, int isloutBase, + GrSlotOutput * pslout, int islout, bool fBefore); bool CanInsertIntoCluster(GrSlotOutput * pslout, int islout); void CalcPartialLigatures(bool * prgfAllSelected, |