[HarfBuzz] harfbuzz-ng: Branch 'master' - 12 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Wed Aug 8 15:07:01 PDT 2012
TODO | 4
configure.ac | 14 +
src/Makefile.am | 27 ++
src/check-exported-symbols.sh | 40 +++
src/check-internal-symbols.sh | 12 -
src/check-static-inits.sh | 10
src/hb-buffer-private.hh | 10
src/hb-buffer.h | 4
src/hb-common.cc | 15 -
src/hb-common.h | 7
src/hb-font-private.hh | 29 ++
src/hb-font.cc | 63 ++----
src/hb-font.h | 2
src/hb-graphite2.cc | 4
src/hb-icu.h | 1
src/hb-old.cc | 2
src/hb-old/harfbuzz-external.h | 3
src/hb-ot-layout.cc | 6
src/hb-ot-layout.h | 1
src/hb-ot-shape-complex-indic.cc | 2
src/hb-ot-shape-fallback-private.hh | 39 +++
src/hb-ot-shape-fallback.cc | 274 ++++++++++++++++++++++++++
src/hb-ot-shape-position-fallback-private.hh | 39 ---
src/hb-ot-shape-position-fallback.cc | 276 ---------------------------
src/hb-ot-shape.cc | 12 -
src/hb-shape-plan.cc | 6
src/hb-shape-plan.h | 2
src/hb-tt-font.cc | 166 ----------------
28 files changed, 496 insertions(+), 574 deletions(-)
New commits:
commit a02d86484be870615297abfc7be9f94645434762
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 18:04:29 2012 -0400
Add check-exported-symbols.sh
And misc linking fixes.
diff --git a/src/Makefile.am b/src/Makefile.am
index d8f7502..5894b20 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -241,6 +241,7 @@ test_would_substitute_LDADD = libharfbuzz.la $(HBLIBS) $(FREETYPE_LIBS)
dist_check_SCRIPTS = \
check-c-linkage-decls.sh \
check-header-guards.sh \
+ check-exported-symbols.sh \
check-includes.sh \
check-internal-symbols.sh \
check-static-inits.sh \
diff --git a/src/check-exported-symbols.sh b/src/check-exported-symbols.sh
new file mode 100755
index 0000000..a7d6f9b
--- /dev/null
+++ b/src/check-exported-symbols.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+LC_ALL=C
+export LC_ALL
+
+test -z "$srcdir" && srcdir=.
+test -z "$MAKE" && MAKE=make
+stat=0
+
+if which nm 2>/dev/null >/dev/null; then
+ :
+else
+ echo "check-exported-symbols.sh: 'nm' not found; skipping test"
+ exit 77
+fi
+
+defs="harfbuzz.def"
+$MAKE $defs > /dev/null
+tested=false
+for def in $defs; do
+ lib=`echo "$def" | sed 's/[.]def$//;s at .*/@@'`
+ so=.libs/lib${lib}.so
+ if test -f "$so"; then
+ echo "Checking that $so has the same symbol list as $def"
+ {
+ echo EXPORTS
+ nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>' | cut -d' ' -f3
+ stat=1
+ # cheat: copy the last line from the def file!
+ tail -n1 "$def"
+ } | diff "$def" - >&2 || stat=1
+ tested=true
+ fi
+done
+if ! $tested; then
+ echo "check-exported-symbols.sh: libharfbuzz shared library not found; skipping test"
+ exit 77
+fi
+
+exit $stat
diff --git a/src/check-internal-symbols.sh b/src/check-internal-symbols.sh
index 7ad5743..f48d144 100755
--- a/src/check-internal-symbols.sh
+++ b/src/check-internal-symbols.sh
@@ -19,7 +19,7 @@ for suffix in .so; do
so=`echo .libs/libharfbuzz$suffix`
if test -f "$so"; then
echo "Checking that we are not exposing internal symbols"
- if nm $so | grep ' [TW] ' | grep -v ' T _fini\>\| T _init\>\| T hb_'; then
+ if nm "$so" | grep ' [BCDGINRSTVW] ' | grep -v ' T _fini\>\| T _init\>\| T hb_'; then
echo "Ouch, internal symbols exposed"
stat=1
fi
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 0dbf412..4f9a5af 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -57,7 +57,7 @@ indic_options_init (void)
return u;
}
-inline indic_options_t
+static inline indic_options_t
indic_options (void)
{
static indic_options_union_t options;
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 4c055d3..d1e1d6c 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -40,7 +40,7 @@
#include "hb-set-private.hh"
-hb_tag_t common_features[] = {
+static hb_tag_t common_features[] = {
HB_TAG('c','c','m','p'),
HB_TAG('l','i','g','a'),
HB_TAG('l','o','c','l'),
@@ -50,7 +50,7 @@ hb_tag_t common_features[] = {
};
-hb_tag_t horizontal_features[] = {
+static hb_tag_t horizontal_features[] = {
HB_TAG('c','a','l','t'),
HB_TAG('c','l','i','g'),
HB_TAG('c','u','r','s'),
@@ -63,7 +63,7 @@ hb_tag_t horizontal_features[] = {
* According to the spec, valt and vpal are also mutually exclusive.
* But we apply them all for now.
*/
-hb_tag_t vertical_features[] = {
+static hb_tag_t vertical_features[] = {
HB_TAG('v','a','l','t'),
HB_TAG('v','e','r','t'),
HB_TAG('v','k','r','n'),
commit 4c8ac4f47e95d2b266b2f64e75c55af8233b6b91
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 17:44:19 2012 -0400
Misc minor fixes
diff --git a/src/check-internal-symbols.sh b/src/check-internal-symbols.sh
index bc643da..7ad5743 100755
--- a/src/check-internal-symbols.sh
+++ b/src/check-internal-symbols.sh
@@ -14,18 +14,12 @@ else
exit 77
fi
-if which c++filt 2>/dev/null >/dev/null; then
- cplusplusfilt=c++filt
-else
- cplusplusfilt=cat
-fi
-
tested=false
-for suffix in .so -*.dll; do
+for suffix in .so; do
so=`echo .libs/libharfbuzz$suffix`
if test -f "$so"; then
echo "Checking that we are not exposing internal symbols"
- if nm $so | grep ' [TW] ' | $cplusplusfilt | grep -v ' T _fini\>\| T _init\>\| T hb_'; then
+ if nm $so | grep ' [TW] ' | grep -v ' T _fini\>\| T _init\>\| T hb_'; then
echo "Ouch, internal symbols exposed"
stat=1
fi
diff --git a/src/hb-font-private.hh b/src/hb-font-private.hh
index 6bbf8d8..b6dafbf 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font-private.hh
@@ -94,12 +94,12 @@ struct hb_face_t {
hb_bool_t immutable;
- hb_reference_table_func_t reference_table;
+ hb_reference_table_func_t reference_table_func;
void *user_data;
hb_destroy_func_t destroy;
unsigned int index;
- unsigned int upem;
+ mutable unsigned int upem;
struct hb_shaper_data_t shaper_data;
@@ -107,6 +107,31 @@ struct hb_face_t {
hb_shape_plan_t *shape_plan;
plan_node_t *next;
} *shape_plans;
+
+
+ inline hb_blob_t *reference_table (hb_tag_t tag) const
+ {
+ hb_blob_t *blob;
+
+ if (unlikely (!this || !reference_table_func))
+ return hb_blob_get_empty ();
+
+ blob = reference_table_func (/*XXX*/const_cast<hb_face_t *> (this), tag, user_data);
+ if (unlikely (!blob))
+ return hb_blob_get_empty ();
+
+ return blob;
+ }
+
+ inline unsigned int get_upem (void) const
+ {
+ if (unlikely (!upem))
+ load_upem ();
+ return upem;
+ }
+
+ private:
+ HB_INTERNAL void load_upem (void) const;
};
#define HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
diff --git a/src/hb-font.cc b/src/hb-font.cc
index e5e4af7..922dee3 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -54,7 +54,7 @@ hb_font_get_glyph_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent)
- return hb_font_get_glyph (font->parent, unicode, variation_selector, glyph);
+ return font->parent->get_glyph (unicode, variation_selector, glyph);
*glyph = 0;
return false;
@@ -67,7 +67,7 @@ hb_font_get_glyph_h_advance_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent)
- return font->parent_scale_x_distance (hb_font_get_glyph_h_advance (font->parent, glyph));
+ return font->parent_scale_x_distance (font->parent->get_glyph_h_advance (glyph));
return font->x_scale;
}
@@ -79,7 +79,7 @@ hb_font_get_glyph_v_advance_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent)
- return font->parent_scale_y_distance (hb_font_get_glyph_v_advance (font->parent, glyph));
+ return font->parent_scale_y_distance (font->parent->get_glyph_v_advance (glyph));
return font->y_scale;
}
@@ -93,7 +93,7 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent, glyph, x, y);
+ hb_bool_t ret = font->parent->get_glyph_h_origin (glyph, x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
@@ -112,7 +112,7 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_v_origin (font->parent, glyph, x, y);
+ hb_bool_t ret = font->parent->get_glyph_v_origin (glyph, x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
@@ -130,7 +130,7 @@ hb_font_get_glyph_h_kerning_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent)
- return font->parent_scale_x_distance (hb_font_get_glyph_h_kerning (font->parent, left_glyph, right_glyph));
+ return font->parent_scale_x_distance (font->parent->get_glyph_h_kerning (left_glyph, right_glyph));
return 0;
}
@@ -143,7 +143,7 @@ hb_font_get_glyph_v_kerning_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent)
- return font->parent_scale_y_distance (hb_font_get_glyph_v_kerning (font->parent, top_glyph, bottom_glyph));
+ return font->parent_scale_y_distance (font->parent->get_glyph_v_kerning (top_glyph, bottom_glyph));
return 0;
}
@@ -156,9 +156,7 @@ hb_font_get_glyph_extents_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_extents (font->parent,
- glyph,
- extents);
+ hb_bool_t ret = font->parent->get_glyph_extents (glyph, extents);
if (ret) {
font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
font->parent_scale_distance (&extents->width, &extents->height);
@@ -180,7 +178,7 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent, glyph, point_index, x, y);
+ hb_bool_t ret = font->parent->get_glyph_contour_point (glyph, point_index, x, y);
if (ret)
font->parent_scale_position (x, y);
return ret;
@@ -198,7 +196,7 @@ hb_font_get_glyph_name_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent)
- return hb_font_get_glyph_name (font->parent, glyph, name, size);
+ return font->parent->get_glyph_name (glyph, name, size);
if (size) *name = '\0';
return false;
@@ -212,7 +210,7 @@ hb_font_get_glyph_from_name_nil (hb_font_t *font,
void *user_data HB_UNUSED)
{
if (font->parent)
- return hb_font_get_glyph_from_name (font->parent, name, len, glyph);
+ return font->parent->get_glyph_from_name (name, len, glyph);
*glyph = 0;
return false;
@@ -516,7 +514,7 @@ static const hb_face_t _hb_face_nil = {
true, /* immutable */
- NULL, /* reference_table */
+ NULL, /* reference_table_func */
NULL, /* user_data */
NULL, /* destroy */
@@ -534,19 +532,19 @@ static const hb_face_t _hb_face_nil = {
hb_face_t *
-hb_face_create_for_tables (hb_reference_table_func_t reference_table,
+hb_face_create_for_tables (hb_reference_table_func_t reference_table_func,
void *user_data,
hb_destroy_func_t destroy)
{
hb_face_t *face;
- if (!reference_table || !(face = hb_object_create<hb_face_t> ())) {
+ if (!reference_table_func || !(face = hb_object_create<hb_face_t> ())) {
if (destroy)
destroy (user_data);
return hb_face_get_empty ();
}
- face->reference_table = reference_table;
+ face->reference_table_func = reference_table_func;
face->user_data = user_data;
face->destroy = destroy;
@@ -697,22 +695,13 @@ hb_blob_t *
hb_face_reference_table (hb_face_t *face,
hb_tag_t tag)
{
- hb_blob_t *blob;
-
- if (unlikely (!face || !face->reference_table))
- return hb_blob_get_empty ();
-
- blob = face->reference_table (face, tag, face->user_data);
- if (unlikely (!blob))
- return hb_blob_get_empty ();
-
- return blob;
+ return face->reference_table (tag);
}
hb_blob_t *
hb_face_reference_blob (hb_face_t *face)
{
- return hb_face_reference_table (face, HB_TAG_NONE);
+ return face->reference_table (HB_TAG_NONE);
}
void
@@ -744,13 +733,17 @@ hb_face_set_upem (hb_face_t *face,
unsigned int
hb_face_get_upem (hb_face_t *face)
{
- if (unlikely (!face->upem)) {
- hb_blob_t *head_blob = Sanitizer<head>::sanitize (hb_face_reference_table (face, HB_OT_TAG_head));
- const head *head_table = Sanitizer<head>::lock_instance (head_blob);
- face->upem = head_table->get_upem ();
- hb_blob_destroy (head_blob);
- }
- return face->upem;
+ return face->get_upem ();
+}
+
+
+void
+hb_face_t::load_upem (void) const
+{
+ hb_blob_t *head_blob = Sanitizer<head>::sanitize (reference_table (HB_OT_TAG_head));
+ const head *head_table = Sanitizer<head>::lock_instance (head_blob);
+ upem = head_table->get_upem ();
+ hb_blob_destroy (head_blob);
}
diff --git a/src/hb-font.h b/src/hb-font.h
index 4a043be..d796856 100644
--- a/src/hb-font.h
+++ b/src/hb-font.h
@@ -52,7 +52,7 @@ typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag
/* calls destroy() when not needing user_data anymore */
hb_face_t *
-hb_face_create_for_tables (hb_reference_table_func_t reference_table,
+hb_face_create_for_tables (hb_reference_table_func_t reference_table_func,
void *user_data,
hb_destroy_func_t destroy);
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 70103d5..1b657a6 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -73,7 +73,7 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
if (unlikely (!blob))
{
- blob = hb_face_reference_table (face_data->face, tag);
+ blob = face_data->face->reference_table (tag);
hb_graphite2_tablelist_t *p = (hb_graphite2_tablelist_t *) calloc (1, sizeof (hb_graphite2_tablelist_t));
if (unlikely (!p)) {
@@ -98,7 +98,7 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s
hb_graphite2_shaper_face_data_t *
_hb_graphite2_shaper_face_data_create (hb_face_t *face)
{
- hb_blob_t *silf_blob = hb_face_reference_table (face, HB_GRAPHITE2_TAG_SILF);
+ hb_blob_t *silf_blob = face->reference_table (HB_GRAPHITE2_TAG_SILF);
/* Umm, we just reference the table to check whether it exists.
* Maybe add better API for this? */
if (!hb_blob_get_length (silf_blob))
diff --git a/src/hb-old.cc b/src/hb-old.cc
index ec25e52..197e620 100644
--- a/src/hb-old.cc
+++ b/src/hb-old.cc
@@ -188,7 +188,7 @@ static HB_Error
table_func (void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length)
{
hb_face_t *face = (hb_face_t *) font;
- hb_blob_t *blob = hb_face_reference_table (face, (hb_tag_t) tag);
+ hb_blob_t *blob = face->reference_table ((hb_tag_t) tag);
unsigned int capacity = *length;
*length = hb_blob_get_length (blob);
memcpy (buffer, hb_blob_get_data (blob, NULL), MIN (capacity, *length));
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 91deaa2..e4d84e8 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -49,13 +49,13 @@ _hb_ot_layout_create (hb_face_t *face)
if (unlikely (!layout))
return NULL;
- layout->gdef_blob = Sanitizer<GDEF>::sanitize (hb_face_reference_table (face, HB_OT_TAG_GDEF));
+ layout->gdef_blob = Sanitizer<GDEF>::sanitize (face->reference_table (HB_OT_TAG_GDEF));
layout->gdef = Sanitizer<GDEF>::lock_instance (layout->gdef_blob);
- layout->gsub_blob = Sanitizer<GSUB>::sanitize (hb_face_reference_table (face, HB_OT_TAG_GSUB));
+ layout->gsub_blob = Sanitizer<GSUB>::sanitize (face->reference_table (HB_OT_TAG_GSUB));
layout->gsub = Sanitizer<GSUB>::lock_instance (layout->gsub_blob);
- layout->gpos_blob = Sanitizer<GPOS>::sanitize (hb_face_reference_table (face, HB_OT_TAG_GPOS));
+ layout->gpos_blob = Sanitizer<GPOS>::sanitize (face->reference_table (HB_OT_TAG_GPOS));
layout->gpos = Sanitizer<GPOS>::lock_instance (layout->gpos_blob);
layout->gsub_lookup_count = layout->gsub->get_lookup_count ();
diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index 54ffdb0..71aed89 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -109,9 +109,8 @@ position_mark (const hb_ot_shape_plan_t *plan,
unsigned int combining_class)
{
hb_glyph_extents_t mark_extents;
- if (!hb_font_get_glyph_extents (font,
- buffer->info[i].codepoint,
- &mark_extents))
+ if (!font->get_glyph_extents (buffer->info[i].codepoint,
+ &mark_extents))
return;
hb_position_t y_gap = font->y_scale / 16;
@@ -193,9 +192,8 @@ position_around_base (const hb_ot_shape_plan_t *plan,
unsigned int end)
{
hb_glyph_extents_t base_extents;
- if (!hb_font_get_glyph_extents (font,
- buffer->info[base].codepoint,
- &base_extents))
+ if (!font->get_glyph_extents (buffer->info[base].codepoint,
+ &base_extents))
{
/* If extents don't work, zero marks and go home. */
zero_mark_advances (buffer, base + 1, end);
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 41ec329..4c055d3 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -578,7 +578,7 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
* if that's what they desire. */
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
- hb_set_add (glyphs, buffer->info[i].codepoint);
+ glyphs->add (buffer->info[i].codepoint);
/* And find transitive closure. */
hb_set_t copy;
diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index f7a78e4..038f6af 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -37,7 +37,7 @@
#undef HB_SHAPER_IMPLEMENT
-void
+static void
hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
const hb_feature_t *user_features,
unsigned int num_user_features,
diff --git a/src/hb-shape-plan.h b/src/hb-shape-plan.h
index fbce5dd..f1a14a9 100644
--- a/src/hb-shape-plan.h
+++ b/src/hb-shape-plan.h
@@ -47,7 +47,7 @@ hb_shape_plan_create (hb_face_t *face,
unsigned int num_user_features,
const char * const *shaper_list);
-hb_shape_plan_t *
+HB_INTERNAL hb_shape_plan_t *
hb_shape_plan_create_cached (hb_face_t *face,
const hb_segment_properties_t *props,
const hb_feature_t *user_features,
diff --git a/src/hb-tt-font.cc b/src/hb-tt-font.cc
index 0055ae9..b7198ef 100644
--- a/src/hb-tt-font.cc
+++ b/src/hb-tt-font.cc
@@ -51,7 +51,7 @@ _hb_tt_font_create (hb_font_t *font)
/* TODO Remove this object altogether */
hb_tt_font_t *tt = (hb_tt_font_t *) calloc (1, sizeof (hb_tt_font_t));
- tt->hhea_blob = Sanitizer<hhea>::sanitize (hb_face_reference_table (font->face, HB_OT_TAG_hhea));
+ tt->hhea_blob = Sanitizer<hhea>::sanitize (font->face->reference_table (HB_OT_TAG_hhea));
tt->hhea = Sanitizer<hhea>::lock_instance (tt->hhea_blob);
return tt;
@@ -76,168 +76,4 @@ _get_hhea (hb_face_t *face)
* hb_tt_font_funcs_t
*/
-static hb_bool_t
-hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t unicode,
- hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph,
- void *user_data HB_UNUSED)
-{
- if (font->parent)
- return hb_font_get_glyph (font->parent, unicode, variation_selector, glyph);
-
- *glyph = 0;
- return false;
-}
-
-static hb_position_t
-hb_font_get_glyph_h_advance_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t glyph,
- void *user_data HB_UNUSED)
-{
- if (font->parent)
- return font->parent_scale_x_distance (hb_font_get_glyph_h_advance (font->parent, glyph));
-
- return font->x_scale;
-}
-
-static hb_position_t
-hb_font_get_glyph_v_advance_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t glyph,
- void *user_data HB_UNUSED)
-{
- if (font->parent)
- return font->parent_scale_y_distance (hb_font_get_glyph_v_advance (font->parent, glyph));
-
- return font->y_scale;
-}
-
-static hb_bool_t
-hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t glyph,
- hb_position_t *x,
- hb_position_t *y,
- void *user_data HB_UNUSED)
-{
- if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_h_origin (font->parent,
- glyph,
- x, y);
- if (ret)
- font->parent_scale_position (x, y);
- return ret;
- }
-
- *x = *y = 0;
- return false;
-}
-
-static hb_bool_t
-hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t glyph,
- hb_position_t *x,
- hb_position_t *y,
- void *user_data HB_UNUSED)
-{
- if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_v_origin (font->parent,
- glyph,
- x, y);
- if (ret)
- font->parent_scale_position (x, y);
- return ret;
- }
-
- *x = *y = 0;
- return false;
-}
-
-static hb_position_t
-hb_font_get_glyph_h_kerning_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t left_glyph,
- hb_codepoint_t right_glyph,
- void *user_data HB_UNUSED)
-{
- if (font->parent)
- return font->parent_scale_x_distance (hb_font_get_glyph_h_kerning (font->parent, left_glyph, right_glyph));
-
- return 0;
-}
-
-static hb_position_t
-hb_font_get_glyph_v_kerning_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t top_glyph,
- hb_codepoint_t bottom_glyph,
- void *user_data HB_UNUSED)
-{
- if (font->parent)
- return font->parent_scale_y_distance (hb_font_get_glyph_v_kerning (font->parent, top_glyph, bottom_glyph));
-
- return 0;
-}
-
-static hb_bool_t
-hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t glyph,
- hb_glyph_extents_t *extents,
- void *user_data HB_UNUSED)
-{
- if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_extents (font->parent,
- glyph,
- extents);
- if (ret) {
- font->parent_scale_position (&extents->x_bearing, &extents->y_bearing);
- font->parent_scale_distance (&extents->width, &extents->height);
- }
- return ret;
- }
-
- memset (extents, 0, sizeof (*extents));
- return false;
-}
-
-static hb_bool_t
-hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED,
- void *font_data HB_UNUSED,
- hb_codepoint_t glyph,
- unsigned int point_index,
- hb_position_t *x,
- hb_position_t *y,
- void *user_data HB_UNUSED)
-{
- if (font->parent) {
- hb_bool_t ret = hb_font_get_glyph_contour_point (font->parent,
- glyph, point_index,
- x, y);
- if (ret)
- font->parent_scale_position (x, y);
- return ret;
- }
-
- *x = *y = 0;
- return false;
-}
-
-
-static hb_font_funcs_t _hb_font_funcs_nil = {
- HB_OBJECT_HEADER_STATIC,
-
- true, /* immutable */
-
- {
-#define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil,
- HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
-#undef HB_FONT_FUNC_IMPLEMENT
- }
-};
#endif
-
commit 560d68af8168d1baff607b9616a3590af70fe9ec
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 17:16:01 2012 -0400
Use a export-file for Windows builds
Apparently even that doesn't make check-internal-symbols.sh happy with
mingw32. Going to disable that for DLLs again, but hopefully the
export-file is doing *something*.
diff --git a/configure.ac b/configure.ac
index 689b6a4..3ca23ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,7 @@ if test "x$GCC" = "xyes"; then
CXXFLAGS="$CXXFLAGS -Wcast-align"
case "$host" in
- *-mingw*)
+ *-*-mingw*)
;;
*)
# Hide inline methods
@@ -86,6 +86,18 @@ if test "x$GCC" = "xyes"; then
esac
fi
+AC_MSG_CHECKING([for native Win32])
+case "$host" in
+ *-*-mingw*)
+ hb_os_win32=yes
+ ;;
+ *)
+ hb_os_win32=no
+ ;;
+esac
+AC_MSG_RESULT([$hb_os_win32])
+AM_CONDITIONAL(OS_WIN32, test "$hb_os_win32" = "yes")
+
dnl ==========================================================================
have_ot=true
diff --git a/src/Makefile.am b/src/Makefile.am
index 93879c4..d8f7502 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -164,16 +164,36 @@ endif
DIST_SUBDIRS += hb-old
+
+# Put the library together
+
+if OS_WIN32
+export_symbols = -export-symbols harfbuzz.def
+harfbuzz_def_dependency = harfbuzz.def
+endif
+
# Use a C linker, not C++; Don't link to libstdc++
libharfbuzz_la_LINK = $(LINK) $(libharfbuzz_la_LDFLAGS)
libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
nodist_libharfbuzz_la_SOURCES = $(nodist_HBSOURCES)
libharfbuzz_la_CPPFLAGS = $(HBCFLAGS)
-libharfbuzz_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(HB_LIBTOOL_VERSION_INFO) -no-undefined
+libharfbuzz_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(HB_LIBTOOL_VERSION_INFO) $(export_symbols) -no-undefined
libharfbuzz_la_LIBADD = $(HBLIBS)
+libharfbuzz_la_DEPENDENCIES = $(harfbuzz_def_dependency)
pkginclude_HEADERS = $(HBHEADERS)
nodist_pkginclude_HEADERS = hb-version.h
+CLEANFILES += harfbuzz.def
+harfbuzz.def: $(HBHEADERS)
+ $(AM_V_GEN) (echo EXPORTS; \
+ (cat $^ || echo 'hb_ERROR ()' ) | \
+ $(EGREP) '^hb_.* \(' | \
+ sed -e 's/ (.*//' | \
+ LANG=C sort; \
+ echo LIBRARY libharfbuzz-$(HB_VERSION_MAJOR).dll; \
+ ) >"$@.tmp"
+ @ ! grep -q hb_ERROR "$@.tmp" && mv "$@.tmp" "$@" || ($(RM) "$@"; false)
+
GENERATORS = \
gen-arabic-table.py \
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
index d67cfd6..aebf482 100644
--- a/src/hb-buffer.h
+++ b/src/hb-buffer.h
@@ -201,8 +201,8 @@ hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
/*
* NOT IMPLEMENTED
-void
-hb_buffer_normalize_characters (hb_buffer_t *buffer);
+ void
+ hb_buffer_normalize_characters (hb_buffer_t *buffer);
*/
commit f8751cf8e0a16125d63a88da65fdbfa76a19453f
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 17:15:44 2012 -0400
[hb-old] speed-up build
diff --git a/src/hb-old/harfbuzz-external.h b/src/hb-old/harfbuzz-external.h
index c89a7ad..13ec15f 100644
--- a/src/hb-old/harfbuzz-external.h
+++ b/src/hb-old/harfbuzz-external.h
@@ -25,7 +25,8 @@
#ifndef HARFBUZZ_EXTERNAL_H
#define HARFBUZZ_EXTERNAL_H
-#include <hb.h>
+#define HB_H_IN
+#include <hb-unicode.h>
#include "harfbuzz-global.h"
HB_BEGIN_HEADER
commit 5f4c52867ce67faa15f5d26b59c18c8d068e9261
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 16:53:37 2012 -0400
Minor
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index e14cde8..2ad4ff4 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -169,7 +169,6 @@ hb_ot_layout_feature_get_lookup_indexes (hb_face_t *face,
hb_bool_t
hb_ot_layout_has_substitution (hb_face_t *face);
-/* Supports length 1 or 2 right now. */
hb_bool_t
hb_ot_layout_would_substitute_lookup (hb_face_t *face,
const hb_codepoint_t *glyphs,
commit fe2b8a7777ab1c84980424ede713cb0d6701f987
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 15:27:14 2012 -0400
Minor
diff --git a/TODO b/TODO
index bf13d07..71e5b4d 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,7 @@
General fixes:
=============
-- mask propagation (when ligation, "or" the masks).
+- mask propagation? (when ligation, "or" the masks).
- Warn at compile time (and runtime with HB_DEBUG?) if no Unicode / font
funcs found / set.
@@ -52,7 +52,7 @@ API additions
- Add glib GBoxedType stuff and introspection
-- Add Uniscribe face / font get API
+- Finish Uniscribe / CoreText face / font get API
- BCP 47 language handling / API (language_matches?)
commit 7e7d245b332306949a19c628bacd920717434769
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 15:23:48 2012 -0400
Make default_language threadsafe
diff --git a/src/hb-common.cc b/src/hb-common.cc
index baf5977..1301ab2 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -238,17 +238,12 @@ hb_language_to_string (hb_language_t language)
hb_language_t
hb_language_get_default (void)
{
- static hb_language_t default_language;
+ static hb_language_t default_language = HB_LANGUAGE_INVALID;
- if (!default_language) {
- /* This block is not quite threadsafe, but is not as bad as
- * it looks since it's idempotent. As long as pointer ops
- * are atomic, we are safe. */
-
- /* I hear that setlocale() doesn't honor env vars on Windows,
- * but for now we ignore that. */
-
- default_language = hb_language_from_string (setlocale (LC_CTYPE, NULL), -1);
+ hb_language_t language = (hb_language_t) hb_atomic_ptr_get (&default_language);
+ if (unlikely (language == HB_LANGUAGE_INVALID)) {
+ language = hb_language_from_string (setlocale (LC_CTYPE, NULL), -1);
+ hb_atomic_ptr_cmpexch (&default_language, HB_LANGUAGE_INVALID, language);
}
return default_language;
commit 06b192c458010c847362d809673209c87ea29949
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 15:23:45 2012 -0400
Minor
diff --git a/src/hb-common.h b/src/hb-common.h
index 92f77c4..920bd32 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -96,7 +96,8 @@ typedef uint32_t hb_tag_t;
#define HB_TAG_NONE HB_TAG(0,0,0,0)
/* len=-1 means str is NUL-terminated */
-hb_tag_t hb_tag_from_string (const char *str, int len);
+hb_tag_t
+hb_tag_from_string (const char *str, int len);
/* hb_direction_t */
commit 37191ede7583fdb864db32a8f4d90956657926c7
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 14:59:09 2012 -0400
Minor
diff --git a/src/hb-common.h b/src/hb-common.h
index 6f2a709..92f77c4 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -43,8 +43,6 @@
# endif /* !__cplusplus */
#endif
-HB_BEGIN_DECLS
-
#if !defined (HB_DONT_DEFINE_STDINT)
#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
@@ -69,6 +67,8 @@ typedef unsigned __int64 uint64_t;
#endif
+HB_BEGIN_DECLS
+
typedef int hb_bool_t;
diff --git a/src/hb-icu.h b/src/hb-icu.h
index d22a8e1..f2f35f0 100644
--- a/src/hb-icu.h
+++ b/src/hb-icu.h
@@ -33,7 +33,6 @@
#include <unicode/uscript.h>
-
HB_BEGIN_DECLS
commit 6d9a329a8a0f11f4b175e407de59c55924de1ef6
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 14:48:41 2012 -0400
Adjust a couple source checks
diff --git a/src/check-internal-symbols.sh b/src/check-internal-symbols.sh
index 729b086..bc643da 100755
--- a/src/check-internal-symbols.sh
+++ b/src/check-internal-symbols.sh
@@ -21,8 +21,8 @@ else
fi
tested=false
-for suffix in so; do
- so=.libs/libharfbuzz.$suffix
+for suffix in .so -*.dll; do
+ so=`echo .libs/libharfbuzz$suffix`
if test -f "$so"; then
echo "Checking that we are not exposing internal symbols"
if nm $so | grep ' [TW] ' | $cplusplusfilt | grep -v ' T _fini\>\| T _init\>\| T hb_'; then
diff --git a/src/check-static-inits.sh b/src/check-static-inits.sh
index eb04a55..1eceb1b 100755
--- a/src/check-static-inits.sh
+++ b/src/check-static-inits.sh
@@ -14,8 +14,14 @@ else
exit 77
fi
+OBJS=.libs/*.o
+if test "x`echo $OBJS`" = "x$OBJS" 2>/dev/null >/dev/null; then
+ echo "check-static-inits.sh: object files not found; skipping test"
+ exit 77
+fi
+
echo "Checking that no object file has static initializers"
-for obj in .libs/*.o; do
+for obj in $OBJS; do
if objdump -t "$obj" | grep '[.]ctors'; then
echo "Ouch, $obj has static initializers"
stat=1
@@ -23,7 +29,7 @@ for obj in .libs/*.o; do
done
echo "Checking that no object file has lazy static C++ constructors/destructors"
-for obj in .libs/*.o; do
+for obj in $OBJS; do
if objdump -t "$obj" | grep '__c'; then
echo "Ouch, $obj has lazy static C++ constructors/destructors"
stat=1
commit 9c929abdcfef44c0193a2917b20981df37ade21c
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 14:33:37 2012 -0400
Minor renaming
diff --git a/src/Makefile.am b/src/Makefile.am
index fb7f791..93879c4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -87,8 +87,8 @@ HBSOURCES += \
hb-ot-shape-complex-private.hh \
hb-ot-shape-normalize-private.hh \
hb-ot-shape-normalize.cc \
- hb-ot-shape-position-fallback-private.hh \
- hb-ot-shape-position-fallback.cc \
+ hb-ot-shape-fallback-private.hh \
+ hb-ot-shape-fallback.cc \
hb-ot-shape-private.hh \
$(NULL)
HBHEADERS += \
diff --git a/src/hb-ot-shape-fallback-private.hh b/src/hb-ot-shape-fallback-private.hh
new file mode 100644
index 0000000..be96c4f
--- /dev/null
+++ b/src/hb-ot-shape-fallback-private.hh
@@ -0,0 +1,39 @@
+/*
+ * Copyright © 2012 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_SHAPE_FALLBACK_PRIVATE_HH
+#define HB_OT_SHAPE_FALLBACK_PRIVATE_HH
+
+#include "hb-private.hh"
+
+#include "hb-ot-shape-private.hh"
+
+
+HB_INTERNAL void _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer);
+
+#endif /* HB_OT_SHAPE_FALLBACK_PRIVATE_HH */
diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
new file mode 100644
index 0000000..54ffdb0
--- /dev/null
+++ b/src/hb-ot-shape-fallback.cc
@@ -0,0 +1,276 @@
+/*
+ * Copyright © 2011,2012 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "hb-ot-shape-fallback-private.hh"
+
+static void
+zero_mark_advances (hb_buffer_t *buffer,
+ unsigned int start,
+ unsigned int end)
+{
+ for (unsigned int i = start; i < end; i++)
+ if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+ {
+ buffer->pos[i].x_advance = 0;
+ buffer->pos[i].y_advance = 0;
+ }
+}
+
+static unsigned int
+recategorize_combining_class (unsigned int modified_combining_class)
+{
+ if (modified_combining_class >= 200)
+ return modified_combining_class;
+
+ /* This should be kept in sync with modified combining class mapping
+ * from hb-unicode.cc. */
+ switch (modified_combining_class)
+ {
+ /* Hebrew */
+ case HB_MODIFIED_COMBINING_CLASS_CCC10: /* sheva */
+ case HB_MODIFIED_COMBINING_CLASS_CCC11: /* hataf segol */
+ case HB_MODIFIED_COMBINING_CLASS_CCC12: /* hataf patah */
+ case HB_MODIFIED_COMBINING_CLASS_CCC13: /* hataf qamats */
+ case HB_MODIFIED_COMBINING_CLASS_CCC14: /* hiriq */
+ case HB_MODIFIED_COMBINING_CLASS_CCC15: /* tsere */
+ case HB_MODIFIED_COMBINING_CLASS_CCC16: /* segol */
+ case HB_MODIFIED_COMBINING_CLASS_CCC17: /* patah */
+ case HB_MODIFIED_COMBINING_CLASS_CCC18: /* qamats */
+ case HB_MODIFIED_COMBINING_CLASS_CCC20: /* qubuts */
+ case HB_MODIFIED_COMBINING_CLASS_CCC22: /* meteg */
+ return HB_UNICODE_COMBINING_CLASS_BELOW;
+
+ case HB_MODIFIED_COMBINING_CLASS_CCC23: /* rafe */
+ return HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE;
+
+ case HB_MODIFIED_COMBINING_CLASS_CCC24: /* shin dot */
+ return HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT;
+
+ case HB_MODIFIED_COMBINING_CLASS_CCC25: /* sin dot */
+ case HB_MODIFIED_COMBINING_CLASS_CCC19: /* holam */
+ return HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT;
+
+ case HB_MODIFIED_COMBINING_CLASS_CCC26: /* point varika */
+ return HB_UNICODE_COMBINING_CLASS_ABOVE;
+
+ case HB_MODIFIED_COMBINING_CLASS_CCC21: /* dagesh */
+ break;
+
+ /* Arabic and Syriac */
+ case HB_MODIFIED_COMBINING_CLASS_CCC27: /* fathatan */
+ case HB_MODIFIED_COMBINING_CLASS_CCC28: /* dammatan */
+ case HB_MODIFIED_COMBINING_CLASS_CCC30: /* fatha */
+ case HB_MODIFIED_COMBINING_CLASS_CCC31: /* damma */
+ case HB_MODIFIED_COMBINING_CLASS_CCC33: /* shadda */
+ case HB_MODIFIED_COMBINING_CLASS_CCC34: /* sukun */
+ case HB_MODIFIED_COMBINING_CLASS_CCC35: /* superscript alef */
+ case HB_MODIFIED_COMBINING_CLASS_CCC36: /* superscript alaph */
+ return HB_UNICODE_COMBINING_CLASS_ABOVE;
+
+ case HB_MODIFIED_COMBINING_CLASS_CCC29: /* kasratan */
+ case HB_MODIFIED_COMBINING_CLASS_CCC32: /* kasra */
+ return HB_UNICODE_COMBINING_CLASS_BELOW;
+
+ /* TODO Thai, Lao, and Tibetan */
+ }
+
+ return modified_combining_class;
+}
+
+static inline void
+position_mark (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer,
+ hb_glyph_extents_t &base_extents,
+ unsigned int i,
+ unsigned int combining_class)
+{
+ hb_glyph_extents_t mark_extents;
+ if (!hb_font_get_glyph_extents (font,
+ buffer->info[i].codepoint,
+ &mark_extents))
+ return;
+
+ hb_position_t y_gap = font->y_scale / 16;
+
+ hb_glyph_position_t &pos = buffer->pos[i];
+ pos.x_offset = pos.y_offset = 0;
+
+
+ /* We dont position LEFT and RIGHT marks. */
+
+ /* X positioning */
+ switch (combining_class)
+ {
+ case HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW:
+ case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE:
+ /* TODO Do something... For now, fall through. */
+
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW:
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
+ case HB_UNICODE_COMBINING_CLASS_BELOW:
+ case HB_UNICODE_COMBINING_CLASS_ABOVE:
+ /* Center align. */
+ pos.x_offset += base_extents.x_bearing + (base_extents.width - mark_extents.width) / 2 - mark_extents.x_bearing;
+ break;
+
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
+ case HB_UNICODE_COMBINING_CLASS_BELOW_LEFT:
+ case HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT:
+ /* Left align. */
+ pos.x_offset += base_extents.x_bearing - mark_extents.x_bearing;
+ break;
+
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT:
+ case HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT:
+ case HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT:
+ /* Right align. */
+ pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width - mark_extents.x_bearing;
+ break;
+ }
+
+ /* Y positioning */
+ switch (combining_class)
+ {
+ case HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW:
+ case HB_UNICODE_COMBINING_CLASS_BELOW_LEFT:
+ case HB_UNICODE_COMBINING_CLASS_BELOW:
+ case HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT:
+ /* Add gap, fall-through. */
+ base_extents.height -= y_gap;
+
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW:
+ pos.y_offset += base_extents.y_bearing + base_extents.height - mark_extents.y_bearing;
+ base_extents.height += mark_extents.height;
+ break;
+
+ case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE:
+ case HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT:
+ case HB_UNICODE_COMBINING_CLASS_ABOVE:
+ case HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT:
+ /* Add gap, fall-through. */
+ base_extents.y_bearing += y_gap;
+ base_extents.height -= y_gap;
+
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
+ case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT:
+ pos.y_offset += base_extents.y_bearing - (mark_extents.y_bearing + mark_extents.height);
+ base_extents.y_bearing -= mark_extents.height;
+ base_extents.height += mark_extents.height;
+ break;
+ }
+}
+
+static inline void
+position_around_base (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer,
+ unsigned int base,
+ unsigned int end)
+{
+ hb_glyph_extents_t base_extents;
+ if (!hb_font_get_glyph_extents (font,
+ buffer->info[base].codepoint,
+ &base_extents))
+ {
+ /* If extents don't work, zero marks and go home. */
+ zero_mark_advances (buffer, base + 1, end);
+ return;
+ }
+ base_extents.x_bearing += buffer->pos[base].x_offset;
+ base_extents.y_bearing += buffer->pos[base].y_offset;
+
+ /* XXX Handle ligature component positioning... */
+ HB_UNUSED bool is_ligature = is_a_ligature (buffer->info[base]);
+
+ hb_position_t x_offset = 0, y_offset = 0;
+ unsigned int last_combining_class = 255;
+ hb_glyph_extents_t cluster_extents;
+ for (unsigned int i = base + 1; i < end; i++)
+ if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+ {
+ unsigned int this_combining_class = recategorize_combining_class (_hb_glyph_info_get_modified_combining_class (&buffer->info[i]));
+ if (this_combining_class != last_combining_class)
+ cluster_extents = base_extents;
+
+ position_mark (plan, font, buffer, base_extents, i, this_combining_class);
+
+ buffer->pos[i].x_advance = 0;
+ buffer->pos[i].y_advance = 0;
+ buffer->pos[i].x_offset += x_offset;
+ buffer->pos[i].y_offset += y_offset;
+
+ /* combine cluster extents. */
+
+ last_combining_class = this_combining_class;
+ } else {
+ x_offset -= buffer->pos[i].x_advance;
+ y_offset -= buffer->pos[i].y_advance;
+ }
+
+
+}
+
+static inline void
+position_cluster (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer,
+ unsigned int start,
+ unsigned int end)
+{
+ if (end - start < 2)
+ return;
+
+ /* Find the base glyph */
+ for (unsigned int i = start; i < end; i++)
+ if (is_a_ligature (buffer->info[i]) ||
+ !(FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) &
+ (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
+ FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))))
+ {
+ position_around_base (plan, font, buffer, i, end);
+ break;
+ }
+}
+
+void
+_hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan,
+ hb_font_t *font,
+ hb_buffer_t *buffer)
+{
+ unsigned int start = 0;
+ unsigned int last_cluster = buffer->info[0].cluster;
+ unsigned int count = buffer->len;
+ for (unsigned int i = 1; i < count; i++)
+ if (buffer->info[i].cluster != last_cluster) {
+ position_cluster (plan, font, buffer, start, i);
+ start = i;
+ last_cluster = buffer->info[i].cluster;
+ }
+ position_cluster (plan, font, buffer, start, count);
+}
diff --git a/src/hb-ot-shape-position-fallback-private.hh b/src/hb-ot-shape-position-fallback-private.hh
deleted file mode 100644
index f84752e..0000000
--- a/src/hb-ot-shape-position-fallback-private.hh
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © 2012 Google, Inc.
- *
- * This is part of HarfBuzz, a text shaping library.
- *
- * Permission is hereby granted, without written agreement and without
- * license or royalty fees, to use, copy, modify, and distribute this
- * software and its documentation for any purpose, provided that the
- * above copyright notice and the following two paragraphs appear in
- * all copies of this software.
- *
- * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
- * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- *
- * Google Author(s): Behdad Esfahbod
- */
-
-#ifndef HB_OT_POSITION_FALLBACK_PRIVATE_HH
-#define HB_OT_POSITION_FALLBACK_PRIVATE_HH
-
-#include "hb-private.hh"
-
-#include "hb-ot-shape-private.hh"
-
-
-HB_INTERNAL void _hb_ot_shape_position_fallback (const hb_ot_shape_plan_t *plan,
- hb_font_t *font,
- hb_buffer_t *buffer);
-
-#endif /* HB_OT_POSITION_FALLBACK_PRIVATE_HH */
diff --git a/src/hb-ot-shape-position-fallback.cc b/src/hb-ot-shape-position-fallback.cc
deleted file mode 100644
index 7966852..0000000
--- a/src/hb-ot-shape-position-fallback.cc
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright © 2011,2012 Google, Inc.
- *
- * This is part of HarfBuzz, a text shaping library.
- *
- * Permission is hereby granted, without written agreement and without
- * license or royalty fees, to use, copy, modify, and distribute this
- * software and its documentation for any purpose, provided that the
- * above copyright notice and the following two paragraphs appear in
- * all copies of this software.
- *
- * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
- * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
- * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
- * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
- * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- *
- * Google Author(s): Behdad Esfahbod
- */
-
-#include "hb-ot-shape-position-fallback-private.hh"
-
-static void
-zero_mark_advances (hb_buffer_t *buffer,
- unsigned int start,
- unsigned int end)
-{
- for (unsigned int i = start; i < end; i++)
- if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
- {
- buffer->pos[i].x_advance = 0;
- buffer->pos[i].y_advance = 0;
- }
-}
-
-static unsigned int
-recategorize_combining_class (unsigned int modified_combining_class)
-{
- if (modified_combining_class >= 200)
- return modified_combining_class;
-
- /* This should be kept in sync with modified combining class mapping
- * from hb-unicode.cc. */
- switch (modified_combining_class)
- {
- /* Hebrew */
- case HB_MODIFIED_COMBINING_CLASS_CCC10: /* sheva */
- case HB_MODIFIED_COMBINING_CLASS_CCC11: /* hataf segol */
- case HB_MODIFIED_COMBINING_CLASS_CCC12: /* hataf patah */
- case HB_MODIFIED_COMBINING_CLASS_CCC13: /* hataf qamats */
- case HB_MODIFIED_COMBINING_CLASS_CCC14: /* hiriq */
- case HB_MODIFIED_COMBINING_CLASS_CCC15: /* tsere */
- case HB_MODIFIED_COMBINING_CLASS_CCC16: /* segol */
- case HB_MODIFIED_COMBINING_CLASS_CCC17: /* patah */
- case HB_MODIFIED_COMBINING_CLASS_CCC18: /* qamats */
- case HB_MODIFIED_COMBINING_CLASS_CCC20: /* qubuts */
- case HB_MODIFIED_COMBINING_CLASS_CCC22: /* meteg */
- return HB_UNICODE_COMBINING_CLASS_BELOW;
-
- case HB_MODIFIED_COMBINING_CLASS_CCC23: /* rafe */
- return HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE;
-
- case HB_MODIFIED_COMBINING_CLASS_CCC24: /* shin dot */
- return HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT;
-
- case HB_MODIFIED_COMBINING_CLASS_CCC25: /* sin dot */
- case HB_MODIFIED_COMBINING_CLASS_CCC19: /* holam */
- return HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT;
-
- case HB_MODIFIED_COMBINING_CLASS_CCC26: /* point varika */
- return HB_UNICODE_COMBINING_CLASS_ABOVE;
-
- case HB_MODIFIED_COMBINING_CLASS_CCC21: /* dagesh */
- break;
-
- /* Arabic and Syriac */
- case HB_MODIFIED_COMBINING_CLASS_CCC27: /* fathatan */
- case HB_MODIFIED_COMBINING_CLASS_CCC28: /* dammatan */
- case HB_MODIFIED_COMBINING_CLASS_CCC30: /* fatha */
- case HB_MODIFIED_COMBINING_CLASS_CCC31: /* damma */
- case HB_MODIFIED_COMBINING_CLASS_CCC33: /* shadda */
- case HB_MODIFIED_COMBINING_CLASS_CCC34: /* sukun */
- case HB_MODIFIED_COMBINING_CLASS_CCC35: /* superscript alef */
- case HB_MODIFIED_COMBINING_CLASS_CCC36: /* superscript alaph */
- return HB_UNICODE_COMBINING_CLASS_ABOVE;
-
- case HB_MODIFIED_COMBINING_CLASS_CCC29: /* kasratan */
- case HB_MODIFIED_COMBINING_CLASS_CCC32: /* kasra */
- return HB_UNICODE_COMBINING_CLASS_BELOW;
-
- /* TODO Thai, Lao, and Tibetan */
- }
-
- return modified_combining_class;
-}
-
-static inline void
-position_mark (const hb_ot_shape_plan_t *plan,
- hb_font_t *font,
- hb_buffer_t *buffer,
- hb_glyph_extents_t &base_extents,
- unsigned int i,
- unsigned int combining_class)
-{
- hb_glyph_extents_t mark_extents;
- if (!hb_font_get_glyph_extents (font,
- buffer->info[i].codepoint,
- &mark_extents))
- return;
-
- hb_position_t y_gap = font->y_scale / 16;
-
- hb_glyph_position_t &pos = buffer->pos[i];
- pos.x_offset = pos.y_offset = 0;
-
-
- /* We dont position LEFT and RIGHT marks. */
-
- /* X positioning */
- switch (combining_class)
- {
- case HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW:
- case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE:
- /* TODO Do something... For now, fall through. */
-
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW:
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
- case HB_UNICODE_COMBINING_CLASS_BELOW:
- case HB_UNICODE_COMBINING_CLASS_ABOVE:
- /* Center align. */
- pos.x_offset += base_extents.x_bearing + (base_extents.width - mark_extents.width) / 2 - mark_extents.x_bearing;
- break;
-
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
- case HB_UNICODE_COMBINING_CLASS_BELOW_LEFT:
- case HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT:
- /* Left align. */
- pos.x_offset += base_extents.x_bearing - mark_extents.x_bearing;
- break;
-
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT:
- case HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT:
- case HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT:
- /* Right align. */
- pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width - mark_extents.x_bearing;
- break;
- }
-
- /* Y positioning */
- switch (combining_class)
- {
- case HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW:
- case HB_UNICODE_COMBINING_CLASS_BELOW_LEFT:
- case HB_UNICODE_COMBINING_CLASS_BELOW:
- case HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT:
- /* Add gap, fall-through. */
- base_extents.height -= y_gap;
-
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT:
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW:
- pos.y_offset += base_extents.y_bearing + base_extents.height - mark_extents.y_bearing;
- base_extents.height += mark_extents.height;
- break;
-
- case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE:
- case HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT:
- case HB_UNICODE_COMBINING_CLASS_ABOVE:
- case HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT:
- /* Add gap, fall-through. */
- base_extents.y_bearing += y_gap;
- base_extents.height -= y_gap;
-
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE:
- case HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT:
- pos.y_offset += base_extents.y_bearing - (mark_extents.y_bearing + mark_extents.height);
- base_extents.y_bearing -= mark_extents.height;
- base_extents.height += mark_extents.height;
- break;
- }
-}
-
-static inline void
-position_around_base (const hb_ot_shape_plan_t *plan,
- hb_font_t *font,
- hb_buffer_t *buffer,
- unsigned int base,
- unsigned int end)
-{
- hb_glyph_extents_t base_extents;
- if (!hb_font_get_glyph_extents (font,
- buffer->info[base].codepoint,
- &base_extents))
- {
- /* If extents don't work, zero marks and go home. */
- zero_mark_advances (buffer, base + 1, end);
- return;
- }
- base_extents.x_bearing += buffer->pos[base].x_offset;
- base_extents.y_bearing += buffer->pos[base].y_offset;
-
- /* XXX Handle ligature component positioning... */
- HB_UNUSED bool is_ligature = is_a_ligature (buffer->info[base]);
-
- hb_position_t x_offset = 0, y_offset = 0;
- unsigned int last_combining_class = 255;
- hb_glyph_extents_t cluster_extents;
- for (unsigned int i = base + 1; i < end; i++)
- if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
- {
- unsigned int this_combining_class = recategorize_combining_class (_hb_glyph_info_get_modified_combining_class (&buffer->info[i]));
- if (this_combining_class != last_combining_class)
- cluster_extents = base_extents;
-
- position_mark (plan, font, buffer, base_extents, i, this_combining_class);
-
- buffer->pos[i].x_advance = 0;
- buffer->pos[i].y_advance = 0;
- buffer->pos[i].x_offset += x_offset;
- buffer->pos[i].y_offset += y_offset;
-
- /* combine cluster extents. */
-
- last_combining_class = this_combining_class;
- } else {
- x_offset -= buffer->pos[i].x_advance;
- y_offset -= buffer->pos[i].y_advance;
- }
-
-
-}
-
-static inline void
-position_cluster (const hb_ot_shape_plan_t *plan,
- hb_font_t *font,
- hb_buffer_t *buffer,
- unsigned int start,
- unsigned int end)
-{
- if (end - start < 2)
- return;
-
- /* Find the base glyph */
- for (unsigned int i = start; i < end; i++)
- if (is_a_ligature (buffer->info[i]) ||
- !(FLAG (_hb_glyph_info_get_general_category (&buffer->info[i])) &
- (FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) |
- FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
- FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))))
- {
- position_around_base (plan, font, buffer, i, end);
- break;
- }
-}
-
-void
-_hb_ot_shape_position_fallback (const hb_ot_shape_plan_t *plan,
- hb_font_t *font,
- hb_buffer_t *buffer)
-{
- unsigned int start = 0;
- unsigned int last_cluster = buffer->info[0].cluster;
- unsigned int count = buffer->len;
- for (unsigned int i = 1; i < count; i++)
- if (buffer->info[i].cluster != last_cluster) {
- position_cluster (plan, font, buffer, start, i);
- start = i;
- last_cluster = buffer->info[i].cluster;
- }
- position_cluster (plan, font, buffer, start, count);
-}
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 6ec17c5..41ec329 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -33,8 +33,8 @@
#include "hb-ot-shape-private.hh"
#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-fallback-private.hh"
#include "hb-ot-shape-normalize-private.hh"
-#include "hb-ot-shape-position-fallback-private.hh"
#include "hb-ot-layout-private.hh"
#include "hb-set-private.hh"
@@ -427,7 +427,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
static void
hb_position_complex_fallback (hb_ot_shape_context_t *c)
{
- _hb_ot_shape_position_fallback (c->plan, c->font, c->buffer);
+ _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer);
}
static void
commit 801298b590effd768607bb532dc83c73ba65d16b
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Wed Aug 8 14:26:36 2012 -0400
Fix cast
https://bugs.freedesktop.org/show_bug.cgi?id=53233
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh
index c96723a..9864ca2 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer-private.hh
@@ -64,14 +64,16 @@ hb_segment_properties_equal (const hb_segment_properties_t *a,
}
-static inline long
+#if 0
+static inline unsigned int
hb_segment_properties_hash (const hb_segment_properties_t *p)
{
/* TODO improve */
- return (long) p->direction +
- (long) p->script +
- (long) p->language;
+ return (unsigned int) p->direction +
+ (unsigned int) p->script +
+ (intptr_t) (p->language);
}
+#endif
diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index ddfb501..f7a78e4 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -190,11 +190,11 @@ hb_shape_plan_execute (hb_shape_plan *shape_plan,
*/
#if 0
-static long
+static unsigned int
hb_shape_plan_hash (const hb_shape_plan_t *shape_plan)
{
return hb_segment_properties_hash (&shape_plan->props) +
- shape_plan->default_shaper_list ? 0 : (long) shape_plan->shaper_func;
+ shape_plan->default_shaper_list ? 0 : (intptr_t) shape_plan->shaper_func;
}
#endif
More information about the HarfBuzz
mailing list