2
* @(#)AnchorTables.cpp 1.6 00/03/15
4
* (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved
9
#include "LEFontInstance.h"
10
#include "DeviceTables.h"
11
#include "AnchorTables.h"
16
void AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance,
17
LEPoint &anchor) const
19
switch(SWAPW(anchorFormat)) {
22
const Format1AnchorTable *f1 = (const Format1AnchorTable *) this;
24
f1->getAnchor(fontInstance, anchor);
30
const Format2AnchorTable *f2 = (const Format2AnchorTable *) this;
32
f2->getAnchor(glyphID, fontInstance, anchor);
38
const Format3AnchorTable *f3 = (const Format3AnchorTable *) this;
40
f3->getAnchor(fontInstance, anchor);
49
void Format1AnchorTable::getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const
51
le_int16 x = SWAPW(xCoordinate);
52
le_int16 y = SWAPW(yCoordinate);
55
fontInstance->transformFunits(x, y, pixels);
57
fontInstance->pixelsToUnits(pixels, anchor);
60
void Format2AnchorTable::getAnchor(LEGlyphID glyphID, const LEFontInstance *fontInstance, LEPoint &anchor) const
64
if (! fontInstance->getGlyphPoint(glyphID, SWAPW(anchorPoint), point)) {
65
le_int16 x = SWAPW(xCoordinate);
66
le_int16 y = SWAPW(yCoordinate);
68
fontInstance->transformFunits(x, y, point);
72
fontInstance->pixelsToUnits(point, anchor);
75
void Format3AnchorTable::getAnchor(const LEFontInstance *fontInstance, LEPoint &anchor) const
77
le_int16 x = SWAPW(xCoordinate);
78
le_int16 y = SWAPW(yCoordinate);
80
Offset dtxOffset = SWAPW(xDeviceTableOffset);
81
Offset dtyOffset = SWAPW(yDeviceTableOffset);
83
fontInstance->transformFunits(x, y, pixels);
86
const DeviceTable *dtx = (const DeviceTable *) ((char *) this + dtxOffset);
87
le_int16 adjx = dtx->getAdjustment((le_int16) fontInstance->getXPixelsPerEm());
93
const DeviceTable *dty = (const DeviceTable *) ((char *) this + dtyOffset);
94
le_int16 adjy = dty->getAdjustment((le_int16) fontInstance->getYPixelsPerEm());
99
fontInstance->pixelsToUnits(pixels, anchor);