/*
*
- * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
*
*/
#include "ValueRecords.h"
#include "DeviceTables.h"
#include "GlyphIterator.h"
-#include "GlyphPositionAdjustments.h"
#include "LESwaps.h"
U_NAMESPACE_BEGIN
return SWAPW(value);
}
-void ValueRecord::adjustPosition(ValueFormat valueFormat, const char *base, GlyphPositionAdjustment &positionAdjustment,
+void ValueRecord::adjustPosition(ValueFormat valueFormat, const char *base, GlyphIterator &glyphIterator,
const LEFontInstance *fontInstance) const
{
+ float xPlacementAdjustment = 0;
+ float yPlacementAdjustment = 0;
+ float xAdvanceAdjustment = 0;
+ float yAdvanceAdjustment = 0;
+
if ((valueFormat & vfbXPlacement) != 0) {
le_int16 value = getFieldValue(valueFormat, vrfXPlacement);
LEPoint pixels;
fontInstance->transformFunits(value, 0, pixels);
- positionAdjustment.adjustXPlacement(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYPlacement(fontInstance->yPixelsToUnits(pixels.fY));
+ xPlacementAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yPlacementAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
if ((valueFormat & vfbYPlacement) != 0) {
fontInstance->transformFunits(0, value, pixels);
- positionAdjustment.adjustXPlacement(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYPlacement(fontInstance->yPixelsToUnits(pixels.fY));
+ xPlacementAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yPlacementAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
if ((valueFormat & vfbXAdvance) != 0) {
fontInstance->transformFunits(value, 0, pixels);
- positionAdjustment.adjustXAdvance(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYAdvance(fontInstance->yPixelsToUnits(pixels.fY));
+ xAdvanceAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yAdvanceAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
if ((valueFormat & vfbYAdvance) != 0) {
fontInstance->transformFunits(0, value, pixels);
- positionAdjustment.adjustXAdvance(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYAdvance(fontInstance->yPixelsToUnits(pixels.fY));
+ xAdvanceAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yAdvanceAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
// FIXME: The device adjustments should really be transformed, but
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 xAdj = dt->getAdjustment(xppem);
- positionAdjustment.adjustXPlacement(fontInstance->xPixelsToUnits(xAdj));
+ xPlacementAdjustment += fontInstance->xPixelsToUnits(xAdj);
}
}
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 yAdj = dt->getAdjustment(yppem);
- positionAdjustment.adjustYPlacement(fontInstance->yPixelsToUnits(yAdj));
+ yPlacementAdjustment += fontInstance->yPixelsToUnits(yAdj);
}
}
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 xAdj = dt->getAdjustment(xppem);
- positionAdjustment.adjustXAdvance(fontInstance->xPixelsToUnits(xAdj));
+ xAdvanceAdjustment += fontInstance->xPixelsToUnits(xAdj);
}
}
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 yAdj = dt->getAdjustment(yppem);
- positionAdjustment.adjustYAdvance(fontInstance->yPixelsToUnits(yAdj));
+ yAdvanceAdjustment += fontInstance->yPixelsToUnits(yAdj);
}
}
}
+
+ glyphIterator.adjustCurrGlyphPositionAdjustment(
+ xPlacementAdjustment, yPlacementAdjustment, xAdvanceAdjustment, yAdvanceAdjustment);
}
-void ValueRecord::adjustPosition(le_int16 index, ValueFormat valueFormat, const char *base, GlyphPositionAdjustment &positionAdjustment,
+void ValueRecord::adjustPosition(le_int16 index, ValueFormat valueFormat, const char *base, GlyphIterator &glyphIterator,
const LEFontInstance *fontInstance) const
{
+ float xPlacementAdjustment = 0;
+ float yPlacementAdjustment = 0;
+ float xAdvanceAdjustment = 0;
+ float yAdvanceAdjustment = 0;
+
if ((valueFormat & vfbXPlacement) != 0) {
le_int16 value = getFieldValue(index, valueFormat, vrfXPlacement);
LEPoint pixels;
fontInstance->transformFunits(value, 0, pixels);
- positionAdjustment.adjustXPlacement(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYPlacement(fontInstance->yPixelsToUnits(pixels.fY));
+ xPlacementAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yPlacementAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
if ((valueFormat & vfbYPlacement) != 0) {
fontInstance->transformFunits(0, value, pixels);
- positionAdjustment.adjustXPlacement(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYPlacement(fontInstance->yPixelsToUnits(pixels.fY));
+ xPlacementAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yPlacementAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
if ((valueFormat & vfbXAdvance) != 0) {
fontInstance->transformFunits(value, 0, pixels);
- positionAdjustment.adjustXAdvance(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYAdvance(fontInstance->yPixelsToUnits(pixels.fY));
+ xAdvanceAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yAdvanceAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
if ((valueFormat & vfbYAdvance) != 0) {
fontInstance->transformFunits(0, value, pixels);
- positionAdjustment.adjustXAdvance(fontInstance->xPixelsToUnits(pixels.fX));
- positionAdjustment.adjustYAdvance(fontInstance->yPixelsToUnits(pixels.fY));
+ xAdvanceAdjustment += fontInstance->xPixelsToUnits(pixels.fX);
+ yAdvanceAdjustment += fontInstance->yPixelsToUnits(pixels.fY);
}
// FIXME: The device adjustments should really be transformed, but
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 xAdj = dt->getAdjustment(xppem);
- positionAdjustment.adjustXAdvance(fontInstance->xPixelsToUnits(xAdj));
+ xPlacementAdjustment += fontInstance->xPixelsToUnits(xAdj);
}
}
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 yAdj = dt->getAdjustment(yppem);
- positionAdjustment.adjustYAdvance(fontInstance->yPixelsToUnits(yAdj));
+ yPlacementAdjustment += fontInstance->yPixelsToUnits(yAdj);
}
}
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 xAdj = dt->getAdjustment(xppem);
- positionAdjustment.adjustXAdvance(fontInstance->xPixelsToUnits(xAdj));
+ xAdvanceAdjustment += fontInstance->xPixelsToUnits(xAdj);
}
}
const DeviceTable *dt = (const DeviceTable *) (base + dtOffset);
le_int16 yAdj = dt->getAdjustment(yppem);
- positionAdjustment.adjustYAdvance(fontInstance->yPixelsToUnits(yAdj));
+ yAdvanceAdjustment += fontInstance->yPixelsToUnits(yAdj);
}
}
}
+
+ glyphIterator.adjustCurrGlyphPositionAdjustment(
+ xPlacementAdjustment, yPlacementAdjustment, xAdvanceAdjustment, yAdvanceAdjustment);
}
le_int16 ValueRecord::getSize(ValueFormat valueFormat)