Minor
This commit is contained in:
parent
abcfe9b59b
commit
b6f902a1a9
|
@ -115,11 +115,11 @@ struct _hb_font_t {
|
||||||
|
|
||||||
|
|
||||||
/* Convert from font-space to user-space */
|
/* Convert from font-space to user-space */
|
||||||
inline hb_position_t scale_x (int16_t v) { return scale (v, this->x_scale); }
|
inline hb_position_t em_scale_x (int16_t v) { return em_scale (v, this->x_scale); }
|
||||||
inline hb_position_t scale_y (int16_t v) { return scale (v, this->y_scale); }
|
inline hb_position_t em_scale_y (int16_t v) { return em_scale (v, this->y_scale); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline hb_position_t scale (int16_t v, int scale) { return v * (int64_t) scale / this->face->upem; }
|
inline hb_position_t em_scale (int16_t v, int scale) { return v * (int64_t) scale / this->face->upem; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ struct CaretValueFormat1
|
||||||
private:
|
private:
|
||||||
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
|
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
|
||||||
{
|
{
|
||||||
return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->scale_x (coordinate) : font->scale_y (coordinate);
|
return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate) : font->em_scale_y (coordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
|
@ -146,8 +146,8 @@ struct CaretValueFormat3
|
||||||
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
|
inline int get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
|
||||||
{
|
{
|
||||||
return HB_DIRECTION_IS_HORIZONTAL (direction) ?
|
return HB_DIRECTION_IS_HORIZONTAL (direction) ?
|
||||||
font->scale_x (coordinate) + (this+deviceTable).get_x_delta (font) :
|
font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) :
|
||||||
font->scale_y (coordinate) + (this+deviceTable).get_y_delta (font);
|
font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
|
|
|
@ -105,10 +105,10 @@ struct ValueFormat : USHORT
|
||||||
if (!format) return;
|
if (!format) return;
|
||||||
|
|
||||||
/* design units -> fractional pixel */
|
/* design units -> fractional pixel */
|
||||||
if (format & xPlacement) glyph_pos.x_offset += font->scale_x (get_short (values++));
|
if (format & xPlacement) glyph_pos.x_offset += font->em_scale_x (get_short (values++));
|
||||||
if (format & yPlacement) glyph_pos.y_offset += font->scale_y (get_short (values++));
|
if (format & yPlacement) glyph_pos.y_offset += font->em_scale_y (get_short (values++));
|
||||||
if (format & xAdvance) glyph_pos.x_advance += font->scale_x (get_short (values++));
|
if (format & xAdvance) glyph_pos.x_advance += font->em_scale_x (get_short (values++));
|
||||||
if (format & yAdvance) glyph_pos.y_advance += font->scale_y (get_short (values++));
|
if (format & yAdvance) glyph_pos.y_advance += font->em_scale_y (get_short (values++));
|
||||||
|
|
||||||
if (!has_device ()) return;
|
if (!has_device ()) return;
|
||||||
|
|
||||||
|
@ -212,8 +212,8 @@ struct AnchorFormat1
|
||||||
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
|
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
|
||||||
hb_position_t *x, hb_position_t *y) const
|
hb_position_t *x, hb_position_t *y) const
|
||||||
{
|
{
|
||||||
*x = font->scale_x (xCoordinate);
|
*x = font->em_scale_x (xCoordinate);
|
||||||
*y = font->scale_y (yCoordinate);
|
*y = font->em_scale_y (yCoordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
|
@ -244,8 +244,8 @@ struct AnchorFormat2
|
||||||
|
|
||||||
if (x_ppem || y_ppem)
|
if (x_ppem || y_ppem)
|
||||||
ret = hb_font_get_contour_point (font, anchorPoint, glyph_id, &cx, &cy);
|
ret = hb_font_get_contour_point (font, anchorPoint, glyph_id, &cx, &cy);
|
||||||
*x = x_ppem && ret ? cx : font->scale_x (xCoordinate);
|
*x = x_ppem && ret ? cx : font->em_scale_x (xCoordinate);
|
||||||
*y = y_ppem && ret ? cy : font->scale_y (yCoordinate);
|
*y = y_ppem && ret ? cy : font->em_scale_y (yCoordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool sanitize (hb_sanitize_context_t *c) {
|
inline bool sanitize (hb_sanitize_context_t *c) {
|
||||||
|
@ -270,8 +270,8 @@ struct AnchorFormat3
|
||||||
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
|
inline void get_anchor (hb_font_t *font, hb_codepoint_t glyph_id HB_UNUSED,
|
||||||
hb_position_t *x, hb_position_t *y) const
|
hb_position_t *x, hb_position_t *y) const
|
||||||
{
|
{
|
||||||
*x = font->scale_x (xCoordinate);
|
*x = font->em_scale_x (xCoordinate);
|
||||||
*y = font->scale_y (yCoordinate);
|
*y = font->em_scale_y (yCoordinate);
|
||||||
|
|
||||||
/* pixel -> fractional pixel */
|
/* pixel -> fractional pixel */
|
||||||
if (font->x_ppem)
|
if (font->x_ppem)
|
||||||
|
|
Loading…
Reference in New Issue