Update of /cvsroot/silgraphite/silgraphite/src/GrEngine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19623/src/GrEngine Modified Files: Tag: v2api GrSlotState.cpp GrSlotState.h GrSlotStream.cpp GrSlotStream.h GrTableManager.cpp Log Message: Fixed bug in positioning mechanism (showed up in justified Burmese). Index: GrSlotState.cpp =================================================================== RCS file: /cvsroot/silgraphite/silgraphite/src/GrEngine/GrSlotState.cpp,v retrieving revision 1.16.2.1 retrieving revision 1.16.2.2 diff -u -d -r1.16.2.1 -r1.16.2.2 --- GrSlotState.cpp 27 Oct 2004 14:32:02 -0000 1.16.2.1 +++ GrSlotState.cpp 27 May 2005 18:18:27 -0000 1.16.2.2 @@ -760,6 +760,7 @@ else { Assert(m_fShiftMod); + EnsureLocalAttachmentTree(ptman, psstrmIn, psstrmOut, islotThis); ZapMetricsAndPositionDownToBase(psstrmOut); ZapMetricsOfLeaves(psstrmOut); } @@ -776,6 +777,26 @@ } /*---------------------------------------------------------------------------------------------- + The shift attribute of a slot has been modified. Make sure any slots that are part of the + same attachment cluster are local to this stream. The reason for this is so that the + position calculations stay consistent within the stream. +----------------------------------------------------------------------------------------------*/ +void GrSlotState::EnsureLocalAttachmentTree(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis) +{ + if (m_dislotRootFixed) + { + GrSlotState * pslotRoot = SlotAtOffset(psstrmOut, m_dislotRootFixed); + psstrmOut->EnsureLocalCopy(ptman, pslotRoot, psstrmIn); + } + for (size_t islot = 0; islot < m_vdislotAttLeaves.size(); islot++) + { + GrSlotState * pslotLeaf = SlotAtOffset(psstrmOut, m_vdislotAttLeaves[islot]); + psstrmOut->EnsureLocalCopy(ptman, pslotLeaf, psstrmIn); + } +} + +/*---------------------------------------------------------------------------------------------- The recipient slot is being attached to the argument slot. NOTE: the caller is responsible to zap the cached positions of following glyphs in the stream. Index: GrSlotState.h =================================================================== RCS file: /cvsroot/silgraphite/silgraphite/src/GrEngine/GrSlotState.h,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -u -d -r1.14.2.1 -r1.14.2.2 --- GrSlotState.h 27 Oct 2004 14:32:02 -0000 1.14.2.1 +++ GrSlotState.h 27 May 2005 18:18:27 -0000 1.14.2.2 @@ -948,6 +948,9 @@ GrSlotState * SlotAtOffset(GrSlotStream * psstrm, int dislot); // ENHANCE SharonC: inline? + void EnsureLocalAttachmentTree(GrTableManager * ptman, + GrSlotStream * psstrmIn, GrSlotStream * psstrmOut, int islotThis); + void ZapCompositeMetrics() { m_nCompositeLevel = kNegInfinity; Index: GrSlotStream.cpp =================================================================== RCS file: /cvsroot/silgraphite/silgraphite/src/GrEngine/GrSlotStream.cpp,v retrieving revision 1.18.2.1 retrieving revision 1.18.2.2 diff -u -d -r1.18.2.1 -r1.18.2.2 --- GrSlotStream.cpp 27 Oct 2004 14:32:02 -0000 1.18.2.1 +++ GrSlotStream.cpp 27 May 2005 18:18:27 -0000 1.18.2.2 @@ -1463,6 +1463,44 @@ } /*---------------------------------------------------------------------------------------------- + Make sure the stream contains a local instance of the given slot, not a copy used by + a previous pass. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot, + GrSlotStream * psstrmIn) +{ + //Assert(m_vpslot[islot + m_cslotPreSeg] == pslot); + Assert(pslot->PassModified() <= m_ipass); + + if (pslot->PassModified() < m_ipass) + { + int islot = pslot->PosPassIndex(); + Assert(SlotAtPosPassIndex(islot) == pslot); + GrSlotState * pslotNew; + ptman->State()->NewSlotCopy(pslot, m_ipass, &pslotNew); + m_vpslot[islot + m_cslotPreSeg] = pslotNew; + + psstrmIn->ReplaceSlotInReprocessBuffer(pslot, pslotNew); + } +} + +/*---------------------------------------------------------------------------------------------- + A slot has been replace within the coorsponding output stream. Make sure the reprocess + buffer of this stream constains the same slot. +----------------------------------------------------------------------------------------------*/ +void GrSlotStream::ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew) +{ + if (m_islotReprocPos > -1) + { + for (size_t islot = 0; islot < m_vpslotReproc.size(); islot++) + { + if (m_vpslotReproc[islot] == pslotOld) + m_vpslotReproc[islot] = pslotNew; + } + } +} + +/*---------------------------------------------------------------------------------------------- Inserting a line break can potentially alter the directionality of preceeding glyphs. Zap the information that has been calculated. Index: GrSlotStream.h =================================================================== RCS file: /cvsroot/silgraphite/silgraphite/src/GrEngine/GrSlotStream.h,v retrieving revision 1.12 retrieving revision 1.12.2.1 diff -u -d -r1.12 -r1.12.2.1 --- GrSlotStream.h 6 Oct 2004 18:28:31 -0000 1.12 +++ GrSlotStream.h 27 May 2005 18:18:27 -0000 1.12.2.1 @@ -356,6 +356,9 @@ void AdjustPrevStreamNextChunkMap(GrTableManager * ptman, int islotMod, int nInc); void AdjustNextChunkMap(int islotMin, int islotMod, int nInc); + void EnsureLocalCopy(GrTableManager * ptman, GrSlotState * pslot, GrSlotStream * psstrmIn); + void ReplaceSlotInReprocessBuffer(GrSlotState * pslotOld, GrSlotState * pslotNew); + void ZapCalculatedDirLevels(int islotLB); int MaxClusterSlot(int islotChunkLim) Index: GrTableManager.cpp =================================================================== RCS file: /cvsroot/silgraphite/silgraphite/src/GrEngine/GrTableManager.cpp,v retrieving revision 1.23.2.1 retrieving revision 1.23.2.2 diff -u -d -r1.23.2.1 -r1.23.2.2 --- GrTableManager.cpp 27 Oct 2004 14:32:02 -0000 1.23.2.1 +++ GrTableManager.cpp 27 May 2005 18:18:27 -0000 1.23.2.2 @@ -64,7 +64,8 @@ m_xsPosXNext(0), m_ysPosYNext(0), m_dxsTotWidthSoFar(0), - m_dxsVisWidthSoFar(0) + m_dxsVisWidthSoFar(0), + m_cpass(0) { m_vslotblk.clear(); m_vprgnSlotVarLenBufs.clear(); |