jdk/src/share/native/sun/font/layout/MarkToBasePosnSubtables.cpp
changeset 7486 6a36b1ebc620
parent 5506 202f599c92aa
child 16891 91e99bed64ae
equal deleted inserted replaced
7485:e9e65ce0013a 7486:6a36b1ebc620
    23  *
    23  *
    24  */
    24  */
    25 
    25 
    26 /*
    26 /*
    27  *
    27  *
    28  * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
    28  * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
    29  *
    29  *
    30  */
    30  */
    31 
    31 
    32 #include "LETypes.h"
    32 #include "LETypes.h"
    33 #include "LEFontInstance.h"
    33 #include "LEFontInstance.h"
   106     float anchorDiffY = baseAnchor.fY - markAnchor.fY;
   106     float anchorDiffY = baseAnchor.fY - markAnchor.fY;
   107 
   107 
   108     glyphIterator->setCurrGlyphBaseOffset(baseIterator.getCurrStreamPosition());
   108     glyphIterator->setCurrGlyphBaseOffset(baseIterator.getCurrStreamPosition());
   109 
   109 
   110     if (glyphIterator->isRightToLeft()) {
   110     if (glyphIterator->isRightToLeft()) {
       
   111         // FIXME: need similar patch to below; also in MarkToLigature and MarkToMark
       
   112         // (is there a better way to approach this for all the cases?)
   111         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX, anchorDiffY, -markAdvance.fX, -markAdvance.fY);
   113         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX, anchorDiffY, -markAdvance.fX, -markAdvance.fY);
   112     } else {
   114     } else {
   113         LEPoint baseAdvance;
   115         LEPoint baseAdvance;
   114 
   116 
   115         fontInstance->getGlyphAdvance(baseGlyph, pixels);
   117         fontInstance->getGlyphAdvance(baseGlyph, pixels);
       
   118 
       
   119         //JK: adjustment needs to account for non-zero advance of any marks between base glyph and current mark
       
   120         GlyphIterator gi(baseIterator, (le_uint16)0); // copy of baseIterator that won't ignore marks
       
   121         gi.next(); // point beyond the base glyph
       
   122         while (gi.getCurrStreamPosition() < glyphIterator->getCurrStreamPosition()) { // for all intervening glyphs (marks)...
       
   123             LEGlyphID otherMark = gi.getCurrGlyphID();
       
   124             LEPoint px;
       
   125             fontInstance->getGlyphAdvance(otherMark, px); // get advance, in case it's non-zero
       
   126             pixels.fX += px.fX; // and add that to the base glyph's advance
       
   127             pixels.fY += px.fY;
       
   128             gi.next();
       
   129         }
       
   130         // end of JK patch
       
   131 
   116         fontInstance->pixelsToUnits(pixels, baseAdvance);
   132         fontInstance->pixelsToUnits(pixels, baseAdvance);
   117 
   133 
   118         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - baseAdvance.fX, anchorDiffY - baseAdvance.fY, -markAdvance.fX, -markAdvance.fY);
   134         glyphIterator->setCurrGlyphPositionAdjustment(anchorDiffX - baseAdvance.fX, anchorDiffY - baseAdvance.fY, -markAdvance.fX, -markAdvance.fY);
   119     }
   135     }
   120 
   136