[buffer] Add hb_buffer_[sg]et_not_found_variation_selector_glyph()

Unused.
pull/4870/head
Behdad Esfahbod 5 months ago
parent 6fd76e1f67
commit a003890e84
  1. 41
      src/hb-buffer.cc
  2. 7
      src/hb-buffer.h
  3. 1
      src/hb-buffer.hh
  4. 7
      src/hb-ot-shape-normalize.cc
  5. 1
      src/hb-ot-shape-normalize.hh

@ -271,6 +271,7 @@ hb_buffer_t::similar (const hb_buffer_t &src)
replacement = src.replacement;
invisible = src.invisible;
not_found = src.not_found;
not_found_variation_selector = src.not_found_variation_selector;
}
void
@ -283,6 +284,7 @@ hb_buffer_t::reset ()
replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
invisible = 0;
not_found = 0;
not_found_variation_selector = HB_CODEPOINT_INVALID;
clear ();
}
@ -705,6 +707,7 @@ DEFINE_NULL_INSTANCE (hb_buffer_t) =
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
0, /* invisible */
0, /* not_found */
HB_CODEPOINT_INVALID, /* not_found_variation_selector */
HB_BUFFER_CONTENT_TYPE_INVALID,
@ -1360,6 +1363,44 @@ hb_buffer_get_not_found_glyph (const hb_buffer_t *buffer)
return buffer->not_found;
}
/**
* hb_buffer_set_not_found_variation_selector_glyph:
* @buffer: An #hb_buffer_t
* @not_found_variation_selector: the not-found-variation-selector #hb_codepoint_t
*
* Sets the #hb_codepoint_t that replaces variation-selector characters not resolved
* in the font during shaping.
*
* The not-found-variation-selector glyph defaults to #HB_CODEPOINT_INVALID,
* in which case it will be removed from the glyph string during shaping.
* This API allows for changing that and retaining the glyph.
*
* XSince: REPLACEME
**/
void
hb_buffer_set_not_found_variation_selector_glyph (hb_buffer_t *buffer,
hb_codepoint_t not_found_variation_selector)
{
buffer->not_found_variation_selector = not_found_variation_selector;
}
/**
* hb_buffer_get_not_found_variation_selector_glyph:
* @buffer: An #hb_buffer_t
*
* See hb_buffer_set_not_found_variation_selector_glyph().
*
* Return value:
* The @buffer not-found-variation-selector #hb_codepoint_t
*
* XSince: REPLACEME
**/
hb_codepoint_t
hb_buffer_get_not_found_variation_selector_glyph (const hb_buffer_t *buffer)
{
return buffer->not_found_variation_selector;
}
/**
* hb_buffer_set_random_state:
* @buffer: An #hb_buffer_t

@ -487,6 +487,13 @@ hb_buffer_set_not_found_glyph (hb_buffer_t *buffer,
HB_EXTERN hb_codepoint_t
hb_buffer_get_not_found_glyph (const hb_buffer_t *buffer);
HB_EXTERN void
hb_buffer_set_not_found_variation_selector_glyph (hb_buffer_t *buffer,
hb_codepoint_t not_found_variation_selector);
HB_EXTERN hb_codepoint_t
hb_buffer_get_not_found_variation_selector_glyph (const hb_buffer_t *buffer);
HB_EXTERN void
hb_buffer_set_random_state (hb_buffer_t *buffer,
unsigned state);

@ -80,6 +80,7 @@ struct hb_buffer_t
hb_codepoint_t replacement; /* U+FFFD or something else. */
hb_codepoint_t invisible; /* 0 or something else. */
hb_codepoint_t not_found; /* 0 or something else. */
hb_codepoint_t not_found_variation_selector; /* HB_CODEPOINT_INVALID or something else. */
/*
* Buffer contents

@ -153,7 +153,7 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
hb_codepoint_t u = buffer->cur().codepoint;
hb_codepoint_t glyph = 0;
if (shortest && c->font->get_nominal_glyph (u, &glyph, c->not_found))
if (shortest && c->font->get_nominal_glyph (u, &glyph, buffer->not_found))
{
next_char (buffer, glyph);
return;
@ -165,7 +165,7 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
return;
}
if (!shortest && c->font->get_nominal_glyph (u, &glyph, c->not_found))
if (!shortest && c->font->get_nominal_glyph (u, &glyph, buffer->not_found))
{
next_char (buffer, glyph);
return;
@ -295,7 +295,8 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
buffer,
font,
buffer->unicode,
buffer->not_found,
plan->shaper->decompose ? plan->shaper->decompose : hb_ot_shape_normalize_context_t::decompose_unicode,
plan->shaper->compose ? plan->shaper->compose : hb_ot_shape_normalize_context_t::compose_unicode
};
c.override_decompose_and_compose (plan->shaper->decompose, plan->shaper->compose);

@ -89,7 +89,6 @@ struct hb_ot_shape_normalize_context_t
hb_buffer_t *buffer;
hb_font_t *font;
hb_unicode_funcs_t *unicode;
const hb_codepoint_t not_found;
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t ab,
hb_codepoint_t *a,

Loading…
Cancel
Save