void
adjust_anchor (OTF_Anchor *anchor, FT_Face ft_face,
- unsigned code, int size, int *x, int *y)
+ unsigned code, int x_ppem, int y_ppem, int *x, int *y)
{
if (anchor->AnchorFormat == 2)
{
outline = &ft_face->glyph->outline;
if (ap < outline->n_points)
{
- *x = outline->points[ap].x;
- *y = outline->points[ap].y;
+ *x = outline->points[ap].x << 6;
+ *y = outline->points[ap].y << 6;
}
}
else if (anchor->AnchorFormat == 3)
{
if (anchor->f.f2.XDeviceTable.offset)
- *x += DEVICE_DELTA (anchor->f.f2.XDeviceTable, size);
+ *x += (DEVICE_DELTA (anchor->f.f2.XDeviceTable, x_ppem)) << 6;
if (anchor->f.f2.YDeviceTable.offset)
- *y += DEVICE_DELTA (anchor->f.f2.YDeviceTable, size);
+ *y += (DEVICE_DELTA (anchor->f.f2.YDeviceTable, y_ppem)) << 6;
}
}
if (gpos_features)
{
- int u;
- int size10, size;
+ FT_Face face;
MGlyph *base = NULL, *mark = NULL;
+ int x_ppem, y_ppem, x_scale, y_scale;
if (OTF_drive_gpos (otf, &otf_gstring, script, langsys, gpos_features)
< 0)
return to;
- u = otf->head->unitsPerEm;
- size10 = rfont->spec.size;
- size = size10 / 10;
+ face = ((MRealizedFontFT *) rfont->info)->ft_face;
+ x_ppem = face->size->metrics.x_ppem;
+ y_ppem = face->size->metrics.y_ppem;
+ x_scale = face->size->metrics.x_scale;
+ y_scale = face->size->metrics.y_scale;
for (i = 0, otfg = otf_gstring.glyphs, g = MGLYPH (gidx);
i < otf_gstring.used; i++, otfg++, g++)
int format = otfg->f.f1.format;
if (format & OTF_XPlacement)
- g->xoff = otfg->f.f1.value->XPlacement * size10 / u / 10;
+ g->xoff = otfg->f.f1.value->XPlacement * x_scale / 0x400000;
if (format & OTF_XPlaDevice)
- g->xoff += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, size);
+ g->xoff
+ += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem);
if (format & OTF_YPlacement)
- g->yoff = - (otfg->f.f1.value->YPlacement * size10 / u / 10);
+ g->yoff
+ = - (otfg->f.f1.value->YPlacement * y_scale / 0x400000);
if (format & OTF_YPlaDevice)
- g->yoff -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, size);
+ g->yoff
+ -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem);
if (format & OTF_XAdvance)
- g->width += otfg->f.f1.value->XAdvance * size10 / u / 10;
+ g->width
+ += otfg->f.f1.value->XAdvance * x_scale / 0x400000;
if (format & OTF_XAdvDevice)
- g->width += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, size);
+ g->width
+ += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, y_ppem);
}
break;
case 3:
{
int base_x, base_y, mark_x, mark_y;
- base_x = otfg->f.f4.base_anchor->XCoordinate * size10 / u / 10;
- base_y = otfg->f.f4.base_anchor->YCoordinate * size10 / u / 10;
- mark_x = otfg->f.f4.mark_anchor->XCoordinate * size10 / u / 10;
- mark_y = otfg->f.f4.mark_anchor->YCoordinate * size10 / u / 10;
+ base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000;
+ base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000;
+ mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000;
+ mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000;
if (otfg->f.f4.base_anchor->AnchorFormat != 1)
adjust_anchor (otfg->f.f4.base_anchor, rfont->fontp,
- prev->code, size, &base_x, &base_y);
+ prev->code, x_ppem, y_ppem, &base_x, &base_y);
if (otfg->f.f4.mark_anchor->AnchorFormat != 1)
adjust_anchor (otfg->f.f4.mark_anchor, rfont->fontp,
- g->code, size, &mark_x, &mark_y);
- g->xoff = prev->xoff + (base_x - prev->width) - mark_x;
- g->yoff = prev->yoff + mark_y - base_y;
+ g->code, x_ppem, y_ppem, &mark_x, &mark_y);
+ g->xoff = prev->xoff - prev->width + ((base_x - mark_x) >> 6);
+ g->yoff = prev->yoff + ((mark_y - base_y) >> 6);
g->combining_code = MAKE_PRECOMPUTED_COMBINDING_CODE ();
}
}