< prev index next >
src/java.desktop/share/native/libfontmanager/harfbuzz/hb-shape-plan.cc
Print this page
*** 22,49 ****
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
#include "hb-shape-plan-private.hh"
#include "hb-shaper-private.hh"
#include "hb-font-private.hh"
#include "hb-buffer-private.hh"
- #ifndef HB_DEBUG_SHAPE_PLAN
- #define HB_DEBUG_SHAPE_PLAN (HB_DEBUG+0)
- #endif
-
-
- #define HB_SHAPER_IMPLEMENT(shaper) \
- HB_SHAPER_DATA_ENSURE_DECLARE(shaper, face) \
- HB_SHAPER_DATA_ENSURE_DECLARE(shaper, font)
- #include "hb-shaper-list.hh"
- #undef HB_SHAPER_IMPLEMENT
-
-
static void
hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
const hb_feature_t *user_features,
unsigned int num_user_features,
const int *coords,
--- 22,39 ----
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Google Author(s): Behdad Esfahbod
*/
+ #include "hb-private.hh"
+ #include "hb-debug.hh"
#include "hb-shape-plan-private.hh"
#include "hb-shaper-private.hh"
#include "hb-font-private.hh"
#include "hb-buffer-private.hh"
static void
hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
const hb_feature_t *user_features,
unsigned int num_user_features,
const int *coords,
*** 120,130 ****
unsigned int num_user_features,
const char * const *shaper_list)
{
return hb_shape_plan_create2 (face, props,
user_features, num_user_features,
! NULL, 0,
shaper_list);
}
hb_shape_plan_t *
hb_shape_plan_create2 (hb_face_t *face,
--- 110,120 ----
unsigned int num_user_features,
const char * const *shaper_list)
{
return hb_shape_plan_create2 (face, props,
user_features, num_user_features,
! nullptr, 0,
shaper_list);
}
hb_shape_plan_t *
hb_shape_plan_create2 (hb_face_t *face,
*** 133,152 ****
unsigned int num_user_features,
const int *orig_coords,
unsigned int num_coords,
const char * const *shaper_list)
{
! DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
"face=%p num_features=%d num_coords=%d shaper_list=%p",
face,
num_user_features,
num_coords,
shaper_list);
hb_shape_plan_t *shape_plan;
! hb_feature_t *features = NULL;
! int *coords = NULL;
if (unlikely (!face))
face = hb_face_get_empty ();
if (unlikely (!props))
return hb_shape_plan_get_empty ();
--- 123,142 ----
unsigned int num_user_features,
const int *orig_coords,
unsigned int num_coords,
const char * const *shaper_list)
{
! DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
"face=%p num_features=%d num_coords=%d shaper_list=%p",
face,
num_user_features,
num_coords,
shaper_list);
hb_shape_plan_t *shape_plan;
! hb_feature_t *features = nullptr;
! int *coords = nullptr;
if (unlikely (!face))
face = hb_face_get_empty ();
if (unlikely (!props))
return hb_shape_plan_get_empty ();
*** 165,175 ****
}
assert (props->direction != HB_DIRECTION_INVALID);
hb_face_make_immutable (face);
! shape_plan->default_shaper_list = shaper_list == NULL;
shape_plan->face_unsafe = face;
shape_plan->props = *props;
shape_plan->num_user_features = num_user_features;
shape_plan->user_features = features;
if (num_user_features)
--- 155,165 ----
}
assert (props->direction != HB_DIRECTION_INVALID);
hb_face_make_immutable (face);
! shape_plan->default_shaper_list = !shaper_list;
shape_plan->face_unsafe = face;
shape_plan->props = *props;
shape_plan->num_user_features = num_user_features;
shape_plan->user_features = features;
if (num_user_features)
*** 201,220 ****
{
static const hb_shape_plan_t _hb_shape_plan_nil = {
HB_OBJECT_HEADER_STATIC,
true, /* default_shaper_list */
! NULL, /* face */
HB_SEGMENT_PROPERTIES_DEFAULT, /* props */
! NULL, /* shaper_func */
! NULL, /* shaper_name */
! NULL, /* user_features */
0, /* num_user_featurs */
! NULL, /* coords */
0, /* num_coords */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
--- 191,210 ----
{
static const hb_shape_plan_t _hb_shape_plan_nil = {
HB_OBJECT_HEADER_STATIC,
true, /* default_shaper_list */
! nullptr, /* face */
HB_SEGMENT_PROPERTIES_DEFAULT, /* props */
! nullptr, /* shaper_func */
! nullptr, /* shaper_name */
! nullptr, /* user_features */
0, /* num_user_featurs */
! nullptr, /* coords */
0, /* num_coords */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
#include "hb-shaper-list.hh"
*** 428,450 ****
const hb_shape_plan_proposal_t *proposal)
{
return hb_segment_properties_equal (&shape_plan->props, &proposal->props) &&
hb_shape_plan_user_features_match (shape_plan, proposal) &&
hb_shape_plan_coords_match (shape_plan, proposal) &&
! ((shape_plan->default_shaper_list && proposal->shaper_list == NULL) ||
(shape_plan->shaper_func == proposal->shaper_func));
}
static inline hb_bool_t
hb_non_global_user_features_present (const hb_feature_t *user_features,
unsigned int num_user_features)
{
! while (num_user_features)
if (user_features->start != 0 || user_features->end != (unsigned int) -1)
return true;
! else
! num_user_features--, user_features++;
return false;
}
static inline hb_bool_t
hb_coords_present (const int *coords,
--- 418,441 ----
const hb_shape_plan_proposal_t *proposal)
{
return hb_segment_properties_equal (&shape_plan->props, &proposal->props) &&
hb_shape_plan_user_features_match (shape_plan, proposal) &&
hb_shape_plan_coords_match (shape_plan, proposal) &&
! ((shape_plan->default_shaper_list && !proposal->shaper_list) ||
(shape_plan->shaper_func == proposal->shaper_func));
}
static inline hb_bool_t
hb_non_global_user_features_present (const hb_feature_t *user_features,
unsigned int num_user_features)
{
! while (num_user_features) {
if (user_features->start != 0 || user_features->end != (unsigned int) -1)
return true;
! num_user_features--;
! user_features++;
! }
return false;
}
static inline hb_bool_t
hb_coords_present (const int *coords,
*** 474,484 ****
unsigned int num_user_features,
const char * const *shaper_list)
{
return hb_shape_plan_create_cached2 (face, props,
user_features, num_user_features,
! NULL, 0,
shaper_list);
}
hb_shape_plan_t *
hb_shape_plan_create_cached2 (hb_face_t *face,
--- 465,475 ----
unsigned int num_user_features,
const char * const *shaper_list)
{
return hb_shape_plan_create_cached2 (face, props,
user_features, num_user_features,
! nullptr, 0,
shaper_list);
}
hb_shape_plan_t *
hb_shape_plan_create_cached2 (hb_face_t *face,
*** 487,508 ****
unsigned int num_user_features,
const int *coords,
unsigned int num_coords,
const char * const *shaper_list)
{
! DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
"face=%p num_features=%d shaper_list=%p",
face,
num_user_features,
shaper_list);
hb_shape_plan_proposal_t proposal = {
*props,
shaper_list,
user_features,
num_user_features,
! NULL
};
if (shaper_list) {
/* Choose shaper. Adapted from hb_shape_plan_plan().
* Must choose shaper exactly the same way as that function. */
--- 478,499 ----
unsigned int num_user_features,
const int *coords,
unsigned int num_coords,
const char * const *shaper_list)
{
! DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
"face=%p num_features=%d shaper_list=%p",
face,
num_user_features,
shaper_list);
hb_shape_plan_proposal_t proposal = {
*props,
shaper_list,
user_features,
num_user_features,
! nullptr
};
if (shaper_list) {
/* Choose shaper. Adapted from hb_shape_plan_plan().
* Must choose shaper exactly the same way as that function. */
*** 524,542 ****
}
retry:
hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans);
for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next)
if (hb_shape_plan_matches (node->shape_plan, &proposal))
{
DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache");
return hb_shape_plan_reference (node->shape_plan);
}
/* Not found. */
-
hb_shape_plan_t *shape_plan = hb_shape_plan_create2 (face, props,
user_features, num_user_features,
coords, num_coords,
shaper_list);
--- 515,535 ----
}
retry:
hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans);
+
+ /* Don't look for plan in the cache if there were variation coordinates XXX Fix me. */
+ if (!hb_coords_present (coords, num_coords))
for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next)
if (hb_shape_plan_matches (node->shape_plan, &proposal))
{
DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache");
return hb_shape_plan_reference (node->shape_plan);
}
/* Not found. */
hb_shape_plan_t *shape_plan = hb_shape_plan_create2 (face, props,
user_features, num_user_features,
coords, num_coords,
shaper_list);
< prev index next >