commit
1fdf046427
|
@ -80,6 +80,24 @@ struct SinglePosFormat1
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
position_single (hb_font_t *font,
|
||||||
|
hb_direction_t direction,
|
||||||
|
hb_codepoint_t gid,
|
||||||
|
hb_glyph_position_t &pos) const
|
||||||
|
{
|
||||||
|
unsigned int index = (this+coverage).get_coverage (gid);
|
||||||
|
if (likely (index == NOT_COVERED)) return false;
|
||||||
|
|
||||||
|
/* This is ugly... */
|
||||||
|
hb_buffer_t buffer;
|
||||||
|
buffer.props.direction = direction;
|
||||||
|
OT::hb_ot_apply_context_t c (1, font, &buffer);
|
||||||
|
|
||||||
|
valueFormat.apply_value (&c, this, values, pos);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Iterator,
|
template<typename Iterator,
|
||||||
typename SrcLookup,
|
typename SrcLookup,
|
||||||
hb_requires (hb_is_iterator (Iterator))>
|
hb_requires (hb_is_iterator (Iterator))>
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct SinglePosFormat2
|
||||||
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);
|
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);
|
||||||
if (likely (index == NOT_COVERED)) return_trace (false);
|
if (likely (index == NOT_COVERED)) return_trace (false);
|
||||||
|
|
||||||
if (likely (index >= valueCount)) return_trace (false);
|
if (unlikely (index >= valueCount)) return_trace (false);
|
||||||
|
|
||||||
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
|
if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
|
||||||
{
|
{
|
||||||
|
@ -92,6 +92,28 @@ struct SinglePosFormat2
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
position_single (hb_font_t *font,
|
||||||
|
hb_direction_t direction,
|
||||||
|
hb_codepoint_t gid,
|
||||||
|
hb_glyph_position_t &pos) const
|
||||||
|
{
|
||||||
|
unsigned int index = (this+coverage).get_coverage (gid);
|
||||||
|
if (likely (index == NOT_COVERED)) return false;
|
||||||
|
if (unlikely (index >= valueCount)) return false;
|
||||||
|
|
||||||
|
/* This is ugly... */
|
||||||
|
hb_buffer_t buffer;
|
||||||
|
buffer.props.direction = direction;
|
||||||
|
OT::hb_ot_apply_context_t c (1, font, &buffer);
|
||||||
|
|
||||||
|
valueFormat.apply_value (&c, this,
|
||||||
|
&values[index * valueFormat.get_len ()],
|
||||||
|
pos);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Iterator,
|
template<typename Iterator,
|
||||||
typename SrcLookup,
|
typename SrcLookup,
|
||||||
hb_requires (hb_is_iterator (Iterator))>
|
hb_requires (hb_is_iterator (Iterator))>
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
#define HB_NO_LANGUAGE_PRIVATE_SUBTAG
|
#define HB_NO_LANGUAGE_PRIVATE_SUBTAG
|
||||||
#define HB_NO_LAYOUT_FEATURE_PARAMS
|
#define HB_NO_LAYOUT_FEATURE_PARAMS
|
||||||
#define HB_NO_LAYOUT_COLLECT_GLYPHS
|
#define HB_NO_LAYOUT_COLLECT_GLYPHS
|
||||||
|
#define HB_NO_LAYOUT_RARELY_USED
|
||||||
#define HB_NO_LAYOUT_UNUSED
|
#define HB_NO_LAYOUT_UNUSED
|
||||||
#define HB_NO_MATH
|
#define HB_NO_MATH
|
||||||
#define HB_NO_META
|
#define HB_NO_META
|
||||||
|
|
|
@ -1709,6 +1709,8 @@ hb_ot_layout_get_size_params (hb_face_t *face,
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hb_ot_layout_feature_get_name_ids:
|
* hb_ot_layout_feature_get_name_ids:
|
||||||
* @face: #hb_face_t to work upon
|
* @face: #hb_face_t to work upon
|
||||||
|
@ -2341,6 +2343,7 @@ struct hb_get_glyph_alternates_dispatch_t :
|
||||||
( _dispatch (obj, hb_prioritize, std::forward<Ts> (ds)...) )
|
( _dispatch (obj, hb_prioritize, std::forward<Ts> (ds)...) )
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef HB_NO_LAYOUT_RARELY_USED
|
||||||
/**
|
/**
|
||||||
* hb_ot_layout_lookup_get_glyph_alternates:
|
* hb_ot_layout_lookup_get_glyph_alternates:
|
||||||
* @face: a face.
|
* @face: a face.
|
||||||
|
@ -2373,4 +2376,72 @@ hb_ot_layout_lookup_get_glyph_alternates (hb_face_t *face,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct hb_position_single_dispatch_t :
|
||||||
|
hb_dispatch_context_t<hb_position_single_dispatch_t, bool>
|
||||||
|
{
|
||||||
|
static return_t default_return_value () { return false; }
|
||||||
|
bool stop_sublookup_iteration (return_t r) const { return r; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
template <typename T, typename ...Ts> auto
|
||||||
|
_dispatch (const T &obj, hb_priority<1>, Ts&&... ds) HB_AUTO_RETURN
|
||||||
|
( obj.position_single (std::forward<Ts> (ds)...) )
|
||||||
|
template <typename T, typename ...Ts> auto
|
||||||
|
_dispatch (const T &obj, hb_priority<0>, Ts&&... ds) HB_AUTO_RETURN
|
||||||
|
( default_return_value () )
|
||||||
|
public:
|
||||||
|
template <typename T, typename ...Ts> auto
|
||||||
|
dispatch (const T &obj, Ts&&... ds) HB_AUTO_RETURN
|
||||||
|
( _dispatch (obj, hb_prioritize, std::forward<Ts> (ds)...) )
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hb_ot_layout_lookup_get_optical_bound:
|
||||||
|
* @face: a font.
|
||||||
|
* @lookup_index: index of the feature lookup to query.
|
||||||
|
* @direction: edge of the glyph to query.
|
||||||
|
* @glyph: a glyph id.
|
||||||
|
*
|
||||||
|
* Fetches the optical bound of a glyph positioned at the margin of text.
|
||||||
|
* The direction identifies which edge of the glyph to query.
|
||||||
|
*
|
||||||
|
* Return value: Adjustment value. Negative values mean the glyph will stick out of the margin.
|
||||||
|
*
|
||||||
|
* Since: REPLACEME
|
||||||
|
**/
|
||||||
|
hb_position_t
|
||||||
|
hb_ot_layout_lookup_get_optical_bound (hb_font_t *font,
|
||||||
|
unsigned lookup_index,
|
||||||
|
hb_direction_t direction,
|
||||||
|
hb_codepoint_t glyph)
|
||||||
|
{
|
||||||
|
const OT::PosLookup &lookup = font->face->table.GPOS->table->get_lookup (lookup_index);
|
||||||
|
hb_glyph_position_t pos = {0};
|
||||||
|
hb_position_single_dispatch_t c;
|
||||||
|
lookup.dispatch (&c, font, direction, glyph, pos);
|
||||||
|
hb_position_t ret = 0;
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case HB_DIRECTION_LTR:
|
||||||
|
ret = pos.x_offset;
|
||||||
|
break;
|
||||||
|
case HB_DIRECTION_RTL:
|
||||||
|
ret = pos.x_advance - pos.x_offset;
|
||||||
|
break;
|
||||||
|
case HB_DIRECTION_TTB:
|
||||||
|
ret = pos.y_offset;
|
||||||
|
break;
|
||||||
|
case HB_DIRECTION_BTT:
|
||||||
|
ret = pos.y_advance - pos.y_offset;
|
||||||
|
break;
|
||||||
|
case HB_DIRECTION_INVALID:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -403,6 +403,16 @@ hb_ot_layout_get_size_params (hb_face_t *face,
|
||||||
unsigned int *range_start, /* OUT. May be NULL */
|
unsigned int *range_start, /* OUT. May be NULL */
|
||||||
unsigned int *range_end /* OUT. May be NULL */);
|
unsigned int *range_end /* OUT. May be NULL */);
|
||||||
|
|
||||||
|
HB_EXTERN hb_position_t
|
||||||
|
hb_ot_layout_lookup_get_optical_bound (hb_font_t *font,
|
||||||
|
unsigned lookup_index,
|
||||||
|
hb_direction_t direction,
|
||||||
|
hb_codepoint_t glyph);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GSUB/GPOS
|
||||||
|
*/
|
||||||
|
|
||||||
HB_EXTERN hb_bool_t
|
HB_EXTERN hb_bool_t
|
||||||
hb_ot_layout_feature_get_name_ids (hb_face_t *face,
|
hb_ot_layout_feature_get_name_ids (hb_face_t *face,
|
||||||
|
@ -423,6 +433,7 @@ hb_ot_layout_feature_get_characters (hb_face_t *face,
|
||||||
unsigned int *char_count /* IN/OUT. May be NULL */,
|
unsigned int *char_count /* IN/OUT. May be NULL */,
|
||||||
hb_codepoint_t *characters /* OUT. May be NULL */);
|
hb_codepoint_t *characters /* OUT. May be NULL */);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BASE
|
* BASE
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue