Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions harfrust_capi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ HarfRust is a shaping library, so anything outside shaping is absent:

- Drawing and painting callbacks (`hb_draw_funcs_t`, `hb_paint_funcs_t`).
- Subsetting.
- Other layout table introspection (`hb_ot_layout_*`), and the `hb_set` /
`hb_map` containers it reports through.
- Layout queries beyond the available GSUB/GPOS presence, lookup count, and
glyph collection functions; and the `hb_map` container.
- Custom Unicode callbacks (`hb_unicode_funcs_t`); HarfRust's own Unicode data
is always used.
- `hb_buffer_diff`, buffer message callbacks, and `hb_font_get_glyph_name`.
Expand Down
15 changes: 15 additions & 0 deletions harfrust_capi/include/hr-hb.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@
#define hb_ot_layout_get_baseline_with_fallback hr_ot_layout_get_baseline_with_fallback
#define hb_ot_layout_get_baseline_with_fallback2 hr_ot_layout_get_baseline_with_fallback2
#define hb_ot_layout_get_horizontal_baseline_tag_for_script hr_ot_layout_get_horizontal_baseline_tag_for_script
#define hb_ot_layout_has_positioning hr_ot_layout_has_positioning
#define hb_ot_layout_has_substitution hr_ot_layout_has_substitution
#define hb_ot_layout_lookup_collect_glyphs hr_ot_layout_lookup_collect_glyphs
#define hb_ot_layout_table_get_lookup_count hr_ot_layout_table_get_lookup_count
#define hb_ot_math_constant_t hr_ot_math_constant_t
#define hb_ot_math_get_constant hr_ot_math_get_constant
#define hb_ot_math_get_glyph_assembly hr_ot_math_get_glyph_assembly
Expand Down Expand Up @@ -238,6 +242,17 @@
#define hb_segment_properties_hash hr_segment_properties_hash
#define hb_segment_properties_overlay hr_segment_properties_overlay
#define hb_segment_properties_t hr_segment_properties_t
#define hb_set_add hr_set_add
#define hb_set_clear hr_set_clear
#define hb_set_create hr_set_create
#define hb_set_destroy hr_set_destroy
#define hb_set_get_empty hr_set_get_empty
#define hb_set_get_user_data hr_set_get_user_data
#define hb_set_has hr_set_has
#define hb_set_is_empty hr_set_is_empty
#define hb_set_reference hr_set_reference
#define hb_set_set_user_data hr_set_set_user_data
#define hb_set_t hr_set_t
#define hb_shape hr_shape
#define hb_shape_full hr_shape_full
#define hb_shape_list_shapers hr_shape_list_shapers
Expand Down
97 changes: 97 additions & 0 deletions harfrust_capi/include/hr.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ typedef struct hr_font_t hr_font_t;
*/
typedef struct hr_language_impl_t hr_language_impl_t;

typedef struct hr_set_t hr_set_t;

/**
* A reusable plan for shaping text with given properties.
*/
Expand Down Expand Up @@ -3486,6 +3488,45 @@ void hr_font_funcs_set_glyph_extents_func(struct hr_font_funcs_t *ffuncs,
void *user_data,
hr_destroy_func_t destroy);

/**
* Returns whether the face has a readable GSUB table.
*
* # Safety
* `face` must be `NULL` or live.
*/
hr_bool_t hr_ot_layout_has_substitution(struct hr_face_t *face);

/**
* Returns whether the face has a readable GPOS table.
*
* # Safety
* `face` must be `NULL` or live.
*/
hr_bool_t hr_ot_layout_has_positioning(struct hr_face_t *face);

/**
* Returns the number of lookups in GSUB or GPOS.
*
* # Safety
* `face` must be `NULL` or live.
*/
unsigned int hr_ot_layout_table_get_lookup_count(struct hr_face_t *face, hr_tag_t table_tag);

/**
* Collects glyphs touched by one GSUB or GPOS lookup into the supplied sets.
* Forms not yet enumerated conservatively include every OpenType glyph ID.
*
* # Safety
* `face` and each non-`NULL` set must be live. Output sets may be the same.
*/
void hr_ot_layout_lookup_collect_glyphs(struct hr_face_t *face,
hr_tag_t table_tag,
unsigned int lookup_index,
struct hr_set_t *glyphs_before,
struct hr_set_t *glyphs_input,
struct hr_set_t *glyphs_after,
struct hr_set_t *glyphs_output);

/**
* Returns the dominant horizontal baseline for a Unicode script.
*/
Expand Down Expand Up @@ -3638,6 +3679,62 @@ unsigned int hr_ot_math_get_glyph_assembly(struct hr_font_t *font,
struct hr_ot_math_glyph_part_t *parts,
hr_position_t *italics_correction);

struct hr_set_t *hr_set_create(void);

struct hr_set_t *hr_set_get_empty(void);

/**
* # Safety
* `set` must be `NULL` or live.
*/
struct hr_set_t *hr_set_reference(struct hr_set_t *set);

/**
* # Safety
* `set` must be `NULL` or live, and the caller must own its reference.
*/
void hr_set_destroy(struct hr_set_t *set);

/**
* # Safety
* `set` must be `NULL` or live, and `key` must outlive it.
*/
hr_bool_t hr_set_set_user_data(struct hr_set_t *set,
const struct hr_user_data_key_t *key,
void *data,
hr_destroy_func_t destroy,
hr_bool_t replace);

/**
* # Safety
* `set` must be `NULL` or live.
*/
void *hr_set_get_user_data(struct hr_set_t *set, const struct hr_user_data_key_t *key);

/**
* # Safety
* `set` must be `NULL` or live.
*/
void hr_set_clear(struct hr_set_t *set);

/**
* # Safety
* `set` must be `NULL` or live.
*/
void hr_set_add(struct hr_set_t *set, hr_codepoint_t value);

/**
* # Safety
* `set` must be `NULL` or live.
*/
hr_bool_t hr_set_has(const struct hr_set_t *set, hr_codepoint_t value);

/**
* # Safety
* `set` must be `NULL` or live.
*/
hr_bool_t hr_set_is_empty(const struct hr_set_t *set);

/**
* Shapes a buffer with a font, applying the given features.
*
Expand Down
8 changes: 5 additions & 3 deletions harfrust_capi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ as HarfBuzz itself without collisions.
# Scope

This covers shaping: blobs, faces, fonts, buffers and `hr_shape`, plus OpenType
`BASE` baseline and `MATH` queries. It has no drawing or painting callbacks, no
subsetting, no other layout table introspection and no `hb_set` / `hb_map`
containers, because HarfRust does not provide them.
`BASE` baseline and `MATH` queries. It also provides the layout lookup queries
and sets used to inspect glyph participation. Drawing and painting callbacks,
subsetting, and maps are outside this API.

# Object lifetime

Expand All @@ -38,6 +38,7 @@ pub mod object;
pub mod ot_layout;
pub mod ot_math;
mod plan;
pub mod set;
pub mod shape;
pub mod shape_plan;

Expand All @@ -50,6 +51,7 @@ pub use font_funcs::*;
pub use object::{hr_destroy_func_t, hr_user_data_key_t};
pub use ot_layout::*;
pub use ot_math::*;
pub use set::*;
pub use shape::*;
pub use shape_plan::*;

Expand Down
Loading
Loading