Fix delta scale, again...
This commit is contained in:
parent
40335d4533
commit
b634beb39e
|
@ -566,6 +566,14 @@ struct ClassDef
|
||||||
|
|
||||||
struct Device
|
struct Device
|
||||||
{
|
{
|
||||||
|
/* XXX speed up */
|
||||||
|
|
||||||
|
inline hb_position_t get_x_delta (hb_ot_layout_context_t *c) const
|
||||||
|
{ return c->font->x_ppem ? get_delta (c->font->x_ppem) * (uint64_t) c->font->x_scale / c->font->x_ppem : 0; }
|
||||||
|
|
||||||
|
inline hb_position_t get_y_delta (hb_ot_layout_context_t *c) const
|
||||||
|
{ return c->font->y_ppem ? get_delta (c->font->y_ppem) * (uint64_t) c->font->y_scale / c->font->y_ppem : 0; }
|
||||||
|
|
||||||
inline int get_delta (unsigned int ppem_size) const
|
inline int get_delta (unsigned int ppem_size) const
|
||||||
{
|
{
|
||||||
unsigned int f = deltaFormat;
|
unsigned int f = deltaFormat;
|
||||||
|
|
|
@ -144,8 +144,7 @@ struct CaretValueFormat3
|
||||||
inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t glyph_id HB_UNUSED) const
|
inline int get_caret_value (hb_ot_layout_context_t *c, hb_codepoint_t glyph_id HB_UNUSED) const
|
||||||
{
|
{
|
||||||
/* TODO vertical */
|
/* TODO vertical */
|
||||||
return c->scale_x (coordinate) +
|
return c->scale_x (coordinate) + ((this+deviceTable).get_x_delta (c));
|
||||||
((this+deviceTable).get_delta (c->font->x_ppem) * c->font->x_scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
|
|
|
@ -112,16 +112,16 @@ struct ValueFormat : USHORT
|
||||||
|
|
||||||
/* pixel -> fractional pixel */
|
/* pixel -> fractional pixel */
|
||||||
if (format & xPlaDevice) {
|
if (format & xPlaDevice) {
|
||||||
if (x_ppem) glyph_pos.x_offset += (base + get_device (values++)).get_delta (x_ppem) * layout->font->x_scale; else values++;
|
if (x_ppem) glyph_pos.x_offset += (base + get_device (values++)).get_x_delta (layout); else values++;
|
||||||
}
|
}
|
||||||
if (format & yPlaDevice) {
|
if (format & yPlaDevice) {
|
||||||
if (y_ppem) glyph_pos.y_offset += (base + get_device (values++)).get_delta (y_ppem) * layout->font->y_scale; else values++;
|
if (y_ppem) glyph_pos.y_offset += (base + get_device (values++)).get_y_delta (layout); else values++;
|
||||||
}
|
}
|
||||||
if (format & xAdvDevice) {
|
if (format & xAdvDevice) {
|
||||||
if (x_ppem) glyph_pos.x_advance += (base + get_device (values++)).get_delta (x_ppem) * layout->font->x_scale; else values++;
|
if (x_ppem) glyph_pos.x_advance += (base + get_device (values++)).get_x_delta (layout); else values++;
|
||||||
}
|
}
|
||||||
if (format & yAdvDevice) {
|
if (format & yAdvDevice) {
|
||||||
if (y_ppem) glyph_pos.y_advance += (base + get_device (values++)).get_delta (y_ppem) * layout->font->y_scale; else values++;
|
if (y_ppem) glyph_pos.y_advance += (base + get_device (values++)).get_y_delta (layout); else values++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,9 +268,9 @@ struct AnchorFormat3
|
||||||
|
|
||||||
/* pixel -> fractional pixel */
|
/* pixel -> fractional pixel */
|
||||||
if (layout->font->x_ppem)
|
if (layout->font->x_ppem)
|
||||||
*x += (this+xDeviceTable).get_delta (layout->font->x_ppem) * layout->font->x_scale;
|
*x += (this+xDeviceTable).get_x_delta (layout);
|
||||||
if (layout->font->y_ppem)
|
if (layout->font->y_ppem)
|
||||||
*y += (this+yDeviceTable).get_delta (layout->font->y_ppem) * layout->font->y_scale;
|
*y += (this+yDeviceTable).get_x_delta (layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ struct hb_ot_layout_context_t
|
||||||
} info;
|
} info;
|
||||||
|
|
||||||
/* Convert from font-space to user-space */
|
/* Convert from font-space to user-space */
|
||||||
/* XXX div-by-zero */
|
/* XXX div-by-zero / speed up */
|
||||||
inline hb_position_t scale_x (int16_t v) { return (int64_t) this->font->x_scale * v / this->face->head_table->unitsPerEm; }
|
inline hb_position_t scale_x (int16_t v) { return (int64_t) this->font->x_scale * v / this->face->head_table->unitsPerEm; }
|
||||||
inline hb_position_t scale_y (int16_t v) { return (int64_t) this->font->y_scale * v / this->face->head_table->unitsPerEm; }
|
inline hb_position_t scale_y (int16_t v) { return (int64_t) this->font->y_scale * v / this->face->head_table->unitsPerEm; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue