diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 16b662777..ca0e908fe 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -170,6 +170,7 @@ hb_coretext_font_get_ct_font
hb-face
hb_face_count
+hb_face_t
hb_face_create
hb_face_create_for_tables
hb_face_destroy
@@ -188,7 +189,11 @@ hb_face_set_glyph_count
hb_face_set_index
hb_face_set_upem
hb_face_set_user_data
-hb_face_t
+hb_face_collect_unicodes
+hb_face_collect_variation_selectors
+hb_face_collect_variation_unicodes
+hb_face_builder_create
+hb_face_builder_add_table
@@ -226,6 +231,7 @@ hb_font_get_glyph
hb_font_get_glyph_advance_for_direction
hb_font_get_glyph_advance_func_t
hb_font_get_glyph_advances_for_direction
+hb_font_get_glyph_advances_func_t
hb_font_get_glyph_contour_point
hb_font_get_glyph_contour_point_for_origin
hb_font_get_glyph_contour_point_func_t
@@ -602,6 +608,7 @@ hb_shape_plan_t
hb-unicode
+HB_UNICODE_MAX
HB_UNICODE_MAX_DECOMPOSITION_LEN
hb_unicode_combining_class
hb_unicode_combining_class_func_t
diff --git a/src/Makefile.sources b/src/Makefile.sources
index f7ae086b6..9c64c3c08 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -1,28 +1,28 @@
# Base and default-included sources and headers
HB_BASE_sources = \
- hb-atomic-private.hh \
- hb-blob-private.hh \
+ hb-atomic.hh \
+ hb-blob.hh \
hb-blob.cc \
- hb-buffer-private.hh \
+ hb-buffer.hh \
hb-buffer-serialize.cc \
hb-buffer.cc \
hb-common.cc \
hb-debug.hh \
hb-dsalgs.hh \
- hb-face-private.hh \
+ hb-face.hh \
hb-face.cc \
- hb-font-private.hh \
+ hb-font.hh \
hb-font.cc \
- hb-iter-private.hh \
- hb-map-private.hh \
+ hb-iter.hh \
+ hb-map.hh \
hb-map.cc \
- hb-machinery-private.hh \
- hb-mutex-private.hh \
+ hb-machinery.hh \
+ hb-mutex.hh \
hb-null.hh \
- hb-object-private.hh \
- hb-open-file-private.hh \
- hb-open-type-private.hh \
+ hb-object.hh \
+ hb-open-file.hh \
+ hb-open-type.hh \
hb-ot-color-cbdt-table.hh \
hb-ot-cmap-table.hh \
hb-ot-glyf-table.hh \
@@ -40,23 +40,23 @@ HB_BASE_sources = \
hb-ot-post-macroman.hh \
hb-ot-post-table.hh \
hb-ot-tag.cc \
- hb-private.hh \
- hb-set-digest-private.hh \
- hb-set-private.hh \
+ hb.hh \
+ hb-set-digest.hh \
+ hb-set.hh \
hb-set.cc \
hb-shape.cc \
- hb-shape-plan-private.hh \
+ hb-shape-plan.hh \
hb-shape-plan.cc \
hb-shaper-list.hh \
- hb-shaper-impl-private.hh \
- hb-shaper-private.hh \
+ hb-shaper-impl.hh \
+ hb-shaper.hh \
hb-shaper.cc \
hb-static.cc \
hb-string-array.hh \
- hb-unicode-private.hh \
+ hb-unicode.hh \
hb-unicode.cc \
- hb-vector-private.hh \
- hb-utf-private.hh \
+ hb-vector.hh \
+ hb-utf.hh \
hb-warning.cc \
$(NULL)
@@ -91,72 +91,74 @@ HB_FALLBACK_sources = \
HB_OT_sources = \
hb-aat-layout.cc \
- hb-aat-layout-common-private.hh \
+ hb-aat-layout-common.hh \
hb-aat-layout-ankr-table.hh \
hb-aat-layout-bsln-table.hh \
hb-aat-layout-feat-table.hh \
hb-aat-layout-kerx-table.hh \
hb-aat-layout-morx-table.hh \
hb-aat-layout-trak-table.hh \
- hb-aat-layout-private.hh \
+ hb-aat-layout.hh \
hb-aat-ltag-table.hh \
+ hb-ot-face.hh \
+ hb-ot-face.cc \
hb-ot-font.cc \
hb-ot-layout.cc \
hb-ot-layout-base-table.hh \
- hb-ot-layout-common-private.hh \
+ hb-ot-layout-common.hh \
hb-ot-layout-gdef-table.hh \
hb-ot-layout-gpos-table.hh \
- hb-ot-layout-gsubgpos-private.hh \
+ hb-ot-layout-gsubgpos.hh \
hb-ot-layout-gsub-table.hh \
hb-ot-layout-jstf-table.hh \
- hb-ot-layout-private.hh \
+ hb-ot-layout.hh \
hb-ot-color.cc \
hb-ot-color-colr-table.hh \
hb-ot-color-cpal-table.hh \
hb-ot-color-sbix-table.hh \
hb-ot-color-svg-table.hh \
hb-ot-map.cc \
- hb-ot-map-private.hh \
+ hb-ot-map.hh \
hb-ot-math.cc \
hb-ot-math-table.hh \
hb-ot-shape.cc \
hb-ot-shape-complex-arabic.cc \
hb-ot-shape-complex-arabic-fallback.hh \
- hb-ot-shape-complex-arabic-private.hh \
+ hb-ot-shape-complex-arabic.hh \
hb-ot-shape-complex-arabic-table.hh \
hb-ot-shape-complex-arabic-win1256.hh \
hb-ot-shape-complex-default.cc \
hb-ot-shape-complex-hangul.cc \
hb-ot-shape-complex-hebrew.cc \
hb-ot-shape-complex-indic.cc \
- hb-ot-shape-complex-indic-private.hh \
+ hb-ot-shape-complex-indic.hh \
hb-ot-shape-complex-indic-table.cc \
- hb-ot-shape-complex-khmer-private.hh \
+ hb-ot-shape-complex-khmer.hh \
hb-ot-shape-complex-khmer.cc \
- hb-ot-shape-complex-myanmar-private.hh \
+ hb-ot-shape-complex-myanmar.hh \
hb-ot-shape-complex-myanmar.cc \
hb-ot-shape-complex-thai.cc \
hb-ot-shape-complex-tibetan.cc \
hb-ot-shape-complex-use.cc \
- hb-ot-shape-complex-use-private.hh \
+ hb-ot-shape-complex-use.hh \
hb-ot-shape-complex-use-table.cc \
- hb-ot-shape-complex-private.hh \
- hb-ot-shape-normalize-private.hh \
+ hb-ot-shape-complex.hh \
+ hb-ot-shape-normalize.hh \
hb-ot-shape-normalize.cc \
- hb-ot-shape-fallback-private.hh \
+ hb-ot-shape-fallback.hh \
hb-ot-shape-fallback.cc \
- hb-ot-shape-private.hh \
- hb-ot-cff-common-private.hh \
+ hb-ot-shape.hh \
hb-ot-var.cc \
hb-ot-var-avar-table.hh \
hb-ot-var-fvar-table.hh \
hb-ot-var-hvar-table.hh \
hb-ot-var-mvar-table.hh \
- hb-cff-interp-common-private.hh \
- hb-cff-interp-cs-common-private.hh \
+ hb-ot-cff-common.hh \
+ hb-cff-interp-common.hh \
+ hb-cff-interp-cs-common.hh \
hb-cff1-interp-cs.hh \
hb-cff2-interp-cs.hh \
- hb-cff-interp-dict-common-private.hh \
+ hb-cff-interp-dict-common.hh \
$(NULL)
HB_OT_RAGEL_GENERATED_sources = \
@@ -215,22 +217,25 @@ HB_ICU_headers = hb-icu.h
HB_SUBSET_sources = \
hb-static.cc \
hb-subset.cc \
+ hb-subset.hh \
hb-subset-glyf.cc \
- hb-subset-cff1.cc \
- hb-subset-cff2.cc \
- hb-subset-cff-common-private.cc \
+ hb-subset-glyf.hh \
+ hb-subset-cff1.cc \
+ hb-subset-cff2.cc \
+ hb-subset-cff-common.cc \
hb-subset-input.cc \
hb-subset-plan.cc \
+ hb-subset-plan.hh \
$(NULL)
HB_SUBSET_headers = \
hb-subset.h \
hb-subset-glyf.hh \
- hb-subset-cff1.hh \
- hb-subset-cff2.hh \
- hb-subset-cff-common-private.hh \
+ hb-subset-cff1.hh \
+ hb-subset-cff2.hh \
+ hb-subset-cff-common.hh \
hb-subset-plan.hh \
- hb-subset-private.hh \
+ hb-subset.hh \
$(NULL)
HB_GOBJECT_DIST_sources = hb-gobject-structs.cc
diff --git a/src/check-includes.sh b/src/check-includes.sh
index fd565da53..f938f706c 100755
--- a/src/check-includes.sh
+++ b/src/check-includes.sh
@@ -23,14 +23,14 @@ grep -v 'hb[.]h:' |
grep . >&2 && stat=1
-echo 'Checking that source files #include "hb-*private.hh" first (or none)'
+echo 'Checking that source files #include a private header first (or none)'
for x in $HBSOURCES; do
test -f "$srcdir/$x" -a ! -f "$x" && x="$srcdir/$x"
- grep '#.*\' "$x" /dev/null | grep -v 'include _' | head -n 1
+ grep '#.*\' "$x" /dev/null | head -n 1
done |
-grep -v '"hb-.*private[.]hh"' |
-grep -v 'hb-private[.]hh:' |
+grep -v '"hb-.*[.]hh"' |
+grep -v 'hb[.]hh' |
grep . >&2 && stat=1
diff --git a/src/dump-indic-data.cc b/src/dump-indic-data.cc
index d57413884..a50688981 100644
--- a/src/dump-indic-data.cc
+++ b/src/dump-indic-data.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-indic-private.hh"
+#include "hb-ot-shape-complex-indic.hh"
int
main (void)
diff --git a/src/dump-khmer-data.cc b/src/dump-khmer-data.cc
index 7dd09b2b5..12871fa85 100644
--- a/src/dump-khmer-data.cc
+++ b/src/dump-khmer-data.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-khmer-private.hh"
+#include "hb-ot-shape-complex-khmer.hh"
int
main (void)
diff --git a/src/dump-myanmar-data.cc b/src/dump-myanmar-data.cc
index 2df9cd987..9f8b12ed2 100644
--- a/src/dump-myanmar-data.cc
+++ b/src/dump-myanmar-data.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-myanmar-private.hh"
+#include "hb-ot-shape-complex-myanmar.hh"
int
main (void)
diff --git a/src/dump-use-data.cc b/src/dump-use-data.cc
index 0e64688f1..4a8b25842 100644
--- a/src/dump-use-data.cc
+++ b/src/dump-use-data.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-use-private.hh"
+#include "hb-ot-shape-complex-use.hh"
int
main (void)
diff --git a/src/gen-indic-table.py b/src/gen-indic-table.py
index 6252664ca..e65b9814a 100755
--- a/src/gen-indic-table.py
+++ b/src/gen-indic-table.py
@@ -102,7 +102,7 @@ for h in headers:
print (" * %s" % (l.strip()))
print (" */")
print ()
-print ('#include "hb-ot-shape-complex-indic-private.hh"')
+print ('#include "hb-ot-shape-complex-indic.hh"')
print ()
# Shorten values
diff --git a/src/gen-use-table.py b/src/gen-use-table.py
index c742ebaca..a8724619a 100755
--- a/src/gen-use-table.py
+++ b/src/gen-use-table.py
@@ -394,7 +394,7 @@ for h in headers:
print (" * %s" % (l.strip()))
print (" */")
print ()
-print ('#include "hb-ot-shape-complex-use-private.hh"')
+print ('#include "hb-ot-shape-complex-use.hh"')
print ()
total = 0
diff --git a/src/hb-aat-layout-ankr-table.hh b/src/hb-aat-layout-ankr-table.hh
index 3b7912b9d..a197cec81 100644
--- a/src/hb-aat-layout-ankr-table.hh
+++ b/src/hb-aat-layout-ankr-table.hh
@@ -25,7 +25,7 @@
#ifndef HB_AAT_LAYOUT_ANKR_TABLE_HH
#define HB_AAT_LAYOUT_ANKR_TABLE_HH
-#include "hb-aat-layout-common-private.hh"
+#include "hb-aat-layout-common.hh"
/*
* ankr -- Anchor Point
diff --git a/src/hb-aat-layout-bsln-table.hh b/src/hb-aat-layout-bsln-table.hh
index df2bf5b43..b86408626 100644
--- a/src/hb-aat-layout-bsln-table.hh
+++ b/src/hb-aat-layout-bsln-table.hh
@@ -25,7 +25,7 @@
#ifndef HB_AAT_LAYOUT_BSLN_TABLE_HH
#define HB_AAT_LAYOUT_BSLN_TABLE_HH
-#include "hb-aat-layout-common-private.hh"
+#include "hb-aat-layout-common.hh"
/*
* bsln -- Baseline
diff --git a/src/hb-aat-layout-common-private.hh b/src/hb-aat-layout-common.hh
similarity index 99%
rename from src/hb-aat-layout-common-private.hh
rename to src/hb-aat-layout-common.hh
index d7f35052d..25f4fe14a 100644
--- a/src/hb-aat-layout-common-private.hh
+++ b/src/hb-aat-layout-common.hh
@@ -24,10 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_AAT_LAYOUT_COMMON_PRIVATE_HH
-#define HB_AAT_LAYOUT_COMMON_PRIVATE_HH
+#ifndef HB_AAT_LAYOUT_COMMON_HH
+#define HB_AAT_LAYOUT_COMMON_HH
-#include "hb-aat-layout-private.hh"
+#include "hb-aat-layout.hh"
namespace AAT {
@@ -641,4 +641,4 @@ struct hb_aat_apply_context_t :
} /* namespace AAT */
-#endif /* HB_AAT_LAYOUT_COMMON_PRIVATE_HH */
+#endif /* HB_AAT_LAYOUT_COMMON_HH */
diff --git a/src/hb-aat-layout-feat-table.hh b/src/hb-aat-layout-feat-table.hh
index 3e070d795..b70076316 100644
--- a/src/hb-aat-layout-feat-table.hh
+++ b/src/hb-aat-layout-feat-table.hh
@@ -25,7 +25,7 @@
#ifndef HB_AAT_LAYOUT_FEAT_TABLE_HH
#define HB_AAT_LAYOUT_FEAT_TABLE_HH
-#include "hb-aat-layout-common-private.hh"
+#include "hb-aat-layout-common.hh"
/*
* feat -- Feature Name
diff --git a/src/hb-aat-layout-kerx-table.hh b/src/hb-aat-layout-kerx-table.hh
index cc03d6278..615a8f8d4 100644
--- a/src/hb-aat-layout-kerx-table.hh
+++ b/src/hb-aat-layout-kerx-table.hh
@@ -28,8 +28,8 @@
#ifndef HB_AAT_LAYOUT_KERX_TABLE_HH
#define HB_AAT_LAYOUT_KERX_TABLE_HH
-#include "hb-open-type-private.hh"
-#include "hb-aat-layout-common-private.hh"
+#include "hb-open-type.hh"
+#include "hb-aat-layout-common.hh"
#include "hb-aat-layout-ankr-table.hh"
/*
diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index f25842457..ef452e22b 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -27,9 +27,9 @@
#ifndef HB_AAT_LAYOUT_MORX_TABLE_HH
#define HB_AAT_LAYOUT_MORX_TABLE_HH
-#include "hb-open-type-private.hh"
-#include "hb-aat-layout-common-private.hh"
-#include "hb-ot-layout-common-private.hh"
+#include "hb-open-type.hh"
+#include "hb-aat-layout-common.hh"
+#include "hb-ot-layout-common.hh"
/*
* morx -- Extended Glyph Metamorphosis
diff --git a/src/hb-aat-layout-trak-table.hh b/src/hb-aat-layout-trak-table.hh
index f5dc558c3..c4bec2cab 100644
--- a/src/hb-aat-layout-trak-table.hh
+++ b/src/hb-aat-layout-trak-table.hh
@@ -28,9 +28,9 @@
#ifndef HB_AAT_LAYOUT_TRAK_TABLE_HH
#define HB_AAT_LAYOUT_TRAK_TABLE_HH
-#include "hb-aat-layout-common-private.hh"
-#include "hb-ot-layout-private.hh"
-#include "hb-open-type-private.hh"
+#include "hb-aat-layout-common.hh"
+#include "hb-ot-layout.hh"
+#include "hb-open-type.hh"
/*
* trak -- Tracking
diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc
index 36d4037ad..a5e36a40a 100644
--- a/src/hb-aat-layout.cc
+++ b/src/hb-aat-layout.cc
@@ -24,12 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
-#include "hb-ot-layout-private.hh"
-#include "hb-ot-layout-gsubgpos-private.hh"
-
-#include "hb-aat-layout-private.hh"
+#include "hb-ot-face.hh"
+#include "hb-aat-layout.hh"
#include "hb-aat-layout-ankr-table.hh"
#include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise.
#include "hb-aat-layout-feat-table.hh" // Just so we compile it; unused otherwise.
@@ -51,25 +49,12 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr)
*blob = hb_blob_get_empty ();
return Null(AAT::morx);
}
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- const AAT::morx& morx = *(layout->table.morx.get ());
+ const AAT::morx& morx = *(hb_ot_face_data (face)->morx.get ());
if (blob)
- *blob = layout->table.morx.get_blob ();
+ *blob = hb_ot_face_data (face)->morx.get_blob ();
return morx;
}
-// static inline void
-// _hb_aat_layout_create (hb_face_t *face)
-// {
-// hb_blob_t *morx_blob = hb_sanitize_context_t ().reference_table (face);
-// morx_blob->as ();
-
-// if (0)
-// {
-// morx_blob->as > ()->get_value (1, face->get_num_glyphs ());
-// }
-// }
-
void
hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer)
{
diff --git a/src/hb-aat-layout-private.hh b/src/hb-aat-layout.hh
similarity index 84%
rename from src/hb-aat-layout-private.hh
rename to src/hb-aat-layout.hh
index ce75c8e71..ac9c53539 100644
--- a/src/hb-aat-layout-private.hh
+++ b/src/hb-aat-layout.hh
@@ -24,14 +24,14 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_AAT_LAYOUT_PRIVATE_HH
-#define HB_AAT_LAYOUT_PRIVATE_HH
+#ifndef HB_AAT_LAYOUT_HH
+#define HB_AAT_LAYOUT_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-font-private.hh"
-#include "hb-buffer-private.hh"
-#include "hb-open-type-private.hh"
+#include "hb-font.hh"
+#include "hb-buffer.hh"
+#include "hb-open-type.hh"
HB_INTERNAL void
@@ -40,4 +40,4 @@ hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer);
HB_INTERNAL void
hb_aat_layout_position (hb_font_t *font, hb_buffer_t *buffer);
-#endif /* HB_AAT_LAYOUT_PRIVATE_HH */
+#endif /* HB_AAT_LAYOUT_HH */
diff --git a/src/hb-aat-ltag-table.hh b/src/hb-aat-ltag-table.hh
index 15c4e89cb..e308ab28c 100644
--- a/src/hb-aat-ltag-table.hh
+++ b/src/hb-aat-ltag-table.hh
@@ -25,7 +25,7 @@
#ifndef HB_AAT_LTAG_TABLE_HH
#define HB_AAT_LTAG_TABLE_HH
-#include "hb-aat-layout-common-private.hh"
+#include "hb-aat-layout-common.hh"
/*
* ltag -- Language Tag
diff --git a/src/hb-atomic-private.hh b/src/hb-atomic.hh
similarity index 98%
rename from src/hb-atomic-private.hh
rename to src/hb-atomic.hh
index 297c64698..d494c8955 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic.hh
@@ -29,10 +29,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_ATOMIC_PRIVATE_HH
-#define HB_ATOMIC_PRIVATE_HH
+#ifndef HB_ATOMIC_HH
+#define HB_ATOMIC_HH
-#include "hb-private.hh"
+#include "hb.hh"
/*
@@ -278,4 +278,4 @@ struct hb_atomic_ptr_t
};
-#endif /* HB_ATOMIC_PRIVATE_HH */
+#endif /* HB_ATOMIC_HH */
diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 25c3e05aa..a335df308 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -30,8 +30,8 @@
#define _POSIX_C_SOURCE 200809L
#endif
-#include "hb-private.hh"
-#include "hb-blob-private.hh"
+#include "hb.hh"
+#include "hb-blob.hh"
#ifdef HAVE_SYS_MMAN_H
#ifdef HAVE_UNISTD_H
diff --git a/src/hb-blob-private.hh b/src/hb-blob.hh
similarity index 92%
rename from src/hb-blob-private.hh
rename to src/hb-blob.hh
index 49ad68ece..bee8c9794 100644
--- a/src/hb-blob-private.hh
+++ b/src/hb-blob.hh
@@ -26,10 +26,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_BLOB_PRIVATE_HH
-#define HB_BLOB_PRIVATE_HH
+#ifndef HB_BLOB_HH
+#define HB_BLOB_HH
-#include "hb-private.hh"
+#include "hb.hh"
/*
@@ -62,6 +62,10 @@ struct hb_blob_t
{
return unlikely (!data) ? &Null(Type) : reinterpret_cast (data);
}
+ inline hb_bytes_t as_bytes (void) const
+ {
+ return hb_bytes_t (data, length);
+ }
public:
hb_object_header_t header;
@@ -79,4 +83,4 @@ struct hb_blob_t
DECLARE_NULL_INSTANCE (hb_blob_t);
-#endif /* HB_BLOB_PRIVATE_HH */
+#endif /* HB_BLOB_HH */
diff --git a/src/hb-buffer-deserialize-json.hh b/src/hb-buffer-deserialize-json.hh
index 380f3c5fc..1f9e2e91d 100644
--- a/src/hb-buffer-deserialize-json.hh
+++ b/src/hb-buffer-deserialize-json.hh
@@ -29,7 +29,7 @@
#ifndef HB_BUFFER_DESERIALIZE_JSON_HH
#define HB_BUFFER_DESERIALIZE_JSON_HH
-#include "hb-private.hh"
+#include "hb.hh"
#line 36 "hb-buffer-deserialize-json.hh"
diff --git a/src/hb-buffer-deserialize-json.rl b/src/hb-buffer-deserialize-json.rl
index ec9bc7c9a..f3abb027b 100644
--- a/src/hb-buffer-deserialize-json.rl
+++ b/src/hb-buffer-deserialize-json.rl
@@ -27,7 +27,7 @@
#ifndef HB_BUFFER_DESERIALIZE_JSON_HH
#define HB_BUFFER_DESERIALIZE_JSON_HH
-#include "hb-private.hh"
+#include "hb.hh"
%%{
diff --git a/src/hb-buffer-deserialize-text.hh b/src/hb-buffer-deserialize-text.hh
index 5bca369f8..67f0a1252 100644
--- a/src/hb-buffer-deserialize-text.hh
+++ b/src/hb-buffer-deserialize-text.hh
@@ -29,7 +29,7 @@
#ifndef HB_BUFFER_DESERIALIZE_TEXT_HH
#define HB_BUFFER_DESERIALIZE_TEXT_HH
-#include "hb-private.hh"
+#include "hb.hh"
#line 36 "hb-buffer-deserialize-text.hh"
diff --git a/src/hb-buffer-deserialize-text.rl b/src/hb-buffer-deserialize-text.rl
index 1d90979a9..6268a6c50 100644
--- a/src/hb-buffer-deserialize-text.rl
+++ b/src/hb-buffer-deserialize-text.rl
@@ -27,7 +27,7 @@
#ifndef HB_BUFFER_DESERIALIZE_TEXT_HH
#define HB_BUFFER_DESERIALIZE_TEXT_HH
-#include "hb-private.hh"
+#include "hb.hh"
%%{
diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc
index 11471941d..1b6d14731 100644
--- a/src/hb-buffer-serialize.cc
+++ b/src/hb-buffer-serialize.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-buffer-private.hh"
+#include "hb-buffer.hh"
static const char *serialize_formats[] = {
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
index eb7b01caa..536ab5d53 100644
--- a/src/hb-buffer.cc
+++ b/src/hb-buffer.cc
@@ -27,8 +27,8 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-buffer-private.hh"
-#include "hb-utf-private.hh"
+#include "hb-buffer.hh"
+#include "hb-utf.hh"
/**
diff --git a/src/hb-buffer-private.hh b/src/hb-buffer.hh
similarity index 98%
rename from src/hb-buffer-private.hh
rename to src/hb-buffer.hh
index a6c4b6963..3e38fe1de 100644
--- a/src/hb-buffer-private.hh
+++ b/src/hb-buffer.hh
@@ -27,11 +27,11 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_BUFFER_PRIVATE_HH
-#define HB_BUFFER_PRIVATE_HH
+#ifndef HB_BUFFER_HH
+#define HB_BUFFER_HH
-#include "hb-private.hh"
-#include "hb-unicode-private.hh"
+#include "hb.hh"
+#include "hb-unicode.hh"
#ifndef HB_BUFFER_MAX_LEN_FACTOR
@@ -386,4 +386,4 @@ _next_cluster (hb_buffer_t *buffer, unsigned int start)
#define HB_BUFFER_ASSERT_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, assert_var, var ())
-#endif /* HB_BUFFER_PRIVATE_HH */
+#endif /* HB_BUFFER_HH */
diff --git a/src/hb-cff-interp-common-private.hh b/src/hb-cff-interp-common.hh
similarity index 100%
rename from src/hb-cff-interp-common-private.hh
rename to src/hb-cff-interp-common.hh
diff --git a/src/hb-cff-interp-cs-common-private.hh b/src/hb-cff-interp-cs-common.hh
similarity index 99%
rename from src/hb-cff-interp-cs-common-private.hh
rename to src/hb-cff-interp-cs-common.hh
index a8fd8ba6a..a1ab47281 100644
--- a/src/hb-cff-interp-cs-common-private.hh
+++ b/src/hb-cff-interp-cs-common.hh
@@ -26,8 +26,8 @@
#ifndef HB_CFF_INTERP_CS_COMMON_PRIVATE_HH
#define HB_CFF_INTERP_CS_COMMON_PRIVATE_HH
-#include "hb-private.hh"
-#include "hb-cff-interp-common-private.hh"
+#include "hb.hh"
+#include "hb-cff-interp-common.hh"
namespace CFF {
diff --git a/src/hb-cff-interp-dict-common-private.hh b/src/hb-cff-interp-dict-common.hh
similarity index 99%
rename from src/hb-cff-interp-dict-common-private.hh
rename to src/hb-cff-interp-dict-common.hh
index 1a61132ff..655729046 100644
--- a/src/hb-cff-interp-dict-common-private.hh
+++ b/src/hb-cff-interp-dict-common.hh
@@ -26,7 +26,7 @@
#ifndef HB_CFF_INTERP_DICT_COMMON_PRIVATE_HH
#define HB_CFF_INTERP_DICT_COMMON_PRIVATE_HH
-#include "hb-cff-interp-common-private.hh"
+#include "hb-cff-interp-common.hh"
namespace CFF {
diff --git a/src/hb-cff1-interp-cs.hh b/src/hb-cff1-interp-cs.hh
index ba93454c4..858623c8a 100644
--- a/src/hb-cff1-interp-cs.hh
+++ b/src/hb-cff1-interp-cs.hh
@@ -26,8 +26,8 @@
#ifndef HB_CFF1_INTERP_CS_HH
#define HB_CFF1_INTERP_CS_HH
-#include "hb-private.hh"
-#include "hb-cff-interp-cs-common-private.hh"
+#include "hb.hh"
+#include "hb-cff-interp-cs-common.hh"
namespace CFF {
diff --git a/src/hb-cff2-interp-cs.hh b/src/hb-cff2-interp-cs.hh
index 96e209b8f..aaff5ac7e 100644
--- a/src/hb-cff2-interp-cs.hh
+++ b/src/hb-cff2-interp-cs.hh
@@ -26,8 +26,8 @@
#ifndef HB_CFF2_INTERP_CS_HH
#define HB_CFF2_INTERP_CS_HH
-#include "hb-private.hh"
-#include "hb-cff-interp-cs-common-private.hh"
+#include "hb.hh"
+#include "hb-cff-interp-cs-common.hh"
namespace CFF {
diff --git a/src/hb-common.cc b/src/hb-common.cc
index 614b71b7f..ed3fed2a3 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -26,9 +26,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-machinery-private.hh"
+#include "hb-machinery.hh"
#include
#ifdef HAVE_XLOCALE_H
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 1b916a53d..a7ba85f83 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -28,8 +28,8 @@
#define HB_SHAPER coretext
-#include "hb-private.hh"
-#include "hb-shaper-impl-private.hh"
+#include "hb.hh"
+#include "hb-shaper-impl.hh"
#include "hb-coretext.h"
#include
diff --git a/src/hb-debug.hh b/src/hb-debug.hh
index 9056ffca2..49663d215 100644
--- a/src/hb-debug.hh
+++ b/src/hb-debug.hh
@@ -27,8 +27,8 @@
#ifndef HB_DEBUG_HH
#define HB_DEBUG_HH
-#include "hb-private.hh"
-#include "hb-atomic-private.hh"
+#include "hb.hh"
+#include "hb-atomic.hh"
#include "hb-dsalgs.hh"
diff --git a/src/hb-directwrite.cc b/src/hb-directwrite.cc
index baad81884..35197c238 100644
--- a/src/hb-directwrite.cc
+++ b/src/hb-directwrite.cc
@@ -22,9 +22,9 @@
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
-#include "hb-private.hh"
+#include "hb.hh"
#define HB_SHAPER directwrite
-#include "hb-shaper-impl-private.hh"
+#include "hb-shaper-impl.hh"
#include
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 8cbe6584b..7e06ff170 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -27,7 +27,7 @@
#ifndef HB_DSALGS_HH
#define HB_DSALGS_HH
-#include "hb-private.hh"
+#include "hb.hh"
/* Void! For when we need a expression-type of void. */
@@ -492,6 +492,15 @@ template
struct hb_auto_t : Type
{
hb_auto_t (void) { Type::init (); }
+ /* Explicitly allow the following only for pointer and references,
+ * to avoid any accidental copies.
+ *
+ * Apparently if we template for all types, then gcc seems to
+ * capture a reference argument in the type, but clang doesn't,
+ * causing unwanted copies and bugs that come with it. Ideally
+ * we should use C++11-style rvalue reference &&t1. */
+ template explicit hb_auto_t (T1 *t1) { Type::init (t1); }
+ template explicit hb_auto_t (T1 &t1) { Type::init (t1); }
~hb_auto_t (void) { Type::fini (); }
private: /* Hide */
void init (void) {}
@@ -502,6 +511,9 @@ struct hb_bytes_t
{
inline hb_bytes_t (void) : bytes (nullptr), len (0) {}
inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {}
+ inline hb_bytes_t (const void *bytes_, unsigned int len_) : bytes ((const char *) bytes_), len (len_) {}
+
+ inline void free (void) { ::free ((void *) bytes); bytes = nullptr; len = 0; }
inline int cmp (const hb_bytes_t &a) const
{
diff --git a/src/hb-face.cc b/src/hb-face.cc
index 49f29d3fa..2fb5a0a36 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -26,11 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-face-private.hh"
-#include "hb-blob-private.hh"
-#include "hb-open-file-private.hh"
+#include "hb-face.hh"
+#include "hb-blob.hh"
+#include "hb-open-file.hh"
+#include "hb-ot-face.hh"
+#include "hb-ot-cmap-table.hh"
/**
@@ -512,3 +514,208 @@ hb_face_get_table_tags (const hb_face_t *face,
return ot_face.get_table_tags (start_offset, table_count, table_tags);
}
+
+
+/*
+ * Character set.
+ */
+
+
+/**
+ * hb_face_collect_unicodes:
+ * @face: font face.
+ * @out: set to add Unicode characters covered by @face to.
+ *
+ * Since: REPLACEME
+ */
+void
+hb_face_collect_unicodes (hb_face_t *face,
+ hb_set_t *out)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
+ hb_ot_face_data (face)->cmap->collect_unicodes (out);
+}
+
+/**
+ * hb_face_collect_variation_selectors:
+ * @face: font face.
+ * @out: set to add Variation Selector characters covered by @face to.
+ *
+ *
+ *
+ * Since: REPLACEME
+ */
+void
+hb_face_collect_variation_selectors (hb_face_t *face,
+ hb_set_t *out)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
+ hb_ot_face_data (face)->cmap->collect_variation_selectors (out);
+}
+
+/**
+ * hb_face_collect_variation_unicodes:
+ * @face: font face.
+ * @out: set to add Unicode characters for @variation_selector covered by @face to.
+ *
+ *
+ *
+ * Since: REPLACEME
+ */
+void
+hb_face_collect_variation_unicodes (hb_face_t *face,
+ hb_codepoint_t variation_selector,
+ hb_set_t *out)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
+ hb_ot_face_data (face)->cmap->collect_variation_unicodes (variation_selector, out);
+}
+
+
+
+/*
+ * face-builder: A face that has add_table().
+ */
+
+struct hb_face_builder_data_t
+{
+ struct table_entry_t
+ {
+ inline int cmp (const hb_tag_t *t) const
+ {
+ if (*t < tag) return -1;
+ if (*t > tag) return -1;
+ return 0;
+ }
+
+ hb_tag_t tag;
+ hb_blob_t *blob;
+ };
+
+ hb_vector_t tables;
+};
+
+static hb_face_builder_data_t *
+_hb_face_builder_data_create (void)
+{
+ hb_face_builder_data_t *data = (hb_face_builder_data_t *) calloc (1, sizeof (hb_face_builder_data_t));
+ if (unlikely (!data))
+ return nullptr;
+
+ data->tables.init ();
+
+ return data;
+}
+
+static void
+_hb_face_builder_data_destroy (void *user_data)
+{
+ hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data;
+
+ for (unsigned int i = 0; i < data->tables.len; i++)
+ hb_blob_destroy (data->tables[i].blob);
+
+ data->tables.fini ();
+
+ free (data);
+}
+
+static hb_blob_t *
+_hb_face_builder_data_reference_blob (hb_face_builder_data_t *data)
+{
+
+ unsigned int table_count = data->tables.len;
+ unsigned int face_length = table_count * 16 + 12;
+
+ for (unsigned int i = 0; i < table_count; i++)
+ face_length += hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob));
+
+ char *buf = (char *) malloc (face_length);
+ if (unlikely (!buf))
+ return nullptr;
+
+ hb_serialize_context_t c (buf, face_length);
+ OT::OpenTypeFontFile *f = c.start_serialize ();
+
+ bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2'));
+ hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
+
+ Supplier tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0]));
+ Supplier blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0]));
+ bool ret = f->serialize_single (&c,
+ sfnt_tag,
+ tags_supplier,
+ blobs_supplier,
+ table_count);
+
+ c.end_serialize ();
+
+ if (unlikely (!ret))
+ {
+ free (buf);
+ return nullptr;
+ }
+
+ return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, free);
+}
+
+static hb_blob_t *
+_hb_face_builder_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data)
+{
+ hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data;
+
+ if (!tag)
+ return _hb_face_builder_data_reference_blob (data);
+
+ hb_face_builder_data_t::table_entry_t *entry = data->tables.lsearch (tag);
+ if (entry)
+ return hb_blob_reference (entry->blob);
+
+ return nullptr;
+}
+
+
+/**
+ * hb_face_builder_create:
+ *
+ * Creates a #hb_face_t that can be used with hb_face_builder_add_table().
+ * After tables are added to the face, it can be compiled to a binary
+ * font file by calling hb_face_reference_blob().
+ *
+ * Return value: (transfer full) New face.
+ *
+ * Since: REPLACEME
+ **/
+hb_face_t *
+hb_face_builder_create (void)
+{
+ hb_face_builder_data_t *data = _hb_face_builder_data_create ();
+ if (unlikely (!data)) return hb_face_get_empty ();
+
+ return hb_face_create_for_tables (_hb_face_builder_reference_table,
+ data,
+ _hb_face_builder_data_destroy);
+}
+
+/**
+ * hb_face_builder_add_table:
+ *
+ * Add table for @tag with data provided by @blob to the face. @face must
+ * be created using hb_face_builder_create().
+ *
+ * Since: REPLACEME
+ **/
+hb_bool_t
+hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
+{
+ if (unlikely (face->destroy != (hb_destroy_func_t) _hb_face_builder_data_destroy))
+ return false;
+
+ hb_face_builder_data_t *data = (hb_face_builder_data_t *) face->user_data;
+ hb_face_builder_data_t::table_entry_t *entry = data->tables.push ();
+
+ entry->tag = tag;
+ entry->blob = hb_blob_reference (blob);
+
+ return true;
+}
diff --git a/src/hb-face.h b/src/hb-face.h
index 208092efc..e8ff090d5 100644
--- a/src/hb-face.h
+++ b/src/hb-face.h
@@ -33,6 +33,7 @@
#include "hb-common.h"
#include "hb-blob.h"
+#include "hb-set.h"
HB_BEGIN_DECLS
@@ -120,6 +121,38 @@ hb_face_get_table_tags (const hb_face_t *face,
unsigned int *table_count, /* IN/OUT */
hb_tag_t *table_tags /* OUT */);
+
+/*
+ * Character set.
+ */
+
+HB_EXTERN void
+hb_face_collect_unicodes (hb_face_t *face,
+ hb_set_t *out);
+
+HB_EXTERN void
+hb_face_collect_variation_selectors (hb_face_t *face,
+ hb_set_t *out);
+
+HB_EXTERN void
+hb_face_collect_variation_unicodes (hb_face_t *face,
+ hb_codepoint_t variation_selector,
+ hb_set_t *out);
+
+
+/*
+ * Builder face.
+ */
+
+HB_EXTERN hb_face_t *
+hb_face_builder_create (void);
+
+HB_EXTERN hb_bool_t
+hb_face_builder_add_table (hb_face_t *face,
+ hb_tag_t tag,
+ hb_blob_t *blob);
+
+
HB_END_DECLS
#endif /* HB_FACE_H */
diff --git a/src/hb-face-private.hh b/src/hb-face.hh
similarity index 94%
rename from src/hb-face-private.hh
rename to src/hb-face.hh
index 086ce6e96..f90453dbd 100644
--- a/src/hb-face-private.hh
+++ b/src/hb-face.hh
@@ -26,13 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_FACE_PRIVATE_HH
-#define HB_FACE_PRIVATE_HH
+#ifndef HB_FACE_HH
+#define HB_FACE_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-shaper-private.hh"
-#include "hb-shape-plan-private.hh"
+#include "hb-shaper.hh"
+#include "hb-shape-plan.hh"
/*
@@ -105,4 +105,4 @@ DECLARE_NULL_INSTANCE (hb_face_t);
#undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
-#endif /* HB_FACE_PRIVATE_HH */
+#endif /* HB_FACE_HH */
diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc
index eff20f70c..dc8536c82 100644
--- a/src/hb-fallback-shape.cc
+++ b/src/hb-fallback-shape.cc
@@ -25,7 +25,7 @@
*/
#define HB_SHAPER fallback
-#include "hb-shaper-impl-private.hh"
+#include "hb-shaper-impl.hh"
HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face)
diff --git a/src/hb-font.cc b/src/hb-font.cc
index 857b8f577..bc831dd53 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -26,10 +26,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-font-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb-font.hh"
+#include "hb-machinery.hh"
/*
diff --git a/src/hb-font-private.hh b/src/hb-font.hh
similarity index 99%
rename from src/hb-font-private.hh
rename to src/hb-font.hh
index d3a413802..4c8d0aeec 100644
--- a/src/hb-font-private.hh
+++ b/src/hb-font.hh
@@ -26,13 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_FONT_PRIVATE_HH
-#define HB_FONT_PRIVATE_HH
+#ifndef HB_FONT_HH
+#define HB_FONT_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-face-private.hh"
-#include "hb-shaper-private.hh"
+#include "hb-face.hh"
+#include "hb-shaper.hh"
/*
@@ -601,4 +601,4 @@ DECLARE_NULL_INSTANCE (hb_font_t);
#undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
-#endif /* HB_FONT_PRIVATE_HH */
+#endif /* HB_FONT_HH */
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index c8740d15c..5d6abb29d 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -27,12 +27,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-ft.h"
-#include "hb-font-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb-font.hh"
+#include "hb-machinery.hh"
#include FT_ADVANCES_H
#include FT_MULTIPLE_MASTERS_H
diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index 81ec612d7..18f3a81db 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -26,12 +26,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-glib.h"
-#include "hb-unicode-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb-unicode.hh"
+#include "hb-machinery.hh"
#if !GLIB_CHECK_VERSION(2,29,14)
diff --git a/src/hb-gobject-enums.cc.tmpl b/src/hb-gobject-enums.cc.tmpl
index ca458a384..e056df478 100644
--- a/src/hb-gobject-enums.cc.tmpl
+++ b/src/hb-gobject-enums.cc.tmpl
@@ -25,7 +25,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
/* g++ didn't like older gtype.h gcc-only code path. */
#include
diff --git a/src/hb-gobject-structs.cc b/src/hb-gobject-structs.cc
index 0c8e55733..1b8758583 100644
--- a/src/hb-gobject-structs.cc
+++ b/src/hb-gobject-structs.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
/* g++ didn't like older gtype.h gcc-only code path. */
#include
diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc
index 1f42a36f3..817278f30 100644
--- a/src/hb-graphite2.cc
+++ b/src/hb-graphite2.cc
@@ -27,7 +27,7 @@
*/
#define HB_SHAPER graphite2
-#include "hb-shaper-impl-private.hh"
+#include "hb-shaper-impl.hh"
#include "hb-graphite2.h"
diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index bffae0714..564f71fe2 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -27,12 +27,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-icu.h"
-#include "hb-unicode-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb-unicode.hh"
+#include "hb-machinery.hh"
#include
#include
diff --git a/src/hb-iter-private.hh b/src/hb-iter.hh
similarity index 97%
rename from src/hb-iter-private.hh
rename to src/hb-iter.hh
index 314133ade..6fd6aed79 100644
--- a/src/hb-iter-private.hh
+++ b/src/hb-iter.hh
@@ -24,10 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_ITER_PRIVATE_HH
-#define HB_ITER_PRIVATE_HH
+#ifndef HB_ITER_HH
+#define HB_ITER_HH
-#include "hb-private.hh"
+#include "hb.hh"
/* Unified iterator object.
@@ -146,4 +146,4 @@ m (void)
}
}
-#endif /* HB_ITER_PRIVATE_HH */
+#endif /* HB_ITER_HH */
diff --git a/src/hb-machinery-private.hh b/src/hb-machinery.hh
similarity index 83%
rename from src/hb-machinery-private.hh
rename to src/hb-machinery.hh
index 99ef485a3..35a8b6c15 100644
--- a/src/hb-machinery-private.hh
+++ b/src/hb-machinery.hh
@@ -26,13 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_MACHINERY_PRIVATE_HH
-#define HB_MACHINERY_PRIVATE_HH
+#ifndef HB_MACHINERY_HH
+#define HB_MACHINERY_HH
-#include "hb-private.hh"
-#include "hb-blob-private.hh"
+#include "hb.hh"
+#include "hb-blob.hh"
-#include "hb-iter-private.hh"
+#include "hb-iter.hh"
/*
@@ -138,6 +138,68 @@ struct hb_dispatch_context_t
/*
* Sanitize
+ *
+ *
+ * === Introduction ===
+ *
+ * The sanitize machinery is at the core of our zero-cost font loading. We
+ * mmap() font file into memory and create a blob out of it. Font subtables
+ * are returned as a readonly sub-blob of the main font blob. These table
+ * blobs are then sanitized before use, to ensure invalid memory access does
+ * not happen. The toplevel sanitize API use is like, eg. to load the 'head'
+ * table:
+ *
+ * hb_blob_t *head_blob = hb_sanitize_context_t ().reference_table (face);
+ *
+ * The blob then can be converted to a head table struct with:
+ *
+ * const head *head_table = head_blob->as ();
+ *
+ * What the reference_table does is, to call hb_face_reference_table() to load
+ * the table blob, sanitize it and return either the sanitized blob, or empty
+ * blob if sanitization failed. The blob->as() function returns the null
+ * object of its template type argument if the blob is empty. Otherwise, it
+ * just casts the blob contents to the desired type.
+ *
+ * Sanitizing a blob of data with a type T works as follows (with minor
+ * simplification):
+ *
+ * - Cast blob content to T*, call sanitize() method of it,
+ * - If sanitize succeeded, return blob.
+ * - Otherwise, if blob is not writable, try making it writable,
+ * or copy if cannot be made writable in-place,
+ * - Call sanitize() again. Return blob if sanitize succeeded.
+ * - Return empty blob otherwise.
+ *
+ *
+ * === The sanitize() contract ===
+ *
+ * The sanitize() method of each object type shall return true if it's safe to
+ * call other methods of the object, and false otherwise.
+ *
+ * Note that what sanitize() checks for might align with what the specification
+ * describes as valid table data, but does not have to be. In particular, we
+ * do NOT want to be pedantic and concern ourselves with validity checks that
+ * are irrelevant to our use of the table. On the contrary, we want to be
+ * lenient with error handling and accept invalid data to the extent that it
+ * does not impose extra burden on us.
+ *
+ * Based on the sanitize contract, one can see that what we check for depends
+ * on how we use the data in other table methods. Ie. if other table methods
+ * assume that offsets do NOT point out of the table data block, then that's
+ * something sanitize() must check for (GSUB/GPOS/GDEF/etc work this way). On
+ * the other hand, if other methods do such checks themselves, then sanitize()
+ * does not have to bother with them (glyf/local work this way). The choice
+ * depends on the table structure and sanitize() performance. For example, to
+ * check glyf/loca offsets in sanitize() would cost O(num-glyphs). We try hard
+ * to avoid such costs during font loading. By postponing such checks to the
+ * actual glyph loading, we reduce the sanitize cost to O(1) and total runtime
+ * cost to O(used-glyphs). As such, this is preferred.
+ *
+ * The same argument can be made re GSUB/GPOS/GDEF, but there, the table
+ * structure is so complicated that by checking all offsets at sanitize() time,
+ * we make the code much simpler in other methods, as offsets and referenced
+ * objectes do not need to be validated at each use site.
*/
/* This limits sanitizing time on really broken fonts. */
@@ -402,7 +464,7 @@ struct hb_serialize_context_t
}
template
- inline Type *copy (void)
+ inline Type *copy (void) const
{
assert (!this->ran_out_of_room);
unsigned int len = this->head - this->start;
@@ -411,6 +473,25 @@ struct hb_serialize_context_t
memcpy (p, this->start, len);
return reinterpret_cast (p);
}
+ inline hb_bytes_t copy_bytes (void) const
+ {
+ assert (!this->ran_out_of_room);
+ unsigned int len = this->head - this->start;
+ void *p = malloc (len);
+ if (p)
+ memcpy (p, this->start, len);
+ else
+ return hb_bytes_t ();
+ return hb_bytes_t (p, len);
+ }
+ inline hb_blob_t *copy_blob (void) const
+ {
+ assert (!this->ran_out_of_room);
+ return hb_blob_create (this->start,
+ this->head - this->start,
+ HB_MEMORY_MODE_DUPLICATE,
+ nullptr, nullptr);
+ }
template
inline Type *allocate_size (unsigned int size)
@@ -682,6 +763,10 @@ struct hb_lazy_loader_t : hb_data_wrapper_t
}
return p;
}
+ inline Stored * get_stored_relaxed (void) const
+ {
+ return this->instance.get_relaxed ();
+ }
inline void set_stored (Stored *instance_)
{
@@ -695,6 +780,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t
}
inline const Returned * get (void) const { return Funcs::convert (get_stored ()); }
+ inline const Returned * get_relaxed (void) const { return Funcs::convert (get_stored_relaxed ()); }
inline Returned * get_unconst (void) const { return const_cast (Funcs::convert (get_stored ())); }
/* To be possibly overloaded by subclasses. */
@@ -729,9 +815,9 @@ struct hb_lazy_loader_t : hb_data_wrapper_t
/* Specializations. */
-template
+template
struct hb_face_lazy_loader_t : hb_lazy_loader_t,
+ hb_face_lazy_loader_t,
hb_face_t, WheresFace> {};
template
@@ -789,4 +875,4 @@ struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t
@@ -251,4 +251,4 @@ struct hb_map_t
};
-#endif /* HB_MAP_PRIVATE_HH */
+#endif /* HB_MAP_HH */
diff --git a/src/hb-mutex-private.hh b/src/hb-mutex.hh
similarity index 97%
rename from src/hb-mutex-private.hh
rename to src/hb-mutex.hh
index 14bde3103..d8cdf4b64 100644
--- a/src/hb-mutex-private.hh
+++ b/src/hb-mutex.hh
@@ -29,10 +29,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_MUTEX_PRIVATE_HH
-#define HB_MUTEX_PRIVATE_HH
+#ifndef HB_MUTEX_HH
+#define HB_MUTEX_HH
-#include "hb-private.hh"
+#include "hb.hh"
/* mutex */
@@ -138,4 +138,4 @@ struct hb_mutex_t
};
-#endif /* HB_MUTEX_PRIVATE_HH */
+#endif /* HB_MUTEX_HH */
diff --git a/src/hb-null.hh b/src/hb-null.hh
index 713c88e39..5a7558d38 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -27,7 +27,7 @@
#ifndef HB_NULL_HH
#define HB_NULL_HH
-#include "hb-private.hh"
+#include "hb.hh"
/*
diff --git a/src/hb-object-private.hh b/src/hb-object.hh
similarity index 97%
rename from src/hb-object-private.hh
rename to src/hb-object.hh
index 4955a68dc..ca85af691 100644
--- a/src/hb-object-private.hh
+++ b/src/hb-object.hh
@@ -29,13 +29,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OBJECT_PRIVATE_HH
-#define HB_OBJECT_PRIVATE_HH
+#ifndef HB_OBJECT_HH
+#define HB_OBJECT_HH
-#include "hb-private.hh"
-#include "hb-atomic-private.hh"
-#include "hb-mutex-private.hh"
-#include "hb-vector-private.hh"
+#include "hb.hh"
+#include "hb-atomic.hh"
+#include "hb-mutex.hh"
+#include "hb-vector.hh"
/*
@@ -322,4 +322,4 @@ static inline void *hb_object_get_user_data (Type *obj,
}
-#endif /* HB_OBJECT_PRIVATE_HH */
+#endif /* HB_OBJECT_HH */
diff --git a/src/hb-open-file-private.hh b/src/hb-open-file.hh
similarity index 99%
rename from src/hb-open-file-private.hh
rename to src/hb-open-file.hh
index d47bff66e..97e736eeb 100644
--- a/src/hb-open-file-private.hh
+++ b/src/hb-open-file.hh
@@ -26,10 +26,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OPEN_FILE_PRIVATE_HH
-#define HB_OPEN_FILE_PRIVATE_HH
+#ifndef HB_OPEN_FILE_HH
+#define HB_OPEN_FILE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-head-table.hh"
@@ -565,4 +565,4 @@ struct OpenTypeFontFile
} /* namespace OT */
-#endif /* HB_OPEN_FILE_PRIVATE_HH */
+#endif /* HB_OPEN_FILE_HH */
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type.hh
similarity index 98%
rename from src/hb-open-type-private.hh
rename to src/hb-open-type.hh
index 5580565f1..48a8eaa76 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type.hh
@@ -26,13 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OPEN_TYPE_PRIVATE_HH
-#define HB_OPEN_TYPE_PRIVATE_HH
+#ifndef HB_OPEN_TYPE_HH
+#define HB_OPEN_TYPE_HH
-#include "hb-private.hh"
-#include "hb-blob-private.hh"
-#include "hb-face-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb.hh"
+#include "hb-blob.hh"
+#include "hb-face.hh"
+#include "hb-machinery.hh"
namespace OT {
@@ -646,4 +646,4 @@ struct BinSearchArrayOf : SortedArrayOf {};
} /* namespace OT */
-#endif /* HB_OPEN_TYPE_PRIVATE_HH */
+#endif /* HB_OPEN_TYPE_HH */
diff --git a/src/hb-ot-cff-common-private.hh b/src/hb-ot-cff-common.hh
similarity index 99%
rename from src/hb-ot-cff-common-private.hh
rename to src/hb-ot-cff-common.hh
index 09bcc226d..b5ab0e7d0 100644
--- a/src/hb-ot-cff-common-private.hh
+++ b/src/hb-ot-cff-common.hh
@@ -26,9 +26,9 @@
#ifndef HB_OT_CFF_COMMON_PRIVATE_HH
#define HB_OT_CFF_COMMON_PRIVATE_HH
-#include "hb-open-type-private.hh"
-#include "hb-ot-layout-common-private.hh"
-#include "hb-cff-interp-dict-common-private.hh"
+#include "hb-open-type.hh"
+#include "hb-ot-layout-common.hh"
+#include "hb-cff-interp-dict-common.hh"
#include "hb-subset-plan.hh"
namespace CFF {
diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh
index f2a255c70..dd42a479a 100644
--- a/src/hb-ot-cff1-table.hh
+++ b/src/hb-ot-cff1-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_CFF1_TABLE_HH
#define HB_OT_CFF1_TABLE_HH
-#include "hb-ot-cff-common-private.hh"
+#include "hb-ot-cff-common.hh"
#include "hb-subset-cff1.hh"
namespace CFF {
diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh
index da4acf41c..bf0a97dd2 100644
--- a/src/hb-ot-cff2-table.hh
+++ b/src/hb-ot-cff2-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_CFF2_TABLE_HH
#define HB_OT_CFF2_TABLE_HH
-#include "hb-ot-cff-common-private.hh"
+#include "hb-ot-cff-common.hh"
#include "hb-subset-cff2.hh"
namespace CFF {
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 67a9c7dd9..aca5de2e3 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -27,8 +27,8 @@
#ifndef HB_OT_CMAP_TABLE_HH
#define HB_OT_CMAP_TABLE_HH
-#include "hb-open-type-private.hh"
-#include "hb-set-private.hh"
+#include "hb-open-type.hh"
+#include "hb-set.hh"
#include "hb-subset-plan.hh"
/*
@@ -37,10 +37,6 @@
*/
#define HB_OT_TAG_cmap HB_TAG('c','m','a','p')
-#ifndef HB_MAX_UNICODE_CODEPOINT_VALUE
-#define HB_MAX_UNICODE_CODEPOINT_VALUE 0x10FFFF
-#endif
-
namespace OT {
@@ -52,7 +48,13 @@ struct CmapSubtableFormat0
if (!gid)
return false;
*glyph = gid;
- return true;
+ return *glyph != 0;
+ }
+ inline void collect_unicodes (hb_set_t *out) const
+ {
+ for (unsigned int i = 0; i < 256; i++)
+ if (glyphIdArray[i])
+ out->add (i);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -237,15 +239,14 @@ struct CmapSubtableFormat4
glyphIdArray = idRangeOffset + segCount;
glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2;
}
+ inline void fini (void) {}
- static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph)
+ inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
- const accelerator_t *thiz = (const accelerator_t *) obj;
-
/* Custom two-array bsearch. */
- int min = 0, max = (int) thiz->segCount - 1;
- const HBUINT16 *startCount = thiz->startCount;
- const HBUINT16 *endCount = thiz->endCount;
+ int min = 0, max = (int) this->segCount - 1;
+ const HBUINT16 *startCount = this->startCount;
+ const HBUINT16 *endCount = this->endCount;
unsigned int i;
while (min <= max)
{
@@ -264,33 +265,53 @@ struct CmapSubtableFormat4
found:
hb_codepoint_t gid;
- unsigned int rangeOffset = thiz->idRangeOffset[i];
+ unsigned int rangeOffset = this->idRangeOffset[i];
if (rangeOffset == 0)
- gid = codepoint + thiz->idDelta[i];
+ gid = codepoint + this->idDelta[i];
else
{
/* Somebody has been smoking... */
- unsigned int index = rangeOffset / 2 + (codepoint - thiz->startCount[i]) + i - thiz->segCount;
- if (unlikely (index >= thiz->glyphIdArrayLength))
+ unsigned int index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount;
+ if (unlikely (index >= this->glyphIdArrayLength))
return false;
- gid = thiz->glyphIdArray[index];
+ gid = this->glyphIdArray[index];
if (unlikely (!gid))
return false;
- gid += thiz->idDelta[i];
+ gid += this->idDelta[i];
}
*glyph = gid & 0xFFFFu;
- return true;
+ return *glyph != 0;
}
-
- static inline void get_all_codepoints_func (const void *obj, hb_set_t *out)
+ static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph)
{
- const accelerator_t *thiz = (const accelerator_t *) obj;
- for (unsigned int i = 0; i < thiz->segCount; i++)
+ return ((const accelerator_t *) obj)->get_glyph (codepoint, glyph);
+ }
+ inline void collect_unicodes (hb_set_t *out) const
+ {
+ unsigned int count = this->segCount;
+ if (count && this->startCount[count - 1] == 0xFFFFu)
+ count--; /* Skip sentinel segment. */
+ for (unsigned int i = 0; i < count; i++)
{
- if (thiz->startCount[i] != 0xFFFFu
- || thiz->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF)
- hb_set_add_range (out, thiz->startCount[i], thiz->endCount[i]);
+ unsigned int rangeOffset = this->idRangeOffset[i];
+ if (rangeOffset == 0)
+ out->add_range (this->startCount[i], this->endCount[i]);
+ else
+ {
+ for (hb_codepoint_t codepoint = this->startCount[i];
+ codepoint <= this->endCount[i];
+ codepoint++)
+ {
+ unsigned int index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount;
+ if (unlikely (index >= this->glyphIdArrayLength))
+ break;
+ hb_codepoint_t gid = this->glyphIdArray[index];
+ if (unlikely (!gid))
+ continue;
+ out->add (codepoint);
+ }
+ }
}
}
@@ -305,10 +326,14 @@ struct CmapSubtableFormat4
inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
{
- accelerator_t accel;
- accel.init (this);
+ hb_auto_t accel (this);
return accel.get_glyph_func (&accel, codepoint, glyph);
}
+ inline void collect_unicodes (hb_set_t *out) const
+ {
+ hb_auto_t accel (this);
+ accel.collect_unicodes (out);
+ }
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -383,7 +408,7 @@ struct CmapSubtableLongGroup
HBUINT32 startCharCode; /* First character code in this group. */
HBUINT32 endCharCode; /* Last character code in this group. */
HBUINT32 glyphID; /* Glyph index; interpretation depends on
- * subtable format. */
+ * subtable format. */
public:
DEFINE_SIZE_STATIC (12);
};
@@ -398,7 +423,15 @@ struct CmapSubtableTrimmed
if (!gid)
return false;
*glyph = gid;
- return true;
+ return *glyph != 0;
+ }
+ inline void collect_unicodes (hb_set_t *out) const
+ {
+ hb_codepoint_t start = startCharCode;
+ unsigned int count = glyphIdArray.len;
+ for (unsigned int i = 0; i < count; i++)
+ if (glyphIdArray[i])
+ out->add (start + i);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -433,17 +466,15 @@ struct CmapSubtableLongSegmented
if (i == -1)
return false;
*glyph = T::group_get_glyph (groups[i], codepoint);
- return true;
+ return *glyph != 0;
}
- inline void get_all_codepoints (hb_set_t *out) const
+ inline void collect_unicodes (hb_set_t *out) const
{
for (unsigned int i = 0; i < this->groups.len; i++) {
- hb_set_add_range (out,
- MIN ((unsigned int) this->groups[i].startCharCode,
- (unsigned int) HB_MAX_UNICODE_CODEPOINT_VALUE),
- MIN ((unsigned int) this->groups[i].endCharCode,
- (unsigned int) HB_MAX_UNICODE_CODEPOINT_VALUE));
+ out->add_range (this->groups[i].startCharCode,
+ MIN ((hb_codepoint_t) this->groups[i].endCharCode,
+ (hb_codepoint_t) HB_UNICODE_MAX));
}
}
@@ -574,13 +605,29 @@ struct UnicodeValueRange
}
HBUINT24 startUnicodeValue; /* First value in this range. */
- HBUINT8 additionalCount; /* Number of additional values in this
+ HBUINT8 additionalCount; /* Number of additional values in this
* range. */
public:
DEFINE_SIZE_STATIC (4);
};
-typedef SortedArrayOf DefaultUVS;
+struct DefaultUVS : SortedArrayOf
+{
+ inline void collect_unicodes (hb_set_t *out) const
+ {
+ unsigned int count = len;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ hb_codepoint_t first = arrayZ[i].startUnicodeValue;
+ hb_codepoint_t last = MIN ((hb_codepoint_t) (first + arrayZ[i].additionalCount),
+ (hb_codepoint_t) HB_UNICODE_MAX);
+ out->add_range (first, last);
+ }
+ }
+
+ public:
+ DEFINE_SIZE_ARRAY (4, arrayZ);
+};
struct UVSMapping
{
@@ -601,7 +648,18 @@ struct UVSMapping
DEFINE_SIZE_STATIC (5);
};
-typedef SortedArrayOf NonDefaultUVS;
+struct NonDefaultUVS : SortedArrayOf
+{
+ inline void collect_unicodes (hb_set_t *out) const
+ {
+ unsigned int count = len;
+ for (unsigned int i = 0; i < count; i++)
+ out->add (arrayZ[i].glyphID);
+ }
+
+ public:
+ DEFINE_SIZE_ARRAY (4, arrayZ);
+};
struct VariationSelectorRecord
{
@@ -624,6 +682,12 @@ struct VariationSelectorRecord
return GLYPH_VARIANT_NOT_FOUND;
}
+ inline void collect_unicodes (hb_set_t *out, const void *base) const
+ {
+ (base+defaultUVS).collect_unicodes (out);
+ (base+nonDefaultUVS).collect_unicodes (out);
+ }
+
inline int cmp (const hb_codepoint_t &variation_selector) const
{
return varSelector.cmp (variation_selector);
@@ -652,7 +716,19 @@ struct CmapSubtableFormat14
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph) const
{
- return record[record.bsearch(variation_selector)].get_glyph (codepoint, glyph, this);
+ return record[record.bsearch (variation_selector)].get_glyph (codepoint, glyph, this);
+ }
+
+ inline void collect_variation_selectors (hb_set_t *out) const
+ {
+ unsigned int count = record.len;
+ for (unsigned int i = 0; i < count; i++)
+ out->add (record.arrayZ[i].varSelector);
+ }
+ inline void collect_variation_unicodes (hb_codepoint_t variation_selector,
+ hb_set_t *out) const
+ {
+ record[record.bsearch (variation_selector)].collect_unicodes (out, this);
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -690,6 +766,19 @@ struct CmapSubtable
default: return false;
}
}
+ inline void collect_unicodes (hb_set_t *out) const
+ {
+ switch (u.format) {
+ case 0: u.format0 .collect_unicodes (out); return;
+ case 4: u.format4 .collect_unicodes (out); return;
+ case 6: u.format6 .collect_unicodes (out); return;
+ case 10: u.format10.collect_unicodes (out); return;
+ case 12: u.format12.collect_unicodes (out); return;
+ case 13: u.format13.collect_unicodes (out); return;
+ case 14:
+ default: return;
+ }
+ }
inline bool sanitize (hb_sanitize_context_t *c) const
{
@@ -754,7 +843,8 @@ struct cmap
{
static const hb_tag_t tableTag = HB_OT_TAG_cmap;
- struct subset_plan {
+ struct subset_plan
+ {
subset_plan(void)
{
format4_segments.init();
@@ -895,33 +985,44 @@ struct cmap
return result;
}
+ const CmapSubtable *find_best_subtable (bool *symbol = nullptr) const
+ {
+ if (symbol) *symbol = false;
+
+ const CmapSubtable *subtable;
+
+ /* 32-bit subtables. */
+ if ((subtable = this->find_subtable (3, 10))) return subtable;
+ if ((subtable = this->find_subtable (0, 6))) return subtable;
+ if ((subtable = this->find_subtable (0, 4))) return subtable;
+
+ /* 16-bit subtables. */
+ if ((subtable = this->find_subtable (3, 1))) return subtable;
+ if ((subtable = this->find_subtable (0, 3))) return subtable;
+ if ((subtable = this->find_subtable (0, 2))) return subtable;
+ if ((subtable = this->find_subtable (0, 1))) return subtable;
+ if ((subtable = this->find_subtable (0, 0))) return subtable;
+
+ /* Symbol subtable. */
+ if ((subtable = this->find_subtable (3, 0)))
+ {
+ if (symbol) *symbol = true;
+ return subtable;
+ }
+
+ /* Meh. */
+ return &Null(CmapSubtable);
+ }
+
struct accelerator_t
{
inline void init (hb_face_t *face)
{
this->blob = hb_sanitize_context_t().reference_table (face);
const cmap *table = this->blob->as ();
- const CmapSubtable *subtable = nullptr;
const CmapSubtableFormat14 *subtable_uvs = nullptr;
-
- bool symbol = false;
- /* 32-bit subtables. */
- if (!subtable) subtable = table->find_subtable (3, 10);
- if (!subtable) subtable = table->find_subtable (0, 6);
- if (!subtable) subtable = table->find_subtable (0, 4);
- /* 16-bit subtables. */
- if (!subtable) subtable = table->find_subtable (3, 1);
- if (!subtable) subtable = table->find_subtable (0, 3);
- if (!subtable) subtable = table->find_subtable (0, 2);
- if (!subtable) subtable = table->find_subtable (0, 1);
- if (!subtable) subtable = table->find_subtable (0, 0);
- if (!subtable)
- {
- subtable = table->find_subtable (3, 0);
- if (subtable) symbol = true;
- }
- /* Meh. */
- if (!subtable) subtable = &Null(CmapSubtable);
+ bool symbol;
+ subtable = table->find_best_subtable (&symbol);
/* UVS subtable. */
if (!subtable_uvs)
@@ -933,30 +1034,26 @@ struct cmap
/* Meh. */
if (!subtable_uvs) subtable_uvs = &Null(CmapSubtableFormat14);
- this->uvs_table = subtable_uvs;
+ this->subtable_uvs = subtable_uvs;
this->get_glyph_data = subtable;
if (unlikely (symbol))
{
this->get_glyph_func = get_glyph_from_symbol;
- this->get_all_codepoints_func = null_get_all_codepoints_func;
} else {
switch (subtable->u.format) {
/* Accelerate format 4 and format 12. */
default:
this->get_glyph_func = get_glyph_from;
- this->get_all_codepoints_func = null_get_all_codepoints_func;
break;
case 12:
this->get_glyph_func = get_glyph_from;
- this->get_all_codepoints_func = get_all_codepoints_from;
break;
case 4:
{
this->format4_accel.init (&subtable->u.format4);
this->get_glyph_data = &this->format4_accel;
this->get_glyph_func = this->format4_accel.get_glyph_func;
- this->get_all_codepoints_func = this->format4_accel.get_all_codepoints_func;
}
break;
}
@@ -978,7 +1075,7 @@ struct cmap
hb_codepoint_t variation_selector,
hb_codepoint_t *glyph) const
{
- switch (this->uvs_table->get_glyph_variant (unicode,
+ switch (this->subtable_uvs->get_glyph_variant (unicode,
variation_selector,
glyph))
{
@@ -990,22 +1087,24 @@ struct cmap
return get_nominal_glyph (unicode, glyph);
}
- inline void get_all_codepoints (hb_set_t *out) const
+ inline void collect_unicodes (hb_set_t *out) const
{
- this->get_all_codepoints_func (get_glyph_data, out);
+ subtable->collect_unicodes (out);
+ }
+ inline void collect_variation_selectors (hb_set_t *out) const
+ {
+ subtable_uvs->collect_variation_selectors (out);
+ }
+ inline void collect_variation_unicodes (hb_codepoint_t variation_selector,
+ hb_set_t *out) const
+ {
+ subtable_uvs->collect_variation_unicodes (variation_selector, out);
}
protected:
typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
hb_codepoint_t codepoint,
hb_codepoint_t *glyph);
- typedef void (*hb_cmap_get_all_codepoints_func_t) (const void *obj,
- hb_set_t *out);
-
- static inline void null_get_all_codepoints_func (const void *obj, hb_set_t *out)
- {
- // NOOP
- }
template
static inline bool get_glyph_from (const void *obj,
@@ -1016,14 +1115,6 @@ struct cmap
return typed_obj->get_glyph (codepoint, glyph);
}
- template
- static inline void get_all_codepoints_from (const void *obj,
- hb_set_t *out)
- {
- const Type *typed_obj = (const Type *) obj;
- typed_obj->get_all_codepoints (out);
- }
-
template
static inline bool get_glyph_from_symbol (const void *obj,
hb_codepoint_t codepoint,
@@ -1047,13 +1138,14 @@ struct cmap
}
private:
+ const CmapSubtable *subtable;
+ const CmapSubtableFormat14 *subtable_uvs;
+
hb_cmap_get_glyph_func_t get_glyph_func;
const void *get_glyph_data;
- hb_cmap_get_all_codepoints_func_t get_all_codepoints_func;
CmapSubtableFormat4::accelerator_t format4_accel;
- const CmapSubtableFormat14 *uvs_table;
hb_blob_t *blob;
};
@@ -1066,10 +1158,7 @@ struct cmap
key.platformID.set (platform_id);
key.encodingID.set (encoding_id);
- /* Note: We can use bsearch, but since it has no performance
- * implications, we use lsearch and as such accept fonts with
- * unsorted subtable list. */
- int result = encodingRecord./*bsearch*/lsearch (key);
+ int result = encodingRecord.bsearch (key);
if (result == -1 || !encodingRecord[result].subtable)
return nullptr;
@@ -1084,6 +1173,7 @@ struct cmap
DEFINE_SIZE_ARRAY (4, encodingRecord);
};
+struct cmap_accelerator_t : cmap::accelerator_t {};
} /* namespace OT */
diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh
index 21c2f4773..8bedf2224 100644
--- a/src/hb-ot-color-cbdt-table.hh
+++ b/src/hb-ot-color-cbdt-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_COLOR_CBDT_TABLE_HH
#define HB_OT_COLOR_CBDT_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* CBLC -- Color Bitmap Location
@@ -533,6 +533,8 @@ struct CBDT
DEFINE_SIZE_ARRAY(4, dataZ);
};
+struct CBDT_accelerator_t : CBDT::accelerator_t {};
+
} /* namespace OT */
#endif /* HB_OT_COLOR_CBDT_TABLE_HH */
diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh
index ce6702d2a..070226f18 100644
--- a/src/hb-ot-color-colr-table.hh
+++ b/src/hb-ot-color-colr-table.hh
@@ -25,7 +25,7 @@
#ifndef HB_OT_COLOR_COLR_TABLE_HH
#define HB_OT_COLOR_COLR_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* COLR -- Color
diff --git a/src/hb-ot-color-cpal-table.hh b/src/hb-ot-color-cpal-table.hh
index 2c312748d..2c9fced09 100644
--- a/src/hb-ot-color-cpal-table.hh
+++ b/src/hb-ot-color-cpal-table.hh
@@ -28,7 +28,7 @@
#ifndef HB_OT_COLOR_CPAL_TABLE_HH
#define HB_OT_COLOR_CPAL_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh
index 0461afa32..1b643c77a 100644
--- a/src/hb-ot-color-sbix-table.hh
+++ b/src/hb-ot-color-sbix-table.hh
@@ -25,7 +25,7 @@
#ifndef HB_OT_COLOR_SBIX_TABLE_HH
#define HB_OT_COLOR_SBIX_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* sbix -- Standard Bitmap Graphics
diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh
index 3976694f8..ad9162f7c 100644
--- a/src/hb-ot-color-svg-table.hh
+++ b/src/hb-ot-color-svg-table.hh
@@ -25,7 +25,7 @@
#ifndef HB_OT_COLOR_SVG_TABLE_HH
#define HB_OT_COLOR_SVG_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* SVG -- SVG (Scalable Vector Graphics)
diff --git a/src/hb-ot-color.cc b/src/hb-ot-color.cc
index 86171c633..7cdff380e 100644
--- a/src/hb-ot-color.cc
+++ b/src/hb-ot-color.cc
@@ -25,7 +25,7 @@
* Google Author(s): Sascha Brawer
*/
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-color-colr-table.hh"
#include "hb-ot-color-cpal-table.hh"
#include "hb-ot.h"
@@ -33,8 +33,8 @@
#include
#include
-#include "hb-ot-layout-private.hh"
-#include "hb-shaper-private.hh"
+#include "hb-ot-layout.hh"
+#include "hb-shaper.hh"
#if 0
HB_MARK_AS_FLAG_T (hb_ot_color_palette_flags_t)
@@ -45,16 +45,14 @@ static inline const OT::COLR&
_get_colr (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::COLR);
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- return *(layout->colr.get ());
+ return *(hb_ot_face_data (face)->colr.get ());
}
static inline const OT::CPAL&
_get_cpal (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CPAL);
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- return *(layout->cpal.get ());
+ return *(hb_ot_face_data (face)->cpal.get ());
}
diff --git a/src/hb-ot-face.cc b/src/hb-ot-face.cc
new file mode 100644
index 000000000..388a59720
--- /dev/null
+++ b/src/hb-ot-face.cc
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 2018 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-face.hh"
+
+#include "hb-ot-cmap-table.hh"
+#include "hb-ot-glyf-table.hh"
+#include "hb-ot-hmtx-table.hh"
+#include "hb-ot-kern-table.hh"
+#include "hb-ot-post-table.hh"
+#include "hb-ot-color-cbdt-table.hh"
+#include "hb-ot-layout-gdef-table.hh"
+#include "hb-ot-layout-gsub-table.hh"
+#include "hb-ot-layout-gpos-table.hh"
+
+
+void hb_ot_face_data_t::init0 (hb_face_t *face)
+{
+ this->face = face;
+#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 ();
+#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type)
+ HB_OT_LAYOUT_TABLES
+#undef HB_OT_LAYOUT_ACCELERATOR
+#undef HB_OT_LAYOUT_TABLE
+}
+void hb_ot_face_data_t::fini (void)
+{
+#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini ();
+#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type)
+ HB_OT_LAYOUT_TABLES
+#undef HB_OT_LAYOUT_ACCELERATOR
+#undef HB_OT_LAYOUT_TABLE
+}
+
+hb_ot_face_data_t *
+_hb_ot_face_data_create (hb_face_t *face)
+{
+ hb_ot_face_data_t *data = (hb_ot_face_data_t *) calloc (1, sizeof (hb_ot_face_data_t));
+ if (unlikely (!data))
+ return nullptr;
+
+ data->init0 (face);
+
+ return data;
+}
+
+void
+_hb_ot_face_data_destroy (hb_ot_face_data_t *data)
+{
+ data->fini ();
+ free (data);
+}
+
diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh
new file mode 100644
index 000000000..5ac3538e4
--- /dev/null
+++ b/src/hb-ot-face.hh
@@ -0,0 +1,116 @@
+/*
+ * Copyright © 2007,2008,2009 Red Hat, Inc.
+ * Copyright © 2012,2013 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.
+ *
+ * Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_FACE_HH
+#define HB_OT_FACE_HH
+
+#include "hb.hh"
+
+#include "hb-machinery.hh"
+
+
+#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ())
+
+
+/*
+ * hb_ot_face_data_t
+ */
+
+/* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*.
+ * This is as good as any place. */
+#define HB_OT_LAYOUT_TABLES \
+ /* OpenType shaping. */ \
+ HB_OT_LAYOUT_TABLE(OT, JSTF) \
+ HB_OT_LAYOUT_TABLE(OT, BASE) \
+ /* AAT shaping. */ \
+ HB_OT_LAYOUT_TABLE(AAT, morx) \
+ HB_OT_LAYOUT_TABLE(AAT, kerx) \
+ HB_OT_LAYOUT_TABLE(AAT, ankr) \
+ HB_OT_LAYOUT_TABLE(AAT, trak) \
+ /* OpenType variations. */ \
+ HB_OT_LAYOUT_TABLE(OT, fvar) \
+ HB_OT_LAYOUT_TABLE(OT, avar) \
+ HB_OT_LAYOUT_TABLE(OT, MVAR) \
+ /* OpenType math. */ \
+ HB_OT_LAYOUT_TABLE(OT, MATH) \
+ /* OpenType fundamentals. */ \
+ HB_OT_LAYOUT_ACCELERATOR(OT, GDEF) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, hmtx) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, vmtx) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, post) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, kern) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, glyf) \
+ HB_OT_LAYOUT_ACCELERATOR(OT, CBDT) \
+ /* */
+
+/* Declare tables. */
+#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; }
+#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type##_accelerator_t)
+HB_OT_LAYOUT_TABLES
+#undef HB_OT_LAYOUT_ACCELERATOR
+#undef HB_OT_LAYOUT_TABLE
+
+struct hb_ot_face_data_t
+{
+ HB_INTERNAL void init0 (hb_face_t *face);
+ HB_INTERNAL void fini (void);
+
+#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \
+ HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type)))
+ enum order_t
+ {
+ ORDER_ZERO,
+#define HB_OT_LAYOUT_TABLE(Namespace, Type) HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type),
+#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type)
+ HB_OT_LAYOUT_TABLES
+#undef HB_OT_LAYOUT_ACCELERATOR
+#undef HB_OT_LAYOUT_TABLE
+ };
+
+ hb_face_t *face; /* MUST be JUST before the lazy loaders. */
+#define HB_OT_LAYOUT_TABLE(Namespace, Type) \
+ hb_table_lazy_loader_t Type;
+#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \
+ hb_face_lazy_loader_t Type;
+ HB_OT_LAYOUT_TABLES
+#undef HB_OT_LAYOUT_ACCELERATOR
+#undef HB_OT_LAYOUT_TABLE
+};
+
+
+HB_INTERNAL hb_ot_face_data_t *
+_hb_ot_face_data_create (hb_face_t *face);
+
+HB_INTERNAL void
+_hb_ot_face_data_destroy (hb_ot_face_data_t *data);
+
+
+#endif /* HB_OT_FACE_HH */
diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc
index 01c4b833d..00c105642 100644
--- a/src/hb-ot-font.cc
+++ b/src/hb-ot-font.cc
@@ -24,86 +24,24 @@
* Google Author(s): Behdad Esfahbod, Roozbeh Pournader
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-ot.h"
-#include "hb-font-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb-font.hh"
+#include "hb-machinery.hh"
+#include "hb-ot-face.hh"
#include "hb-ot-cmap-table.hh"
-#include "hb-ot-glyf-table.hh"
-#include "hb-ot-cff1-table.hh"
-#include "hb-ot-cff2-table.hh"
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-kern-table.hh"
#include "hb-ot-post-table.hh"
-
+#include "hb-ot-glyf-table.hh"
+#include "hb-ot-cff1-table.hh"
+#include "hb-ot-cff2-table.hh"
#include "hb-ot-color-cbdt-table.hh"
-struct hb_ot_font_t
-{
- inline void init (hb_face_t *face)
- {
- cmap.init (face);
- h_metrics.init (face);
- v_metrics.init (face, h_metrics.ascender - h_metrics.descender); /* TODO Can we do this lazily? */
-
- this->face = face;
- glyf.init ();
- cbdt.init ();
- post.init ();
- kern.init ();
- }
- inline void fini (void)
- {
- cmap.fini ();
- h_metrics.fini ();
- v_metrics.fini ();
-
- glyf.fini ();
- cbdt.fini ();
- post.fini ();
- kern.fini ();
- }
-
- OT::cmap::accelerator_t cmap;
- OT::hmtx::accelerator_t h_metrics;
- OT::vmtx::accelerator_t v_metrics;
-
- hb_face_t *face; /* MUST be JUST before the lazy loaders. */
- hb_face_lazy_loader_t<1, OT::glyf::accelerator_t> glyf;
- hb_face_lazy_loader_t<2, OT::CBDT::accelerator_t> cbdt;
- hb_face_lazy_loader_t<3, OT::post::accelerator_t> post;
- hb_face_lazy_loader_t<4, OT::kern::accelerator_t> kern;
-};
-
-
-static hb_ot_font_t *
-_hb_ot_font_create (hb_face_t *face)
-{
- hb_ot_font_t *ot_font = (hb_ot_font_t *) calloc (1, sizeof (hb_ot_font_t));
-
- if (unlikely (!ot_font))
- return nullptr;
-
- ot_font->init (face);
-
- return ot_font;
-}
-
-static void
-_hb_ot_font_destroy (void *data)
-{
- hb_ot_font_t *ot_font = (hb_ot_font_t *) data;
-
- ot_font->fini ();
-
- free (ot_font);
-}
-
-
static hb_bool_t
hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED,
void *font_data,
@@ -112,8 +50,8 @@ hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return ot_font->cmap.get_nominal_glyph (unicode, glyph);
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
+ return ot_font->cmap.get_relaxed()->get_nominal_glyph (unicode, glyph);
}
static hb_bool_t
@@ -124,8 +62,8 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED,
hb_codepoint_t *glyph,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return ot_font->cmap.get_variation_glyph (unicode, variation_selector, glyph);
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
+ return ot_font->cmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph);
}
static hb_position_t
@@ -134,8 +72,8 @@ hb_ot_get_glyph_h_advance (hb_font_t *font,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return font->em_scale_x (ot_font->h_metrics.get_advance (glyph, font));
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
+ return font->em_scale_x (ot_font->hmtx.get_relaxed ()->get_advance (glyph, font));
}
static hb_position_t
@@ -144,8 +82,8 @@ hb_ot_get_glyph_v_advance (hb_font_t *font,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph, font));
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
+ return font->em_scale_y (-(int) ot_font->vmtx.get_relaxed ()->get_advance (glyph, font));
}
static hb_position_t
@@ -155,7 +93,7 @@ hb_ot_get_glyph_h_kerning (hb_font_t *font,
hb_codepoint_t right_glyph,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
return font->em_scale_x (ot_font->kern->get_h_kerning (left_glyph, right_glyph));
}
@@ -166,10 +104,10 @@ hb_ot_get_glyph_extents (hb_font_t *font,
hb_glyph_extents_t *extents,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
bool ret = ot_font->glyf->get_extents (glyph, extents);
if (!ret)
- ret = ot_font->cbdt->get_extents (glyph, extents);
+ ret = ot_font->CBDT->get_extents (glyph, extents);
// TODO Hook up side-bearings variations.
extents->x_bearing = font->em_scale_x (extents->x_bearing);
extents->y_bearing = font->em_scale_y (extents->y_bearing);
@@ -185,7 +123,7 @@ hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED,
char *name, unsigned int size,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
return ot_font->post->get_glyph_name (glyph, name, size);
}
@@ -196,7 +134,7 @@ hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED,
hb_codepoint_t *glyph,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
return ot_font->post->get_glyph_from_name (name, len, glyph);
}
@@ -206,12 +144,12 @@ hb_ot_get_font_h_extents (hb_font_t *font,
hb_font_extents_t *metrics,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender);
- metrics->descender = font->em_scale_y (ot_font->h_metrics.descender);
- metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap);
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
+ metrics->ascender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->ascender);
+ metrics->descender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->descender);
+ metrics->line_gap = font->em_scale_y (ot_font->hmtx.get_relaxed ()->line_gap);
// TODO Hook up variations.
- return ot_font->h_metrics.has_font_extents;
+ return ot_font->hmtx.get_relaxed ()->has_font_extents;
}
static hb_bool_t
@@ -220,12 +158,12 @@ hb_ot_get_font_v_extents (hb_font_t *font,
hb_font_extents_t *metrics,
void *user_data HB_UNUSED)
{
- const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender);
- metrics->descender = font->em_scale_x (ot_font->v_metrics.descender);
- metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap);
+ const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data;
+ metrics->ascender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->ascender);
+ metrics->descender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->descender);
+ metrics->line_gap = font->em_scale_x (ot_font->vmtx.get_relaxed ()->line_gap);
// TODO Hook up variations.
- return ot_font->v_metrics.has_font_extents;
+ return ot_font->vmtx.get_relaxed ()->has_font_extents;
}
#ifdef HB_USE_ATEXIT
@@ -286,12 +224,16 @@ _hb_ot_get_font_funcs (void)
void
hb_ot_font_set_funcs (hb_font_t *font)
{
- hb_ot_font_t *ot_font = _hb_ot_font_create (font->face);
- if (unlikely (!ot_font))
- return;
+ if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return;
+ hb_ot_face_data_t *ot_font = hb_ot_face_data (font->face);
+
+ /* Load them lazies. We access them with get_relaxed() for performance. */
+ ot_font->cmap.get ();
+ ot_font->hmtx.get ();
+ ot_font->vmtx.get ();
hb_font_set_funcs (font,
_hb_ot_get_font_funcs (),
ot_font,
- _hb_ot_font_destroy);
+ nullptr);
}
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index bcf89e462..65758861a 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -27,11 +27,11 @@
#ifndef HB_OT_GLYF_TABLE_HH
#define HB_OT_GLYF_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-head-table.hh"
#include "hb-subset-glyf.hh"
#include "hb-subset-plan.hh"
-#include "hb-subset-private.hh"
+#include "hb-subset.hh"
namespace OT {
@@ -490,6 +490,8 @@ struct glyf
DEFINE_SIZE_ARRAY (0, dataZ);
};
+struct glyf_accelerator_t : glyf::accelerator_t {};
+
} /* namespace OT */
diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh
index 0951871ce..5ce5fe4ab 100644
--- a/src/hb-ot-hdmx-table.hh
+++ b/src/hb-ot-hdmx-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_HDMX_TABLE_HH
#define HB_OT_HDMX_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-subset-plan.hh"
/*
diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh
index fded120be..602e365ce 100644
--- a/src/hb-ot-head-table.hh
+++ b/src/hb-ot-head-table.hh
@@ -29,7 +29,7 @@
#ifndef HB_OT_HEAD_TABLE_HH
#define HB_OT_HEAD_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* head -- Font Header
diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh
index efb42b616..3336cadd4 100644
--- a/src/hb-ot-hhea-table.hh
+++ b/src/hb-ot-hhea-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_HHEA_TABLE_HH
#define HB_OT_HHEA_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* hhea -- Horizontal Header
diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh
index 13fa9d6e0..9bdca7eb9 100644
--- a/src/hb-ot-hmtx-table.hh
+++ b/src/hb-ot-hmtx-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_HMTX_TABLE_HH
#define HB_OT_HMTX_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-hhea-table.hh"
#include "hb-ot-os2-table.hh"
#include "hb-ot-var-hvar-table.hh"
@@ -332,6 +332,9 @@ struct vmtx : hmtxvmtx {
static const hb_tag_t os2Tag = HB_TAG_NONE;
};
+struct hmtx_accelerator_t : hmtx::accelerator_t {};
+struct vmtx_accelerator_t : vmtx::accelerator_t {};
+
} /* namespace OT */
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index b4d810952..40f94be29 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_KERN_TABLE_HH
#define HB_OT_KERN_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* kern -- Kerning
@@ -390,6 +390,8 @@ struct kern
DEFINE_SIZE_UNION (2, major);
};
+struct kern_accelerator_t : kern::accelerator_t {};
+
} /* namespace OT */
diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh
index 96da07fb5..449e74550 100644
--- a/src/hb-ot-layout-base-table.hh
+++ b/src/hb-ot-layout-base-table.hh
@@ -28,8 +28,8 @@
#ifndef HB_OT_LAYOUT_BASE_TABLE_HH
#define HB_OT_LAYOUT_BASE_TABLE_HH
-#include "hb-open-type-private.hh"
-#include "hb-ot-layout-common-private.hh"
+#include "hb-open-type.hh"
+#include "hb-ot-layout-common.hh"
namespace OT {
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common.hh
similarity index 97%
rename from src/hb-ot-layout-common-private.hh
rename to src/hb-ot-layout-common.hh
index 89d5eae49..887f27e9e 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common.hh
@@ -26,13 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_LAYOUT_COMMON_PRIVATE_HH
-#define HB_OT_LAYOUT_COMMON_PRIVATE_HH
+#ifndef HB_OT_LAYOUT_COMMON_HH
+#define HB_OT_LAYOUT_COMMON_HH
-#include "hb-private.hh"
-#include "hb-ot-layout-private.hh"
-#include "hb-open-type-private.hh"
-#include "hb-set-private.hh"
+#include "hb.hh"
+#include "hb-ot-layout.hh"
+#include "hb-open-type.hh"
+#include "hb-set.hh"
#ifndef HB_MAX_NESTING_LEVEL
@@ -743,6 +743,7 @@ struct CoverageFormat1
/* Older compilers need this to be public. */
struct Iter {
inline void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; };
+ inline void fini (void) {};
inline bool more (void) { return i < c->glyphArray.len; }
inline void next (void) { i++; }
inline hb_codepoint_t get_glyph (void) { return c->glyphArray[i]; }
@@ -859,6 +860,7 @@ struct CoverageFormat2
i = c->rangeRecord.len;
}
}
+ inline void fini (void) {};
inline bool more (void) { return i < c->rangeRecord.len; }
inline void next (void)
{
@@ -924,7 +926,8 @@ struct Coverage
if (glyphs[i - 1] + 1 != glyphs[i])
num_ranges++;
u.format.set (num_glyphs * 2 < num_ranges * 3 ? 1 : 2);
- switch (u.format) {
+ switch (u.format)
+ {
case 1: return_trace (u.format1.serialize (c, glyphs, num_glyphs));
case 2: return_trace (u.format2.serialize (c, glyphs, num_glyphs));
default:return_trace (false);
@@ -935,25 +938,27 @@ struct Coverage
{
TRACE_SANITIZE (this);
if (!u.format.sanitize (c)) return_trace (false);
- switch (u.format) {
+ switch (u.format)
+ {
case 1: return_trace (u.format1.sanitize (c));
case 2: return_trace (u.format2.sanitize (c));
default:return_trace (true);
}
}
- inline bool intersects (const hb_set_t *glyphs) const {
+ inline bool intersects (const hb_set_t *glyphs) const
+ {
/* TODO speed this up */
- Coverage::Iter iter;
- for (iter.init (*this); iter.more (); iter.next ()) {
+ for (hb_auto_t iter (*this); iter.more (); iter.next ())
if (glyphs->has (iter.get_glyph ()))
return true;
- }
return false;
}
- inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const {
- switch (u.format) {
+ inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const
+ {
+ switch (u.format)
+ {
case 1: return u.format1.intersects_coverage (glyphs, index);
case 2: return u.format2.intersects_coverage (glyphs, index);
default:return false;
@@ -963,47 +968,61 @@ struct Coverage
/* Might return false if array looks unsorted.
* Used for faster rejection of corrupt data. */
template
- inline bool add_coverage (set_t *glyphs) const {
- switch (u.format) {
+ inline bool add_coverage (set_t *glyphs) const
+ {
+ switch (u.format)
+ {
case 1: return u.format1.add_coverage (glyphs);
case 2: return u.format2.add_coverage (glyphs);
default:return false;
}
}
- struct Iter {
+ struct Iter
+ {
Iter (void) : format (0), u () {};
- inline void init (const Coverage &c_) {
+ inline void init (const Coverage &c_)
+ {
format = c_.u.format;
- switch (format) {
+ switch (format)
+ {
case 1: u.format1.init (c_.u.format1); return;
case 2: u.format2.init (c_.u.format2); return;
- default: return;
+ default: return;
}
}
- inline bool more (void) {
- switch (format) {
+ inline void fini (void) {}
+ inline bool more (void)
+ {
+ switch (format)
+ {
case 1: return u.format1.more ();
case 2: return u.format2.more ();
default:return false;
}
}
- inline void next (void) {
- switch (format) {
+ inline void next (void)
+ {
+ switch (format)
+ {
case 1: u.format1.next (); break;
case 2: u.format2.next (); break;
- default: break;
+ default: break;
}
}
- inline hb_codepoint_t get_glyph (void) {
- switch (format) {
+ inline hb_codepoint_t get_glyph (void)
+ {
+ switch (format)
+ {
case 1: return u.format1.get_glyph ();
case 2: return u.format2.get_glyph ();
default:return 0;
}
}
- inline unsigned int get_coverage (void) {
- switch (format) {
+ inline unsigned int get_coverage (void)
+ {
+ switch (format)
+ {
case 1: return u.format1.get_coverage ();
case 2: return u.format2.get_coverage ();
default:return -1;
@@ -1803,4 +1822,4 @@ struct Device
} /* namespace OT */
-#endif /* HB_OT_LAYOUT_COMMON_PRIVATE_HH */
+#endif /* HB_OT_LAYOUT_COMMON_HH */
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index d2b41a8ef..79308649f 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -29,9 +29,9 @@
#ifndef HB_OT_LAYOUT_GDEF_TABLE_HH
#define HB_OT_LAYOUT_GDEF_TABLE_HH
-#include "hb-ot-layout-common-private.hh"
+#include "hb-ot-layout-common.hh"
-#include "hb-font-private.hh"
+#include "hb-font.hh"
namespace OT {
@@ -337,6 +337,7 @@ struct MarkGlyphSets
* https://docs.microsoft.com/en-us/typography/opentype/spec/gdef
*/
+
struct GDEF
{
static const hb_tag_t tableTag = HB_OT_TAG_GDEF;
@@ -420,6 +421,18 @@ struct GDEF
}
}
+ struct accelerator_t
+ {
+ HB_INTERNAL inline void init (hb_face_t *face);
+
+ inline void fini (void)
+ {
+ hb_blob_destroy (this->blob);
+ }
+
+ hb_blob_t *blob;
+ const GDEF *table;
+ };
protected:
FixedVersion<>version; /* Version of the GDEF table--currently
@@ -454,6 +467,7 @@ struct GDEF
DEFINE_SIZE_MIN (12);
};
+struct GDEF_accelerator_t : GDEF::accelerator_t {};
} /* namespace OT */
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index fe34a328b..16b547939 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -29,7 +29,7 @@
#ifndef HB_OT_LAYOUT_GPOS_TABLE_HH
#define HB_OT_LAYOUT_GPOS_TABLE_HH
-#include "hb-ot-layout-gsubgpos-private.hh"
+#include "hb-ot-layout-gsubgpos.hh"
namespace OT {
@@ -1522,6 +1522,8 @@ struct GPOS : GSUBGPOS
const OffsetTo &list = CastR > (lookupList);
return_trace (list.sanitize (c, this));
}
+
+ typedef GSUBGPOS::accelerator_t accelerator_t;
};
@@ -1628,15 +1630,13 @@ GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer)
template
/*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
{
- const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->table.GPOS);
- const PosLookup &l = gpos.get_lookup (lookup_index);
+ const PosLookup &l = _get_gpos_relaxed (c->face)->get_lookup (lookup_index);
return l.dispatch (c);
}
/*static*/ inline bool PosLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index)
{
- const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->table.GPOS);
- const PosLookup &l = gpos.get_lookup (lookup_index);
+ const PosLookup &l = _get_gpos_relaxed (c->face).get_lookup (lookup_index);
unsigned int saved_lookup_props = c->lookup_props;
unsigned int saved_lookup_index = c->lookup_index;
c->set_lookup_index (lookup_index);
@@ -1647,6 +1647,8 @@ template
return ret;
}
+struct GPOS_accelerator_t : GPOS::accelerator_t {};
+
#undef attach_chain
#undef attach_type
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 1d5a02a02..55696c5ac 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -29,7 +29,7 @@
#ifndef HB_OT_LAYOUT_GSUB_TABLE_HH
#define HB_OT_LAYOUT_GSUB_TABLE_HH
-#include "hb-ot-layout-gsubgpos-private.hh"
+#include "hb-ot-layout-gsubgpos.hh"
namespace OT {
@@ -40,8 +40,7 @@ struct SingleSubstFormat1
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
- Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
/* TODO Switch to range-based API to work around malicious fonts.
* https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -55,8 +54,7 @@ struct SingleSubstFormat1
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
- Coverage::Iter iter;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
/* TODO Switch to range-based API to work around malicious fonts.
* https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -125,9 +123,8 @@ struct SingleSubstFormat2
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
- Coverage::Iter iter;
unsigned int count = substitute.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -140,9 +137,8 @@ struct SingleSubstFormat2
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
- Coverage::Iter iter;
unsigned int count = substitute.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -332,9 +328,8 @@ struct MultipleSubstFormat1
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
- Coverage::Iter iter;
unsigned int count = sequence.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -454,9 +449,8 @@ struct AlternateSubstFormat1
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
- Coverage::Iter iter;
unsigned int count = alternateSet.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -473,9 +467,8 @@ struct AlternateSubstFormat1
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
- Coverage::Iter iter;
unsigned int count = alternateSet.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -781,9 +774,8 @@ struct LigatureSubstFormat1
inline void closure (hb_closure_context_t *c) const
{
TRACE_CLOSURE (this);
- Coverage::Iter iter;
unsigned int count = ligatureSet.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -796,9 +788,8 @@ struct LigatureSubstFormat1
{
TRACE_COLLECT_GLYPHS (this);
if (unlikely (!(this+coverage).add_coverage (c->input))) return;
- Coverage::Iter iter;
unsigned int count = ligatureSet.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -950,9 +941,8 @@ struct ReverseChainSingleSubstFormat1
return;
const ArrayOf &substitute = StructAfter > (lookahead);
- Coverage::Iter iter;
count = substitute.len;
- for (iter.init (this+coverage); iter.more (); iter.next ())
+ for (hb_auto_t iter (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
@@ -1318,8 +1308,6 @@ struct GSUB : GSUBGPOS
inline const SubstLookup& get_lookup (unsigned int i) const
{ return CastR (GSUBGPOS::get_lookup (i)); }
- static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer);
-
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -1327,25 +1315,11 @@ struct GSUB : GSUBGPOS
const OffsetTo &list = CastR > (lookupList);
return_trace (list.sanitize (c, this));
}
+
+ typedef GSUBGPOS::accelerator_t accelerator_t;
};
-void
-GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer)
-{
- _hb_buffer_assert_gsubgpos_vars (buffer);
-
- const GDEF &gdef = *hb_ot_layout_from_face (font->face)->table.GDEF;
- unsigned int count = buffer->len;
- for (unsigned int i = 0; i < count; i++)
- {
- _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint));
- _hb_glyph_info_clear_lig_props (&buffer->info[i]);
- buffer->info[i].syllable() = 0;
- }
-}
-
-
/* Out-of-class implementation for methods recursing */
/*static*/ inline bool ExtensionSubst::is_reverse (void) const
@@ -1359,15 +1333,13 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer)
template
/*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index)
{
- const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->table.GSUB);
- const SubstLookup &l = gsub.get_lookup (lookup_index);
+ const SubstLookup &l = _get_gsub_relaxed (c->face).get_lookup (lookup_index);
return l.dispatch (c);
}
/*static*/ inline bool SubstLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index)
{
- const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->table.GSUB);
- const SubstLookup &l = gsub.get_lookup (lookup_index);
+ const SubstLookup &l = _get_gsub_relaxed (c->face).get_lookup (lookup_index);
unsigned int saved_lookup_props = c->lookup_props;
unsigned int saved_lookup_index = c->lookup_index;
c->set_lookup_index (lookup_index);
@@ -1378,6 +1350,7 @@ template
return ret;
}
+struct GSUB_accelerator_t : GSUB::accelerator_t {};
} /* namespace OT */
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos.hh
similarity index 98%
rename from src/hb-ot-layout-gsubgpos-private.hh
rename to src/hb-ot-layout-gsubgpos.hh
index 40a2fc4cc..3727dd9ea 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos.hh
@@ -26,14 +26,15 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
-#define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
+#ifndef HB_OT_LAYOUT_GSUBGPOS_HH
+#define HB_OT_LAYOUT_GSUBGPOS_HH
-#include "hb-private.hh"
-#include "hb-buffer-private.hh"
-#include "hb-map-private.hh"
+#include "hb.hh"
+#include "hb-buffer.hh"
+#include "hb-map.hh"
+#include "hb-set.hh"
+#include "hb-ot-layout-common.hh"
#include "hb-ot-layout-gdef-table.hh"
-#include "hb-set-private.hh"
namespace OT {
@@ -480,7 +481,7 @@ struct hb_ot_apply_context_t :
iter_input (), iter_context (),
font (font_), face (font->face), buffer (buffer_),
recurse_func (nullptr),
- gdef (*hb_ot_layout_from_face (face)->table.GDEF),
+ gdef (_get_gdef (face)),
var_store (gdef.get_var_store ()),
direction (buffer_->props.direction),
lookup_mask (1),
@@ -987,7 +988,6 @@ struct LookupRecord
DEFINE_SIZE_STATIC (4);
};
-
template
static inline void recurse_lookups (context_t *c,
unsigned int lookupCount,
@@ -2381,6 +2381,38 @@ struct GSUBGPOS
(version.to_int () < 0x00010001u || featureVars.sanitize (c, this)));
}
+ template
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face)
+ {
+ this->blob = hb_sanitize_context_t().reference_table (face);
+ table = this->blob->template as ();
+
+ this->lookup_count = table->get_lookup_count ();
+
+ this->accels = (hb_ot_layout_lookup_accelerator_t *) calloc (this->lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t));
+ if (unlikely (!this->accels))
+ this->lookup_count = 0;
+
+ for (unsigned int i = 0; i < this->lookup_count; i++)
+ this->accels[i].init (table->get_lookup (i));
+ }
+
+ inline void fini (void)
+ {
+ for (unsigned int i = 0; i < this->lookup_count; i++)
+ this->accels[i].fini ();
+ free (this->accels);
+ hb_blob_destroy (this->blob);
+ }
+
+ hb_blob_t *blob;
+ const T *table;
+ unsigned int lookup_count;
+ hb_ot_layout_lookup_accelerator_t *accels;
+ };
+
protected:
FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set
* to 0x00010000u */
@@ -2403,4 +2435,4 @@ struct GSUBGPOS
} /* namespace OT */
-#endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */
+#endif /* HB_OT_LAYOUT_GSUBGPOS_HH */
diff --git a/src/hb-ot-layout-jstf-table.hh b/src/hb-ot-layout-jstf-table.hh
index 7fabdebb2..e718c319f 100644
--- a/src/hb-ot-layout-jstf-table.hh
+++ b/src/hb-ot-layout-jstf-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_LAYOUT_JSTF_TABLE_HH
#define HB_OT_LAYOUT_JSTF_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-layout-gpos-table.hh"
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index 09ff0e6c0..345078917 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -28,10 +28,11 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-open-type-private.hh"
-#include "hb-ot-layout-private.hh"
-#include "hb-ot-map-private.hh"
-#include "hb-map-private.hh"
+#include "hb-open-type.hh"
+#include "hb-ot-layout.hh"
+#include "hb-ot-face.hh"
+#include "hb-ot-map.hh"
+#include "hb-map.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsub-table.hh"
@@ -47,6 +48,53 @@
#include "hb-ot-name-table.hh"
+// static inline const OT::BASE&
+// _get_base (hb_face_t *face)
+// {
+// if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE);
+// hb_ot_face_data_t *data = hb_ot_face_data (face);
+// return *(data->base.get ());
+// }
+
+const OT::GDEF& _get_gdef (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF);
+ return *hb_ot_face_data (face)->GDEF->table;
+}
+static hb_blob_t * _get_gsub_blob (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty ();
+ return hb_ot_face_data (face)->GSUB->blob;
+}
+static inline const OT::GSUB& _get_gsub (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB);
+ return *hb_ot_face_data (face)->GSUB->table;
+}
+const OT::GSUB& _get_gsub_relaxed (hb_face_t *face)
+{
+ return *hb_ot_face_data (face)->GSUB.get_relaxed ()->table;
+}
+static hb_blob_t * _get_gpos_blob (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty ();
+ return hb_ot_face_data (face)->GPOS->blob;
+}
+static inline const OT::GPOS& _get_gpos (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS);
+ return *hb_ot_face_data (face)->GPOS->table;
+}
+const OT::GPOS& _get_gpos_relaxed (hb_face_t *face)
+{
+ return *hb_ot_face_data (face)->GPOS.get_relaxed ()->table;
+}
+
+
+/*
+ * GDEF
+ */
+
static bool
_hb_ot_blacklist_gdef (unsigned int gdef_len,
unsigned int gsub_len,
@@ -149,106 +197,39 @@ _hb_ot_blacklist_gdef (unsigned int gdef_len,
return false;
}
-void hb_ot_layout_t::tables_t::init0 (hb_face_t *face)
+inline void
+OT::GDEF::accelerator_t::init (hb_face_t *face)
{
- this->face = face;
-#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 ();
- HB_OT_LAYOUT_TABLES
-#undef HB_OT_LAYOUT_TABLE
-}
-void hb_ot_layout_t::tables_t::fini (void)
-{
-#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini ();
- HB_OT_LAYOUT_TABLES
-#undef HB_OT_LAYOUT_TABLE
-}
+ this->blob = hb_sanitize_context_t().reference_table (face);
-hb_ot_layout_t *
-_hb_ot_layout_create (hb_face_t *face)
-{
- hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
- if (unlikely (!layout))
- return nullptr;
-
- layout->table.init0 (face);
-
- const OT::GSUB &gsub = *layout->table.GSUB;
- const OT::GPOS &gpos = *layout->table.GPOS;
-
- if (unlikely (_hb_ot_blacklist_gdef (layout->table.GDEF.get_blob ()->length,
- layout->table.GSUB.get_blob ()->length,
- layout->table.GPOS.get_blob ()->length)))
- layout->table.GDEF.set_stored (hb_blob_get_empty ());
-
- unsigned int gsub_lookup_count = layout->gsub_lookup_count = gsub.get_lookup_count ();
- unsigned int gpos_lookup_count = layout->gpos_lookup_count = gpos.get_lookup_count ();
-
- layout->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gsub_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t));
- layout->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gpos_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t));
-
- if (unlikely ((gsub_lookup_count && !layout->gsub_accels) ||
- (gpos_lookup_count && !layout->gpos_accels)))
+ if (unlikely (_hb_ot_blacklist_gdef (this->blob->length,
+ _get_gsub_blob (face)->length,
+ _get_gpos_blob (face)->length)))
{
- _hb_ot_layout_destroy (layout);
- return nullptr;
+ hb_blob_destroy (this->blob);
+ this->blob = hb_blob_get_empty ();
}
- for (unsigned int i = 0; i < gsub_lookup_count; i++)
- layout->gsub_accels[i].init (gsub.get_lookup (i));
- for (unsigned int i = 0; i < gpos_lookup_count; i++)
- layout->gpos_accels[i].init (gpos.get_lookup (i));
-
- return layout;
+ table = this->blob->as ();
}
-void
-_hb_ot_layout_destroy (hb_ot_layout_t *layout)
+static void
+_hb_ot_layout_set_glyph_props (hb_font_t *font,
+ hb_buffer_t *buffer)
{
- if (layout->gsub_accels)
- for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
- layout->gsub_accels[i].fini ();
- if (layout->gpos_accels)
- for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
- layout->gpos_accels[i].fini ();
+ _hb_buffer_assert_gsubgpos_vars (buffer);
- free (layout->gsub_accels);
- free (layout->gpos_accels);
-
- layout->table.fini ();
-
- free (layout);
+ const OT::GDEF &gdef = _get_gdef (font->face);
+ unsigned int count = buffer->len;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint));
+ _hb_glyph_info_clear_lig_props (&buffer->info[i]);
+ buffer->info[i].syllable() = 0;
+ }
}
-// static inline const OT::BASE&
-// _get_base (hb_face_t *face)
-// {
-// if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE);
-// hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
-// return *(layout->base.get ());
-// }
-
-static inline const OT::GDEF&
-_get_gdef (hb_face_t *face)
-{
- if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF);
- return *hb_ot_layout_from_face (face)->table.GDEF;
-}
-static inline const OT::GSUB&
-_get_gsub (hb_face_t *face)
-{
- if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB);
- return *hb_ot_layout_from_face (face)->table.GSUB;
-}
-static inline const OT::GPOS&
-_get_gpos (hb_face_t *face)
-{
- if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS);
- return *hb_ot_layout_from_face (face)->table.GPOS;
-}
-
-/*
- * GDEF
- */
+/* Public API */
hb_bool_t
hb_ot_layout_has_glyph_classes (hb_face_t *face)
@@ -633,11 +614,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face,
{
case HB_OT_TAG_GSUB:
{
- return hb_ot_layout_from_face (face)->gsub_lookup_count;
+ return hb_ot_face_data (face)->GSUB->lookup_count;
}
case HB_OT_TAG_GPOS:
{
- return hb_ot_layout_from_face (face)->gpos_lookup_count;
+ return hb_ot_face_data (face)->GPOS->lookup_count;
}
}
return 0;
@@ -851,13 +832,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
{
case HB_OT_TAG_GSUB:
{
- const OT::SubstLookup& l = hb_ot_layout_from_face (face)->table.GSUB->get_lookup (lookup_index);
+ const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index);
l.collect_glyphs (&c);
return;
}
case HB_OT_TAG_GPOS:
{
- const OT::PosLookup& l = hb_ot_layout_from_face (face)->table.GPOS->get_lookup (lookup_index);
+ const OT::PosLookup& l = hb_ot_face_data (face)->GPOS->table->get_lookup (lookup_index);
l.collect_glyphs (&c);
return;
}
@@ -930,18 +911,19 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face,
unsigned int glyphs_length,
hb_bool_t zero_context)
{
- if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false;
+ if (unlikely (lookup_index >= hb_ot_face_data (face)->GSUB->lookup_count)) return false;
OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context);
- const OT::SubstLookup& l = hb_ot_layout_from_face (face)->table.GSUB->get_lookup (lookup_index);
+ const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index);
- return l.would_apply (&c, &hb_ot_layout_from_face (face)->gsub_accels[lookup_index]);
+ return l.would_apply (&c, &hb_ot_face_data (face)->GSUB->accels[lookup_index]);
}
void
-hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer)
+hb_ot_layout_substitute_start (hb_font_t *font,
+ hb_buffer_t *buffer)
{
- OT::GSUB::substitute_start (font, buffer);
+_hb_ot_layout_set_glyph_props (font, buffer);
}
/**
@@ -1091,8 +1073,8 @@ struct GSUBProxy
typedef OT::SubstLookup Lookup;
GSUBProxy (hb_face_t *face) :
- table (*hb_ot_layout_from_face (face)->table.GSUB),
- accels (hb_ot_layout_from_face (face)->gsub_accels) {}
+ table (*hb_ot_face_data (face)->GSUB->table),
+ accels (hb_ot_face_data (face)->GSUB->accels) {}
const OT::GSUB &table;
const hb_ot_layout_lookup_accelerator_t *accels;
@@ -1105,8 +1087,8 @@ struct GPOSProxy
typedef OT::PosLookup Lookup;
GPOSProxy (hb_face_t *face) :
- table (*hb_ot_layout_from_face (face)->table.GPOS),
- accels (hb_ot_layout_from_face (face)->gpos_accels) {}
+ table (*hb_ot_face_data (face)->GPOS->table),
+ accels (hb_ot_face_data (face)->GPOS->accels) {}
const OT::GPOS &table;
const hb_ot_layout_lookup_accelerator_t *accels;
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout.hh
similarity index 86%
rename from src/hb-ot-layout-private.hh
rename to src/hb-ot-layout.hh
index 612bc7fce..84981391c 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout.hh
@@ -26,15 +26,27 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_LAYOUT_PRIVATE_HH
-#define HB_OT_LAYOUT_PRIVATE_HH
+#ifndef HB_OT_LAYOUT_HH
+#define HB_OT_LAYOUT_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-font-private.hh"
-#include "hb-buffer-private.hh"
-#include "hb-set-digest-private.hh"
-#include "hb-open-type-private.hh"
+#include "hb-font.hh"
+#include "hb-buffer.hh"
+#include "hb-open-type.hh"
+#include "hb-set-digest.hh"
+
+
+namespace OT
+{
+ struct GDEF;
+ struct GSUB;
+ struct GPOS;
+}
+
+HB_INTERNAL const OT::GDEF& _get_gdef (hb_face_t *face);
+HB_INTERNAL const OT::GSUB& _get_gsub_relaxed (hb_face_t *face);
+HB_INTERNAL const OT::GPOS& _get_gpos_relaxed (hb_face_t *face);
/* Private API corresponding to hb-ot-layout.h: */
@@ -87,7 +99,22 @@ hb_ot_layout_substitute_start (hb_font_t *font,
hb_buffer_t *buffer);
-struct hb_ot_layout_lookup_accelerator_t;
+struct hb_ot_layout_lookup_accelerator_t
+{
+ template
+ inline void init (const TLookup &lookup)
+ {
+ digest.init ();
+ lookup.add_coverage (&digest);
+ }
+ inline void fini (void) {}
+
+ inline bool may_have (hb_codepoint_t g) const
+ { return digest.may_have (g); }
+
+ private:
+ hb_set_digest_t digest;
+};
namespace OT {
struct hb_ot_apply_context_t;
@@ -116,112 +143,6 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font,
hb_buffer_t *buffer);
-
-/*
- * hb_ot_layout_t
- */
-
-struct hb_ot_layout_lookup_accelerator_t
-{
- template
- inline void init (const TLookup &lookup)
- {
- digest.init ();
- lookup.add_coverage (&digest);
- }
-
- inline void fini (void)
- {
- }
-
- inline bool may_have (hb_codepoint_t g) const {
- return digest.may_have (g);
- }
-
- private:
- hb_set_digest_t digest;
-};
-
-/* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*.
- * This is as good as any place. */
-#define HB_OT_LAYOUT_TABLES \
- /* OpenType shaping. */ \
- HB_OT_LAYOUT_TABLE(OT, GDEF) \
- HB_OT_LAYOUT_TABLE(OT, GSUB) \
- HB_OT_LAYOUT_TABLE(OT, GPOS) \
- HB_OT_LAYOUT_TABLE(OT, JSTF) \
- HB_OT_LAYOUT_TABLE(OT, BASE) \
- /* AAT shaping. */ \
- HB_OT_LAYOUT_TABLE(AAT, morx) \
- HB_OT_LAYOUT_TABLE(AAT, kerx) \
- HB_OT_LAYOUT_TABLE(AAT, ankr) \
- HB_OT_LAYOUT_TABLE(AAT, trak) \
- /* OpenType variations. */ \
- HB_OT_LAYOUT_TABLE(OT, fvar) \
- HB_OT_LAYOUT_TABLE(OT, avar) \
- HB_OT_LAYOUT_TABLE(OT, MVAR) \
- /* OpenType color. */ \
- HB_OT_LAYOUT_TABLE(OT, COLR) \
- HB_OT_LAYOUT_TABLE(OT, CPAL) \
- HB_OT_LAYOUT_TABLE(OT, CBDT) \
- HB_OT_LAYOUT_TABLE(OT, CBLC) \
- HB_OT_LAYOUT_TABLE(OT, sbix) \
- HB_OT_LAYOUT_TABLE(OT, svg) \
- /* OpenType math. */ \
- HB_OT_LAYOUT_TABLE(OT, MATH) \
- /* OpenType fundamentals. */ \
- HB_OT_LAYOUT_TABLE(OT, post) \
- /* */
-
-/* Declare tables. */
-#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; }
-HB_OT_LAYOUT_TABLES
-#undef HB_OT_LAYOUT_TABLE
-
-struct hb_ot_layout_t
-{
- unsigned int gsub_lookup_count;
- unsigned int gpos_lookup_count;
-
- hb_ot_layout_lookup_accelerator_t *gsub_accels;
- hb_ot_layout_lookup_accelerator_t *gpos_accels;
-
- /* Various non-shaping tables. */
- struct tables_t
- {
- HB_INTERNAL void init0 (hb_face_t *face);
- HB_INTERNAL void fini (void);
-
-#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \
- HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type)))
- enum order_t
- {
- ORDER_ZERO,
-#define HB_OT_LAYOUT_TABLE(Namespace, Type) \
- HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type),
- HB_OT_LAYOUT_TABLES
-#undef HB_OT_LAYOUT_TABLE
- };
-
- hb_face_t *face; /* MUST be JUST before the lazy loaders. */
-#define HB_OT_LAYOUT_TABLE(Namespace, Type) \
- hb_table_lazy_loader_t Type;
- HB_OT_LAYOUT_TABLES
-#undef HB_OT_LAYOUT_TABLE
- } table;
-};
-
-
-HB_INTERNAL hb_ot_layout_t *
-_hb_ot_layout_create (hb_face_t *face);
-
-HB_INTERNAL void
-_hb_ot_layout_destroy (hb_ot_layout_t *layout);
-
-
-#define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot.get_relaxed ())
-
-
/*
* Buffer var routines.
*/
@@ -701,4 +622,4 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer)
#undef lig_props
#undef glyph_props
-#endif /* HB_OT_LAYOUT_PRIVATE_HH */
+#endif /* HB_OT_LAYOUT_HH */
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index f26cac9b1..29f52dcc2 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -26,9 +26,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-map-private.hh"
+#include "hb-ot-map.hh"
-#include "hb-ot-layout-private.hh"
+#include "hb-ot-layout.hh"
void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map.hh
similarity index 98%
rename from src/hb-ot-map-private.hh
rename to src/hb-ot-map.hh
index 4aaf32831..32a9e7e00 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map.hh
@@ -26,10 +26,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_MAP_PRIVATE_HH
-#define HB_OT_MAP_PRIVATE_HH
+#ifndef HB_OT_MAP_HH
+#define HB_OT_MAP_HH
-#include "hb-buffer-private.hh"
+#include "hb-buffer.hh"
struct hb_ot_shape_plan_t;
@@ -250,4 +250,4 @@ struct hb_ot_map_builder_t
-#endif /* HB_OT_MAP_PRIVATE_HH */
+#endif /* HB_OT_MAP_HH */
diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh
index 2dd714580..b7ca167b1 100644
--- a/src/hb-ot-math-table.hh
+++ b/src/hb-ot-math-table.hh
@@ -27,8 +27,8 @@
#ifndef HB_OT_MATH_TABLE_HH
#define HB_OT_MATH_TABLE_HH
-#include "hb-open-type-private.hh"
-#include "hb-ot-layout-common-private.hh"
+#include "hb-open-type.hh"
+#include "hb-ot-layout-common.hh"
#include "hb-ot-math.h"
namespace OT {
diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc
index 66ce207a7..c693f4807 100644
--- a/src/hb-ot-math.cc
+++ b/src/hb-ot-math.cc
@@ -24,17 +24,17 @@
* Igalia Author(s): Frédéric Wang
*/
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
-#include "hb-ot-layout-private.hh"
+#include "hb-ot-face.hh"
#include "hb-ot-math-table.hh"
static inline const OT::MATH&
_get_math (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::MATH);
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- return *(layout->table.MATH.get ());
+ hb_ot_face_data_t * data = hb_ot_face_data (face);
+ return *(data->MATH.get ());
}
/*
diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh
index 75aac4f44..cd2a85ebc 100644
--- a/src/hb-ot-maxp-table.hh
+++ b/src/hb-ot-maxp-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_MAXP_TABLE_HH
#define HB_OT_MAXP_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-subset-plan.hh"
namespace OT {
diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh
index bff85df27..a1de1193f 100644
--- a/src/hb-ot-name-table.hh
+++ b/src/hb-ot-name-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_NAME_TABLE_HH
#define HB_OT_NAME_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
namespace OT {
diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh
index 56bbab741..c5ad803a2 100644
--- a/src/hb-ot-os2-table.hh
+++ b/src/hb-ot-os2-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_OS2_TABLE_HH
#define HB_OT_OS2_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-os2-unicode-ranges.hh"
#include "hb-subset-plan.hh"
diff --git a/src/hb-ot-os2-unicode-ranges.hh b/src/hb-ot-os2-unicode-ranges.hh
index cb1260784..42dfa4906 100644
--- a/src/hb-ot-os2-unicode-ranges.hh
+++ b/src/hb-ot-os2-unicode-ranges.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_OS2_UNICODE_RANGES_HH
#define HB_OT_OS2_UNICODE_RANGES_HH
-#include "hb-private.hh"
+#include "hb.hh"
namespace OT {
diff --git a/src/hb-ot-post-macroman.hh b/src/hb-ot-post-macroman.hh
index dbbb97e5a..b4df8aaee 100644
--- a/src/hb-ot-post-macroman.hh
+++ b/src/hb-ot-post-macroman.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_POST_MACROMAN_HH
#if 0 /* Make checks happy. */
#define HB_OT_POST_MACROMAN_HH
-#include "hb-private.hh"
+#include "hb.hh"
#endif
diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh
index 4f08a51a2..0c3e596a3 100644
--- a/src/hb-ot-post-table.hh
+++ b/src/hb-ot-post-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_POST_TABLE_HH
#define HB_OT_POST_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-subset-plan.hh"
#define HB_STRING_ARRAY_NAME format1_names
@@ -295,6 +295,8 @@ struct post
DEFINE_SIZE_STATIC (32);
};
+struct post_accelerator_t : post::accelerator_t {};
+
} /* namespace OT */
diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh
index a55511aa0..03f46d848 100644
--- a/src/hb-ot-shape-complex-arabic-fallback.hh
+++ b/src/hb-ot-shape-complex-arabic-fallback.hh
@@ -27,9 +27,9 @@
#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_FALLBACK_HH
#define HB_OT_SHAPE_COMPLEX_ARABIC_FALLBACK_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-private.hh"
+#include "hb-ot-shape.hh"
#include "hb-ot-layout-gsub-table.hh"
diff --git a/src/hb-ot-shape-complex-arabic-win1256.hh b/src/hb-ot-shape-complex-arabic-win1256.hh
index 54c6cdc24..b15e145f2 100644
--- a/src/hb-ot-shape-complex-arabic-win1256.hh
+++ b/src/hb-ot-shape-complex-arabic-win1256.hh
@@ -313,7 +313,7 @@ OT_TABLE_END
* Include a second time to get the table data...
*/
#if 0
-#include "hb-private.hh" /* Make check-includes.sh happy. */
+#include "hb.hh" /* Make check-includes.sh happy. */
#endif
#ifdef OT_MEASURE
#include "hb-ot-shape-complex-arabic-win1256.hh"
diff --git a/src/hb-ot-shape-complex-arabic.cc b/src/hb-ot-shape-complex-arabic.cc
index f4b397b93..ebc1d3d5f 100644
--- a/src/hb-ot-shape-complex-arabic.cc
+++ b/src/hb-ot-shape-complex-arabic.cc
@@ -24,9 +24,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
-#include "hb-ot-shape-complex-arabic-private.hh"
-#include "hb-ot-shape-private.hh"
+#include "hb.hh"
+#include "hb-ot-shape-complex-arabic.hh"
+#include "hb-ot-shape.hh"
/* buffer var allocations */
diff --git a/src/hb-ot-shape-complex-arabic-private.hh b/src/hb-ot-shape-complex-arabic.hh
similarity index 87%
rename from src/hb-ot-shape-complex-arabic-private.hh
rename to src/hb-ot-shape-complex-arabic.hh
index fcedc7d74..5bf6ff633 100644
--- a/src/hb-ot-shape-complex-arabic-private.hh
+++ b/src/hb-ot-shape-complex-arabic.hh
@@ -26,12 +26,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH
-#define HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH
+#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_HH
+#define HB_OT_SHAPE_COMPLEX_ARABIC_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-complex.hh"
struct arabic_shape_plan_t;
@@ -47,4 +47,4 @@ setup_masks_arabic_plan (const arabic_shape_plan_t *arabic_plan,
hb_buffer_t *buffer,
hb_script_t script);
-#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_HH */
diff --git a/src/hb-ot-shape-complex-default.cc b/src/hb-ot-shape-complex-default.cc
index 68a62a10d..45d5f4346 100644
--- a/src/hb-ot-shape-complex-default.cc
+++ b/src/hb-ot-shape-complex-default.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-complex.hh"
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc
index 7420c5d18..ea731114a 100644
--- a/src/hb-ot-shape-complex-hangul.cc
+++ b/src/hb-ot-shape-complex-hangul.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-complex.hh"
/* Hangul shaper */
diff --git a/src/hb-ot-shape-complex-hebrew.cc b/src/hb-ot-shape-complex-hebrew.cc
index 34cf28b8e..ba25258a3 100644
--- a/src/hb-ot-shape-complex-hebrew.cc
+++ b/src/hb-ot-shape-complex-hebrew.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-complex.hh"
static bool
diff --git a/src/hb-ot-shape-complex-indic-machine.hh b/src/hb-ot-shape-complex-indic-machine.hh
index 73f9d5871..f67a525c5 100644
--- a/src/hb-ot-shape-complex-indic-machine.hh
+++ b/src/hb-ot-shape-complex-indic-machine.hh
@@ -29,7 +29,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
#line 36 "hb-ot-shape-complex-indic-machine.hh"
diff --git a/src/hb-ot-shape-complex-indic-machine.rl b/src/hb-ot-shape-complex-indic-machine.rl
index 35e7ce906..d384a68c3 100644
--- a/src/hb-ot-shape-complex-indic-machine.rl
+++ b/src/hb-ot-shape-complex-indic-machine.rl
@@ -27,7 +27,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
%%{
machine indic_syllable_machine;
diff --git a/src/hb-ot-shape-complex-indic-table.cc b/src/hb-ot-shape-complex-indic-table.cc
index 54291bc22..b7e4e7c7c 100644
--- a/src/hb-ot-shape-complex-indic-table.cc
+++ b/src/hb-ot-shape-complex-indic-table.cc
@@ -14,7 +14,7 @@
* # Date: 2017-10-16, 24:39:00 GMT [KW]
*/
-#include "hb-ot-shape-complex-indic-private.hh"
+#include "hb-ot-shape-complex-indic.hh"
#define ISC_A INDIC_SYLLABIC_CATEGORY_AVAGRAHA /* 16 chars; Avagraha */
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index b52656f44..d4541bb18 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -24,8 +24,8 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-indic-private.hh"
-#include "hb-ot-layout-private.hh"
+#include "hb-ot-shape-complex-indic.hh"
+#include "hb-ot-layout.hh"
/*
diff --git a/src/hb-ot-shape-complex-indic-private.hh b/src/hb-ot-shape-complex-indic.hh
similarity index 98%
rename from src/hb-ot-shape-complex-indic-private.hh
rename to src/hb-ot-shape-complex-indic.hh
index bb7fff384..9e597797c 100644
--- a/src/hb-ot-shape-complex-indic-private.hh
+++ b/src/hb-ot-shape-complex-indic.hh
@@ -24,14 +24,14 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH
-#define HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH
+#ifndef HB_OT_SHAPE_COMPLEX_INDIC_HH
+#define HB_OT_SHAPE_COMPLEX_INDIC_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-complex-private.hh"
-#include "hb-ot-shape-private.hh" /* XXX Remove */
+#include "hb-ot-shape-complex.hh"
+#include "hb-ot-shape.hh" /* XXX Remove */
/* buffer var allocations */
@@ -400,4 +400,4 @@ set_indic_properties (hb_glyph_info_t &info)
}
-#endif /* HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_COMPLEX_INDIC_HH */
diff --git a/src/hb-ot-shape-complex-khmer-machine.hh b/src/hb-ot-shape-complex-khmer-machine.hh
index d00102156..a7e1711eb 100644
--- a/src/hb-ot-shape-complex-khmer-machine.hh
+++ b/src/hb-ot-shape-complex-khmer-machine.hh
@@ -29,7 +29,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
#line 36 "hb-ot-shape-complex-khmer-machine.hh"
diff --git a/src/hb-ot-shape-complex-khmer-machine.rl b/src/hb-ot-shape-complex-khmer-machine.rl
index 54644d8aa..7c7951629 100644
--- a/src/hb-ot-shape-complex-khmer-machine.rl
+++ b/src/hb-ot-shape-complex-khmer-machine.rl
@@ -27,7 +27,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
%%{
machine khmer_syllable_machine;
diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc
index 264515e86..0b5b50a97 100644
--- a/src/hb-ot-shape-complex-khmer.cc
+++ b/src/hb-ot-shape-complex-khmer.cc
@@ -24,8 +24,8 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-khmer-private.hh"
-#include "hb-ot-layout-private.hh"
+#include "hb-ot-shape-complex-khmer.hh"
+#include "hb-ot-layout.hh"
/*
diff --git a/src/hb-ot-shape-complex-khmer-private.hh b/src/hb-ot-shape-complex-khmer.hh
similarity index 93%
rename from src/hb-ot-shape-complex-khmer-private.hh
rename to src/hb-ot-shape-complex-khmer.hh
index f90ef9674..3371c1302 100644
--- a/src/hb-ot-shape-complex-khmer-private.hh
+++ b/src/hb-ot-shape-complex-khmer.hh
@@ -24,12 +24,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH
-#define HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH
+#ifndef HB_OT_SHAPE_COMPLEX_KHMER_HH
+#define HB_OT_SHAPE_COMPLEX_KHMER_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-complex-indic-private.hh"
+#include "hb-ot-shape-complex-indic.hh"
/* buffer var allocations */
@@ -121,4 +121,4 @@ set_khmer_properties (hb_glyph_info_t &info)
}
-#endif /* HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_COMPLEX_KHMER_HH */
diff --git a/src/hb-ot-shape-complex-myanmar-machine.hh b/src/hb-ot-shape-complex-myanmar-machine.hh
index fb67dd42e..7fa235178 100644
--- a/src/hb-ot-shape-complex-myanmar-machine.hh
+++ b/src/hb-ot-shape-complex-myanmar-machine.hh
@@ -29,7 +29,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
#line 36 "hb-ot-shape-complex-myanmar-machine.hh"
diff --git a/src/hb-ot-shape-complex-myanmar-machine.rl b/src/hb-ot-shape-complex-myanmar-machine.rl
index 0cd84fa1b..62f51d1e9 100644
--- a/src/hb-ot-shape-complex-myanmar-machine.rl
+++ b/src/hb-ot-shape-complex-myanmar-machine.rl
@@ -27,7 +27,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
%%{
machine myanmar_syllable_machine;
diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc
index e4214b87e..8466f8129 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-myanmar-private.hh"
+#include "hb-ot-shape-complex-myanmar.hh"
/*
diff --git a/src/hb-ot-shape-complex-myanmar-private.hh b/src/hb-ot-shape-complex-myanmar.hh
similarity index 95%
rename from src/hb-ot-shape-complex-myanmar-private.hh
rename to src/hb-ot-shape-complex-myanmar.hh
index 14d011d67..7b6fd4837 100644
--- a/src/hb-ot-shape-complex-myanmar-private.hh
+++ b/src/hb-ot-shape-complex-myanmar.hh
@@ -24,12 +24,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH
-#define HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH
+#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_HH
+#define HB_OT_SHAPE_COMPLEX_MYANMAR_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-complex-indic-private.hh"
+#include "hb-ot-shape-complex-indic.hh"
/* buffer var allocations */
@@ -168,4 +168,4 @@ set_myanmar_properties (hb_glyph_info_t &info)
}
-#endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_HH */
diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc
index 02d78ac04..1d18760e4 100644
--- a/src/hb-ot-shape-complex-thai.cc
+++ b/src/hb-ot-shape-complex-thai.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-complex.hh"
/* Thai / Lao shaper */
diff --git a/src/hb-ot-shape-complex-tibetan.cc b/src/hb-ot-shape-complex-tibetan.cc
index eaac0bf68..9982ebc29 100644
--- a/src/hb-ot-shape-complex-tibetan.cc
+++ b/src/hb-ot-shape-complex-tibetan.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-complex.hh"
static const hb_tag_t tibetan_features[] =
diff --git a/src/hb-ot-shape-complex-use-machine.hh b/src/hb-ot-shape-complex-use-machine.hh
index 0ec805afc..77ca3aeb5 100644
--- a/src/hb-ot-shape-complex-use-machine.hh
+++ b/src/hb-ot-shape-complex-use-machine.hh
@@ -31,7 +31,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
#line 38 "hb-ot-shape-complex-use-machine.hh"
diff --git a/src/hb-ot-shape-complex-use-machine.rl b/src/hb-ot-shape-complex-use-machine.rl
index 7ec8a7fd1..a233b1200 100644
--- a/src/hb-ot-shape-complex-use-machine.rl
+++ b/src/hb-ot-shape-complex-use-machine.rl
@@ -29,7 +29,7 @@
#ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
#define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH
-#include "hb-private.hh"
+#include "hb.hh"
%%{
machine use_syllable_machine;
diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc
index 9c796f051..4862b7fe9 100644
--- a/src/hb-ot-shape-complex-use-table.cc
+++ b/src/hb-ot-shape-complex-use-table.cc
@@ -15,7 +15,7 @@
* UnicodeData.txt does not have a header.
*/
-#include "hb-ot-shape-complex-use-private.hh"
+#include "hb-ot-shape-complex-use.hh"
#define B USE_B /* BASE */
#define CGJ USE_CGJ /* CGJ */
diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc
index f8e86c9d6..676b15b6e 100644
--- a/src/hb-ot-shape-complex-use.cc
+++ b/src/hb-ot-shape-complex-use.cc
@@ -26,8 +26,8 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-complex-use-private.hh"
-#include "hb-ot-shape-complex-arabic-private.hh"
+#include "hb-ot-shape-complex-use.hh"
+#include "hb-ot-shape-complex-arabic.hh"
/* buffer var allocations */
#define use_category() complex_var_u8_0()
diff --git a/src/hb-ot-shape-complex-use-private.hh b/src/hb-ot-shape-complex-use.hh
similarity index 94%
rename from src/hb-ot-shape-complex-use-private.hh
rename to src/hb-ot-shape-complex-use.hh
index b4bda8bb7..b8123e791 100644
--- a/src/hb-ot-shape-complex-use-private.hh
+++ b/src/hb-ot-shape-complex-use.hh
@@ -26,13 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH
-#define HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH
+#ifndef HB_OT_SHAPE_COMPLEX_USE_HH
+#define HB_OT_SHAPE_COMPLEX_USE_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-complex-private.hh"
+#include "hb-ot-shape-complex.hh"
#define USE_TABLE_ELEMENT_TYPE uint8_t
@@ -94,4 +94,4 @@ enum use_category_t {
HB_INTERNAL USE_TABLE_ELEMENT_TYPE
hb_use_get_category (hb_codepoint_t u);
-#endif /* HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_COMPLEX_USE_HH */
diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex.hh
similarity index 98%
rename from src/hb-ot-shape-complex-private.hh
rename to src/hb-ot-shape-complex.hh
index 37a4d918b..a48a38a20 100644
--- a/src/hb-ot-shape-complex-private.hh
+++ b/src/hb-ot-shape-complex.hh
@@ -24,13 +24,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH
-#define HB_OT_SHAPE_COMPLEX_PRIVATE_HH
+#ifndef HB_OT_SHAPE_COMPLEX_HH
+#define HB_OT_SHAPE_COMPLEX_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-private.hh"
-#include "hb-ot-shape-normalize-private.hh"
+#include "hb-ot-shape.hh"
+#include "hb-ot-shape-normalize.hh"
@@ -390,4 +390,4 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
}
-#endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_COMPLEX_HH */
diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index fbf31ab24..5f43023be 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -24,8 +24,8 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-fallback-private.hh"
-#include "hb-ot-layout-gsubgpos-private.hh"
+#include "hb-ot-shape-fallback.hh"
+#include "hb-ot-layout-gsubgpos.hh"
static unsigned int
recategorize_combining_class (hb_codepoint_t u,
diff --git a/src/hb-ot-shape-fallback-private.hh b/src/hb-ot-shape-fallback.hh
similarity index 90%
rename from src/hb-ot-shape-fallback-private.hh
rename to src/hb-ot-shape-fallback.hh
index e134224df..730e7f280 100644
--- a/src/hb-ot-shape-fallback-private.hh
+++ b/src/hb-ot-shape-fallback.hh
@@ -24,12 +24,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_FALLBACK_PRIVATE_HH
-#define HB_OT_SHAPE_FALLBACK_PRIVATE_HH
+#ifndef HB_OT_SHAPE_FALLBACK_HH
+#define HB_OT_SHAPE_FALLBACK_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-shape-private.hh"
+#include "hb-ot-shape.hh"
HB_INTERNAL void _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan,
@@ -50,4 +50,4 @@ HB_INTERNAL void _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer);
-#endif /* HB_OT_SHAPE_FALLBACK_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_FALLBACK_HH */
diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 358450ee7..fd0b63aec 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -24,9 +24,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-ot-shape-normalize-private.hh"
-#include "hb-ot-shape-complex-private.hh"
-#include "hb-ot-shape-private.hh"
+#include "hb-ot-shape-normalize.hh"
+#include "hb-ot-shape-complex.hh"
+#include "hb-ot-shape.hh"
/*
diff --git a/src/hb-ot-shape-normalize-private.hh b/src/hb-ot-shape-normalize.hh
similarity index 93%
rename from src/hb-ot-shape-normalize-private.hh
rename to src/hb-ot-shape-normalize.hh
index c744e2645..4aea640b1 100644
--- a/src/hb-ot-shape-normalize-private.hh
+++ b/src/hb-ot-shape-normalize.hh
@@ -24,10 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_NORMALIZE_PRIVATE_HH
-#define HB_OT_SHAPE_NORMALIZE_PRIVATE_HH
+#ifndef HB_OT_SHAPE_NORMALIZE_HH
+#define HB_OT_SHAPE_NORMALIZE_HH
-#include "hb-private.hh"
+#include "hb.hh"
/* buffer var allocations, used during the normalization process */
@@ -66,4 +66,4 @@ struct hb_ot_shape_normalize_context_t
};
-#endif /* HB_OT_SHAPE_NORMALIZE_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_NORMALIZE_HH */
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 71632b563..63102f6b0 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -27,21 +27,21 @@
*/
#define HB_SHAPER ot
-#define hb_ot_face_data_t hb_ot_layout_t
#define hb_ot_shape_plan_data_t hb_ot_shape_plan_t
-#include "hb-shaper-impl-private.hh"
+#include "hb-shaper-impl.hh"
-#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.hh"
+#include "hb-ot-shape-complex.hh"
+#include "hb-ot-shape-fallback.hh"
+#include "hb-ot-shape-normalize.hh"
-#include "hb-ot-layout-private.hh"
-#include "hb-unicode-private.hh"
-#include "hb-set-private.hh"
+#include "hb-ot-face.hh"
+#include "hb-ot-layout.hh"
+#include "hb-unicode.hh"
+#include "hb-set.hh"
-#include "hb-ot-layout-gsubgpos-private.hh"
-#include "hb-aat-layout-private.hh"
+#include "hb-ot-layout-gsubgpos.hh"
+#include "hb-aat-layout.hh"
static hb_tag_t common_features[] = {
HB_TAG('c','c','m','p'),
@@ -135,13 +135,13 @@ HB_SHAPER_DATA_ENSURE_DEFINE(ot, face)
hb_ot_face_data_t *
_hb_ot_shaper_face_data_create (hb_face_t *face)
{
- return _hb_ot_layout_create (face);
+ return _hb_ot_face_data_create (face);
}
void
_hb_ot_shaper_face_data_destroy (hb_ot_face_data_t *data)
{
- _hb_ot_layout_destroy (data);
+ _hb_ot_face_data_destroy (data);
}
diff --git a/src/hb-ot-shape-private.hh b/src/hb-ot-shape.hh
similarity index 94%
rename from src/hb-ot-shape-private.hh
rename to src/hb-ot-shape.hh
index d6898263f..b3a490a37 100644
--- a/src/hb-ot-shape-private.hh
+++ b/src/hb-ot-shape.hh
@@ -24,13 +24,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_OT_SHAPE_PRIVATE_HH
-#define HB_OT_SHAPE_PRIVATE_HH
+#ifndef HB_OT_SHAPE_HH
+#define HB_OT_SHAPE_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-ot-map-private.hh"
-#include "hb-ot-layout-private.hh"
+#include "hb-ot-map.hh"
+#include "hb-ot-layout.hh"
@@ -109,4 +109,4 @@ struct hb_ot_shape_planner_t
};
-#endif /* HB_OT_SHAPE_PRIVATE_HH */
+#endif /* HB_OT_SHAPE_HH */
diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc
index 991d8e77a..283723e27 100644
--- a/src/hb-ot-tag.cc
+++ b/src/hb-ot-tag.cc
@@ -26,7 +26,7 @@
* Google Author(s): Behdad Esfahbod, Roozbeh Pournader
*/
-#include "hb-private.hh"
+#include "hb.hh"
/* hb_script_t */
diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh
index ad063d32d..8343018b3 100644
--- a/src/hb-ot-var-avar-table.hh
+++ b/src/hb-ot-var-avar-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_VAR_AVAR_TABLE_HH
#define HB_OT_VAR_AVAR_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* avar -- Axis Variations
diff --git a/src/hb-ot-var-fvar-table.hh b/src/hb-ot-var-fvar-table.hh
index 101476ed3..afd29046e 100644
--- a/src/hb-ot-var-fvar-table.hh
+++ b/src/hb-ot-var-fvar-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_VAR_FVAR_TABLE_HH
#define HB_OT_VAR_FVAR_TABLE_HH
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
/*
* fvar -- Font Variations
diff --git a/src/hb-ot-var-hvar-table.hh b/src/hb-ot-var-hvar-table.hh
index 2b384db71..086e922fd 100644
--- a/src/hb-ot-var-hvar-table.hh
+++ b/src/hb-ot-var-hvar-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_VAR_HVAR_TABLE_HH
#define HB_OT_VAR_HVAR_TABLE_HH
-#include "hb-ot-layout-common-private.hh"
+#include "hb-ot-layout-common.hh"
namespace OT {
diff --git a/src/hb-ot-var-mvar-table.hh b/src/hb-ot-var-mvar-table.hh
index dfde782f6..20dd2200c 100644
--- a/src/hb-ot-var-mvar-table.hh
+++ b/src/hb-ot-var-mvar-table.hh
@@ -27,7 +27,7 @@
#ifndef HB_OT_VAR_MVAR_TABLE_HH
#define HB_OT_VAR_MVAR_TABLE_HH
-#include "hb-ot-layout-common-private.hh"
+#include "hb-ot-layout-common.hh"
namespace OT {
diff --git a/src/hb-ot-var.cc b/src/hb-ot-var.cc
index 6081ddfc3..472ee8452 100644
--- a/src/hb-ot-var.cc
+++ b/src/hb-ot-var.cc
@@ -24,9 +24,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
-#include "hb-ot-layout-private.hh"
+#include "hb-ot-face.hh"
#include "hb-ot-var-avar-table.hh"
#include "hb-ot-var-fvar-table.hh"
#include "hb-ot-var-mvar-table.hh"
@@ -40,15 +40,15 @@ static inline const OT::fvar&
_get_fvar (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::fvar);
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- return *(layout->table.fvar.get ());
+ hb_ot_face_data_t *layout = hb_ot_face_data (face);
+ return *(layout->fvar.get ());
}
static inline const OT::avar&
_get_avar (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::avar);
- hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
- return *(layout->table.avar.get ());
+ hb_ot_face_data_t *layout = hb_ot_face_data (face);
+ return *(layout->avar.get ());
}
/**
diff --git a/src/hb-set-digest-private.hh b/src/hb-set-digest.hh
similarity index 97%
rename from src/hb-set-digest-private.hh
rename to src/hb-set-digest.hh
index e099a8264..4cd7c3ff8 100644
--- a/src/hb-set-digest-private.hh
+++ b/src/hb-set-digest.hh
@@ -24,10 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_SET_DIGEST_PRIVATE_HH
-#define HB_SET_DIGEST_PRIVATE_HH
+#ifndef HB_SET_DIGEST_HH
+#define HB_SET_DIGEST_HH
-#include "hb-private.hh"
+#include "hb.hh"
/*
* The set digests here implement various "filters" that support
@@ -176,4 +176,4 @@ typedef hb_set_digest_combiner_t
> hb_set_digest_t;
-#endif /* HB_SET_DIGEST_PRIVATE_HH */
+#endif /* HB_SET_DIGEST_HH */
diff --git a/src/hb-set.cc b/src/hb-set.cc
index 25027e6c2..09dc4b483 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-set-private.hh"
+#include "hb-set.hh"
/* Public API */
diff --git a/src/hb-set-private.hh b/src/hb-set.hh
similarity index 99%
rename from src/hb-set-private.hh
rename to src/hb-set.hh
index 032ddb1ee..a179ad13d 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set.hh
@@ -24,10 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_SET_PRIVATE_HH
-#define HB_SET_PRIVATE_HH
+#ifndef HB_SET_HH
+#define HB_SET_HH
-#include "hb-private.hh"
+#include "hb.hh"
/*
@@ -697,4 +697,4 @@ struct hb_set_t
};
-#endif /* HB_SET_PRIVATE_HH */
+#endif /* HB_SET_HH */
diff --git a/src/hb-shape-plan.cc b/src/hb-shape-plan.cc
index 0d61d9e1f..b0cf1e92d 100644
--- a/src/hb-shape-plan.cc
+++ b/src/hb-shape-plan.cc
@@ -24,11 +24,11 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
-#include "hb-shape-plan-private.hh"
-#include "hb-shaper-private.hh"
-#include "hb-font-private.hh"
-#include "hb-buffer-private.hh"
+#include "hb.hh"
+#include "hb-shape-plan.hh"
+#include "hb-shaper.hh"
+#include "hb-font.hh"
+#include "hb-buffer.hh"
static void
diff --git a/src/hb-shape-plan-private.hh b/src/hb-shape-plan.hh
similarity index 92%
rename from src/hb-shape-plan-private.hh
rename to src/hb-shape-plan.hh
index 7d020ff16..bf82b912b 100644
--- a/src/hb-shape-plan-private.hh
+++ b/src/hb-shape-plan.hh
@@ -24,11 +24,11 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_SHAPE_PLAN_PRIVATE_HH
-#define HB_SHAPE_PLAN_PRIVATE_HH
+#ifndef HB_SHAPE_PLAN_HH
+#define HB_SHAPE_PLAN_HH
-#include "hb-private.hh"
-#include "hb-shaper-private.hh"
+#include "hb.hh"
+#include "hb-shaper.hh"
struct hb_shape_plan_t
@@ -64,4 +64,4 @@ DECLARE_NULL_INSTANCE (hb_shape_plan_t);
#undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS
-#endif /* HB_SHAPE_PLAN_PRIVATE_HH */
+#endif /* HB_SHAPE_PLAN_HH */
diff --git a/src/hb-shape.cc b/src/hb-shape.cc
index d3e2692fe..e8eeff5b3 100644
--- a/src/hb-shape.cc
+++ b/src/hb-shape.cc
@@ -26,13 +26,13 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-shaper-private.hh"
-#include "hb-shape-plan-private.hh"
-#include "hb-buffer-private.hh"
-#include "hb-font-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb-shaper.hh"
+#include "hb-shape-plan.hh"
+#include "hb-buffer.hh"
+#include "hb-font.hh"
+#include "hb-machinery.hh"
/**
* SECTION:hb-shape
diff --git a/src/hb-shaper-impl-private.hh b/src/hb-shaper-impl.hh
similarity index 82%
rename from src/hb-shaper-impl-private.hh
rename to src/hb-shaper-impl.hh
index 4a10279c7..d40cb085a 100644
--- a/src/hb-shaper-impl-private.hh
+++ b/src/hb-shaper-impl.hh
@@ -24,15 +24,15 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_SHAPER_IMPL_PRIVATE_HH
-#define HB_SHAPER_IMPL_PRIVATE_HH
+#ifndef HB_SHAPER_IMPL_HH
+#define HB_SHAPER_IMPL_HH
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-shaper-private.hh"
-#include "hb-shape-plan-private.hh"
-#include "hb-font-private.hh"
-#include "hb-buffer-private.hh"
+#include "hb-shaper.hh"
+#include "hb-shape-plan.hh"
+#include "hb-font.hh"
+#include "hb-buffer.hh"
#ifdef HB_SHAPER
@@ -40,4 +40,4 @@
#endif
-#endif /* HB_SHAPER_IMPL_PRIVATE_HH */
+#endif /* HB_SHAPER_IMPL_HH */
diff --git a/src/hb-shaper.cc b/src/hb-shaper.cc
index 660dfb2bd..52418c082 100644
--- a/src/hb-shaper.cc
+++ b/src/hb-shaper.cc
@@ -24,9 +24,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
-#include "hb-shaper-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb.hh"
+#include "hb-shaper.hh"
+#include "hb-machinery.hh"
static const hb_shaper_pair_t all_shapers[] = {
diff --git a/src/hb-shaper-private.hh b/src/hb-shaper.hh
similarity index 97%
rename from src/hb-shaper-private.hh
rename to src/hb-shaper.hh
index fb04bbc3c..361165e4f 100644
--- a/src/hb-shaper-private.hh
+++ b/src/hb-shaper.hh
@@ -24,10 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_SHAPER_PRIVATE_HH
-#define HB_SHAPER_PRIVATE_HH
+#ifndef HB_SHAPER_HH
+#define HB_SHAPER_HH
-#include "hb-private.hh"
+#include "hb.hh"
typedef hb_bool_t hb_shape_func_t (hb_shape_plan_t *shape_plan,
hb_font_t *font,
@@ -131,4 +131,4 @@ struct hb_shaper_data_t {
#define HB_SHAPERS_COUNT (sizeof (hb_shaper_data_t) / sizeof (void *))
-#endif /* HB_SHAPER_PRIVATE_HH */
+#endif /* HB_SHAPER_HH */
diff --git a/src/hb-static.cc b/src/hb-static.cc
index ddecbba11..5112d77be 100644
--- a/src/hb-static.cc
+++ b/src/hb-static.cc
@@ -24,12 +24,12 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-open-type-private.hh"
-#include "hb-ot-layout-common-private.hh"
+#include "hb-open-type.hh"
+#include "hb-ot-layout-common.hh"
-#include "hb-face-private.hh"
+#include "hb-face.hh"
#include "hb-ot-head-table.hh"
#include "hb-ot-maxp-table.hh"
diff --git a/src/hb-string-array.hh b/src/hb-string-array.hh
index 679841c87..c4cf666d7 100644
--- a/src/hb-string-array.hh
+++ b/src/hb-string-array.hh
@@ -29,7 +29,7 @@
#define HB_STRING_ARRAY_HH
#endif
-#include "hb-private.hh"
+#include "hb.hh"
/* Based on Bruno Haible's code in Appendix B of Ulrich Drepper's dsohowto.pdf:
* https://software.intel.com/sites/default/files/m/a/1/e/dsohowto.pdf */
diff --git a/src/hb-subset-cff-common-private.cc b/src/hb-subset-cff-common.cc
similarity index 98%
rename from src/hb-subset-cff-common-private.cc
rename to src/hb-subset-cff-common.cc
index 6796709f0..ec196ca9b 100644
--- a/src/hb-subset-cff-common-private.cc
+++ b/src/hb-subset-cff-common.cc
@@ -24,9 +24,9 @@
* Adobe Author(s): Michiharu Ariza
*/
-#include "hb-ot-cff-common-private.hh"
+#include "hb-ot-cff-common.hh"
#include "hb-ot-cff2-table.hh"
-#include "hb-subset-cff-common-private.hh"
+#include "hb-subset-cff-common.hh"
using namespace CFF;
diff --git a/src/hb-subset-cff-common-private.hh b/src/hb-subset-cff-common.hh
similarity index 98%
rename from src/hb-subset-cff-common-private.hh
rename to src/hb-subset-cff-common.hh
index 4013c3213..883584be0 100644
--- a/src/hb-subset-cff-common-private.hh
+++ b/src/hb-subset-cff-common.hh
@@ -27,10 +27,10 @@
#ifndef HB_SUBSET_CFF_COMMON_PRIVATE_HH
#define HB_SUBSET_CFF_COMMON_PRIVATE_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-subset-plan.hh"
-#include "hb-cff-interp-cs-common-private.hh"
+#include "hb-cff-interp-cs-common.hh"
namespace CFF {
diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc
index 4dbf3ff16..577182e4e 100644
--- a/src/hb-subset-cff1.cc
+++ b/src/hb-subset-cff1.cc
@@ -24,12 +24,12 @@
* Adobe Author(s): Michiharu Ariza
*/
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-cff1-table.hh"
#include "hb-set.h"
#include "hb-subset-cff1.hh"
#include "hb-subset-plan.hh"
-#include "hb-subset-cff-common-private.hh"
+#include "hb-subset-cff-common.hh"
#include "hb-cff1-interp-cs.hh"
using namespace CFF;
diff --git a/src/hb-subset-cff1.hh b/src/hb-subset-cff1.hh
index 729bc12b0..eb2bc53e7 100644
--- a/src/hb-subset-cff1.hh
+++ b/src/hb-subset-cff1.hh
@@ -27,7 +27,7 @@
#ifndef HB_SUBSET_CFF1_HH
#define HB_SUBSET_CFF1_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-subset-plan.hh"
diff --git a/src/hb-subset-cff2.cc b/src/hb-subset-cff2.cc
index 8d45b00ad..fee09d83a 100644
--- a/src/hb-subset-cff2.cc
+++ b/src/hb-subset-cff2.cc
@@ -24,12 +24,12 @@
* Adobe Author(s): Michiharu Ariza
*/
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-cff2-table.hh"
#include "hb-set.h"
#include "hb-subset-cff2.hh"
#include "hb-subset-plan.hh"
-#include "hb-subset-cff-common-private.hh"
+#include "hb-subset-cff-common.hh"
#include "hb-cff2-interp-cs.hh"
using namespace CFF;
diff --git a/src/hb-subset-cff2.hh b/src/hb-subset-cff2.hh
index f927070da..070124087 100644
--- a/src/hb-subset-cff2.hh
+++ b/src/hb-subset-cff2.hh
@@ -27,7 +27,7 @@
#ifndef HB_SUBSET_CFF2_HH
#define HB_SUBSET_CFF2_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-subset-plan.hh"
diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc
index 36af3beae..e335912f6 100644
--- a/src/hb-subset-glyf.cc
+++ b/src/hb-subset-glyf.cc
@@ -24,7 +24,7 @@
* Google Author(s): Garret Rieger, Roderick Sheeter
*/
-#include "hb-open-type-private.hh"
+#include "hb-open-type.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-set.h"
#include "hb-subset-glyf.hh"
diff --git a/src/hb-subset-glyf.hh b/src/hb-subset-glyf.hh
index 99b76db9b..c564206bd 100644
--- a/src/hb-subset-glyf.hh
+++ b/src/hb-subset-glyf.hh
@@ -27,7 +27,7 @@
#ifndef HB_SUBSET_GLYF_HH
#define HB_SUBSET_GLYF_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-subset-plan.hh"
diff --git a/src/hb-subset-input.cc b/src/hb-subset-input.cc
index 74470fd1f..d68550d70 100644
--- a/src/hb-subset-input.cc
+++ b/src/hb-subset-input.cc
@@ -24,8 +24,8 @@
* Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod
*/
-#include "hb-subset-private.hh"
-#include "hb-set-private.hh"
+#include "hb-subset.hh"
+#include "hb-set.hh"
/**
* hb_subset_input_create_or_fail:
diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index 125668272..1f643dc08 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -24,9 +24,9 @@
* Google Author(s): Garret Rieger, Roderick Sheeter
*/
-#include "hb-map-private.hh"
-#include "hb-subset-private.hh"
-#include "hb-set-private.hh"
+#include "hb-map.hh"
+#include "hb-subset.hh"
+#include "hb-set.hh"
#include "hb-subset-plan.hh"
#include "hb-ot-cmap-table.hh"
@@ -154,7 +154,7 @@ hb_subset_plan_create (hb_face_t *face,
plan->unicodes = hb_set_create();
plan->glyphs.init();
plan->source = hb_face_reference (face);
- plan->dest = hb_subset_face_create ();
+ plan->dest = hb_face_builder_create ();
plan->codepoint_to_glyph = hb_map_create();
plan->glyph_map = hb_map_create();
diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh
index 7501294d7..0f44f4b23 100644
--- a/src/hb-subset-plan.hh
+++ b/src/hb-subset-plan.hh
@@ -27,12 +27,12 @@
#ifndef HB_SUBSET_PLAN_HH
#define HB_SUBSET_PLAN_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-subset.h"
-#include "hb-subset-private.hh"
+#include "hb-subset.hh"
-#include "hb-map-private.hh"
+#include "hb-map.hh"
struct hb_subset_plan_t
{
@@ -89,7 +89,7 @@ struct hb_subset_plan_t
hb_blob_get_length (contents),
hb_blob_get_length (source_blob));
hb_blob_destroy (source_blob);
- return hb_subset_face_add_table(dest, tag, contents);
+ return hb_face_builder_add_table (dest, tag, contents);
}
};
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index bf9c39949..d106e0aec 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -24,14 +24,14 @@
* Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod
*/
-#include "hb-private.hh"
-#include "hb-open-type-private.hh"
+#include "hb.hh"
+#include "hb-open-type.hh"
#include "hb-subset-glyf.hh"
-#include "hb-subset-private.hh"
+#include "hb-subset.hh"
#include "hb-subset-plan.hh"
-#include "hb-open-file-private.hh"
+#include "hb-open-file.hh"
#include "hb-ot-cmap-table.hh"
#include "hb-ot-glyf-table.hh"
#include "hb-ot-hdmx-table.hh"
@@ -98,135 +98,6 @@ _subset (hb_subset_plan_t *plan)
}
-/*
- * A face that has add_table().
- */
-
-struct hb_subset_face_data_t
-{
- struct table_entry_t
- {
- inline int cmp (const hb_tag_t *t) const
- {
- if (*t < tag) return -1;
- if (*t > tag) return -1;
- return 0;
- }
-
- hb_tag_t tag;
- hb_blob_t *blob;
- };
-
- hb_vector_t tables;
-};
-
-static hb_subset_face_data_t *
-_hb_subset_face_data_create (void)
-{
- hb_subset_face_data_t *data = (hb_subset_face_data_t *) calloc (1, sizeof (hb_subset_face_data_t));
- if (unlikely (!data))
- return nullptr;
-
- data->tables.init ();
-
- return data;
-}
-
-static void
-_hb_subset_face_data_destroy (void *user_data)
-{
- hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data;
-
- for (unsigned int i = 0; i < data->tables.len; i++)
- hb_blob_destroy (data->tables[i].blob);
-
- data->tables.fini ();
-
- free (data);
-}
-
-static hb_blob_t *
-_hb_subset_face_data_reference_blob (hb_subset_face_data_t *data)
-{
-
- unsigned int table_count = data->tables.len;
- unsigned int face_length = table_count * 16 + 12;
-
- for (unsigned int i = 0; i < table_count; i++)
- face_length += hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob));
-
- char *buf = (char *) malloc (face_length);
- if (unlikely (!buf))
- return nullptr;
-
- hb_serialize_context_t c (buf, face_length);
- OT::OpenTypeFontFile *f = c.start_serialize ();
-
- bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2'));
- hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag;
-
- Supplier tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0]));
- Supplier blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0]));
- bool ret = f->serialize_single (&c,
- sfnt_tag,
- tags_supplier,
- blobs_supplier,
- table_count);
-
- c.end_serialize ();
-
- if (unlikely (!ret))
- {
- free (buf);
- return nullptr;
- }
-
- return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, free);
-}
-
-static hb_blob_t *
-_hb_subset_face_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data)
-{
- hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data;
-
- if (!tag)
- return _hb_subset_face_data_reference_blob (data);
-
- hb_subset_face_data_t::table_entry_t *entry = data->tables.lsearch (tag);
- if (entry)
- return hb_blob_reference (entry->blob);
-
- return nullptr;
-}
-
-/* TODO: Move this to hb-face.h and rename to hb_face_builder_create()
- * with hb_face_builder_add_table(). */
-hb_face_t *
-hb_subset_face_create (void)
-{
- hb_subset_face_data_t *data = _hb_subset_face_data_create ();
- if (unlikely (!data)) return hb_face_get_empty ();
-
- return hb_face_create_for_tables (_hb_subset_face_reference_table,
- data,
- _hb_subset_face_data_destroy);
-}
-
-hb_bool_t
-hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
-{
- if (unlikely (face->destroy != (hb_destroy_func_t) _hb_subset_face_data_destroy))
- return false;
-
- hb_subset_face_data_t *data = (hb_subset_face_data_t *) face->user_data;
- hb_subset_face_data_t::table_entry_t *entry = data->tables.push ();
-
- entry->tag = tag;
- entry->blob = hb_blob_reference (blob);
-
- return true;
-}
-
static bool
_subset_table (hb_subset_plan_t *plan,
hb_tag_t tag)
@@ -372,17 +243,3 @@ hb_subset (hb_face_t *source,
hb_subset_plan_destroy (plan);
return result;
}
-
-/**
- * hb_subset_get_all_codepoints:
- * @source: font face data to load.
- * @out: set to add the all codepoints covered by font face, source.
- */
-void
-hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out)
-{
- OT::cmap::accelerator_t cmap;
- cmap.init (source);
- cmap.get_all_codepoints (out);
- cmap.fini();
-}
diff --git a/src/hb-subset.h b/src/hb-subset.h
index f6d2ae0a0..8b7fcc6c9 100644
--- a/src/hb-subset.h
+++ b/src/hb-subset.h
@@ -80,9 +80,6 @@ hb_subset (hb_face_t *source,
hb_subset_profile_t *profile,
hb_subset_input_t *input);
-/* hb_subset_get_all_codepoints */
-HB_EXTERN void
-hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out);
HB_END_DECLS
diff --git a/src/hb-subset-private.hh b/src/hb-subset.hh
similarity index 77%
rename from src/hb-subset-private.hh
rename to src/hb-subset.hh
index 6b2b207ff..e3023d654 100644
--- a/src/hb-subset-private.hh
+++ b/src/hb-subset.hh
@@ -24,19 +24,18 @@
* Google Author(s): Garret Rieger, Roderick Sheeter
*/
-#ifndef HB_SUBSET_PRIVATE_HH
-#define HB_SUBSET_PRIVATE_HH
+#ifndef HB_SUBSET_HH
+#define HB_SUBSET_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-subset.h"
-#include "hb-font-private.hh"
+#include "hb-font.hh"
-typedef struct hb_subset_face_data_t hb_subset_face_data_t;
-
-struct hb_subset_input_t {
+struct hb_subset_input_t
+{
hb_object_header_t header;
ASSERT_POD ();
@@ -54,10 +53,5 @@ struct hb_subset_input_t {
*/
};
-HB_INTERNAL hb_face_t *
-hb_subset_face_create (void);
-HB_INTERNAL hb_bool_t
-hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob);
-
-#endif /* HB_SUBSET_PRIVATE_HH */
+#endif /* HB_SUBSET_HH */
diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc
index 56d13e7cd..624c1eb41 100644
--- a/src/hb-ucdn.cc
+++ b/src/hb-ucdn.cc
@@ -14,10 +14,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-unicode-private.hh"
-#include "hb-machinery-private.hh"
+#include "hb-unicode.hh"
+#include "hb-machinery.hh"
#include "ucdn.h"
diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc
index 8cb417233..bb1cd6821 100644
--- a/src/hb-unicode.cc
+++ b/src/hb-unicode.cc
@@ -28,9 +28,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
-#include "hb-unicode-private.hh"
+#include "hb-unicode.hh"
@@ -450,7 +450,7 @@ hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
}
-/* See hb-unicode-private.hh for details. */
+/* See hb-unicode.hh for details. */
const uint8_t
_hb_modified_combining_class[256] =
{
diff --git a/src/hb-unicode.h b/src/hb-unicode.h
index 2657f4813..226c5d5c9 100644
--- a/src/hb-unicode.h
+++ b/src/hb-unicode.h
@@ -40,6 +40,9 @@
HB_BEGIN_DECLS
+#define HB_UNICODE_MAX 0x10FFFFu
+
+
/* hb_unicode_general_category_t */
/* Unicode Character Database property: General_Category (gc) */
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode.hh
similarity index 99%
rename from src/hb-unicode-private.hh
rename to src/hb-unicode.hh
index fb16ba437..e6bca5f08 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode.hh
@@ -28,10 +28,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_UNICODE_PRIVATE_HH
-#define HB_UNICODE_PRIVATE_HH
+#ifndef HB_UNICODE_HH
+#define HB_UNICODE_HH
-#include "hb-private.hh"
+#include "hb.hh"
extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256];
@@ -366,4 +366,4 @@ DECLARE_NULL_INSTANCE (hb_unicode_funcs_t);
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL)))
-#endif /* HB_UNICODE_PRIVATE_HH */
+#endif /* HB_UNICODE_HH */
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 11b7384fa..4a77c8c1f 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -24,9 +24,9 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#define HB_SHAPER uniscribe
-#include "hb-shaper-impl-private.hh"
+#include "hb-shaper-impl.hh"
#include
#include
@@ -34,7 +34,7 @@
#include "hb-uniscribe.h"
-#include "hb-open-file-private.hh"
+#include "hb-open-file.hh"
#include "hb-ot-name-table.hh"
#include "hb-ot-tag.h"
diff --git a/src/hb-utf-private.hh b/src/hb-utf.hh
similarity index 98%
rename from src/hb-utf-private.hh
rename to src/hb-utf.hh
index 211eb4dc0..eccb632e4 100644
--- a/src/hb-utf-private.hh
+++ b/src/hb-utf.hh
@@ -24,10 +24,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_UTF_PRIVATE_HH
-#define HB_UTF_PRIVATE_HH
+#ifndef HB_UTF_HH
+#define HB_UTF_HH
-#include "hb-private.hh"
+#include "hb.hh"
struct hb_utf8_t
@@ -279,4 +279,4 @@ struct hb_latin1_t
}
};
-#endif /* HB_UTF_PRIVATE_HH */
+#endif /* HB_UTF_HH */
diff --git a/src/hb-vector-private.hh b/src/hb-vector.hh
similarity index 97%
rename from src/hb-vector-private.hh
rename to src/hb-vector.hh
index 1ef20d438..31341747c 100644
--- a/src/hb-vector-private.hh
+++ b/src/hb-vector.hh
@@ -25,10 +25,10 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_VECTOR_PRIVATE_HH
-#define HB_VECTOR_PRIVATE_HH
+#ifndef HB_VECTOR_HH
+#define HB_VECTOR_HH
-#include "hb-private.hh"
+#include "hb.hh"
template
@@ -235,4 +235,4 @@ struct hb_vector_t
};
-#endif /* HB_VECTOR_PRIVATE_HH */
+#endif /* HB_VECTOR_HH */
diff --git a/src/hb-warning.cc b/src/hb-warning.cc
index f7a87b5ab..9fb410038 100644
--- a/src/hb-warning.cc
+++ b/src/hb-warning.cc
@@ -24,14 +24,14 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#if defined(HB_ATOMIC_INT_NIL)
#error "Could not find any system to define atomic_int macros, library WILL NOT be thread-safe"
-#error "Check hb-atomic-private.hh for possible resolutions."
+#error "Check hb-atomic.hh for possible resolutions."
#endif
#if defined(HB_MUTEX_IMPL_NIL)
#error "Could not find any system to define mutex macros, library WILL NOT be thread-safe"
-#error "Check hb-mutex-private.hh for possible resolutions."
+#error "Check hb-mutex.hh for possible resolutions."
#endif
diff --git a/src/hb-private.hh b/src/hb.hh
similarity index 98%
rename from src/hb-private.hh
rename to src/hb.hh
index efe7bda9e..557ae6b35 100644
--- a/src/hb-private.hh
+++ b/src/hb.hh
@@ -26,8 +26,8 @@
* Google Author(s): Behdad Esfahbod
*/
-#ifndef HB_PRIVATE_HH
-#define HB_PRIVATE_HH
+#ifndef HB_HH
+#define HB_HH
#define _GNU_SOURCE 1
@@ -470,11 +470,11 @@ _hb_memalign(void **memptr, size_t alignment, size_t size)
/* Headers we include for everyone. Keep sorted. They express dependency amongst
* themselves, but no other file should include them.*/
-#include "hb-atomic-private.hh"
+#include "hb-atomic.hh"
#include "hb-debug.hh"
#include "hb-dsalgs.hh"
-#include "hb-mutex-private.hh"
+#include "hb-mutex.hh"
#include "hb-null.hh"
-#include "hb-object-private.hh"
+#include "hb-object.hh"
-#endif /* HB_PRIVATE_HH */
+#endif /* HB_HH */
diff --git a/src/main.cc b/src/main.cc
index 98a1320bf..490b76e5b 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -25,9 +25,9 @@
*/
#include "hb-static.cc"
-#include "hb-open-file-private.hh"
+#include "hb-open-file.hh"
#include "hb-ot-layout-gdef-table.hh"
-#include "hb-ot-layout-gsubgpos-private.hh"
+#include "hb-ot-layout-gsubgpos.hh"
#ifdef HAVE_GLIB
#include
diff --git a/src/test-buffer-serialize.cc b/src/test-buffer-serialize.cc
index 39eb13da7..a91f4f7e9 100644
--- a/src/test-buffer-serialize.cc
+++ b/src/test-buffer-serialize.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb.h"
#include "hb-ot.h"
diff --git a/src/test-size-params.cc b/src/test-size-params.cc
index 3c43852b3..e53a47d8d 100644
--- a/src/test-size-params.cc
+++ b/src/test-size-params.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb.h"
#include "hb-ot.h"
diff --git a/src/test-unicode-ranges.cc b/src/test-unicode-ranges.cc
index dbc5fa426..1334ea030 100644
--- a/src/test-unicode-ranges.cc
+++ b/src/test-unicode-ranges.cc
@@ -24,7 +24,7 @@
* Google Author(s): Garret Rieger
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb-ot-os2-unicode-ranges.hh"
diff --git a/src/test-would-substitute.cc b/src/test-would-substitute.cc
index 1836d720c..268f7db98 100644
--- a/src/test-would-substitute.cc
+++ b/src/test-would-substitute.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb.h"
#include "hb-ot.h"
diff --git a/src/test.cc b/src/test.cc
index cf59e00ac..f0eace8c4 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -24,7 +24,7 @@
* Google Author(s): Behdad Esfahbod
*/
-#include "hb-private.hh"
+#include "hb.hh"
#include "hb.h"
diff --git a/test/api/test-common.c b/test/api/test-common.c
index f6f0d4851..e9fae1351 100644
--- a/test/api/test-common.c
+++ b/test/api/test-common.c
@@ -32,7 +32,6 @@
static void
test_types_int (void)
{
- /* We already ASSERT_STATIC these in hb-private.h, but anyway */
g_assert_cmpint (sizeof (int8_t), ==, 1);
g_assert_cmpint (sizeof (uint8_t), ==, 1);
g_assert_cmpint (sizeof (int16_t), ==, 2);
diff --git a/test/api/test-subset-codepoints.c b/test/api/test-subset-codepoints.c
index 3bd1fe062..affe93149 100644
--- a/test/api/test-subset-codepoints.c
+++ b/test/api/test-subset-codepoints.c
@@ -28,12 +28,12 @@
#include "hb-subset-test.h"
static void
-test_get_all_codepoints_format4 (void)
+test_collect_unicodes_format4 (void)
{
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format4.ttf");
hb_set_t *codepoints = hb_set_create();
- hb_subset_get_all_codepoints (face, codepoints);
+ hb_face_collect_unicodes (face, codepoints);
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
g_assert (hb_set_next (codepoints, &cp));
@@ -49,12 +49,12 @@ test_get_all_codepoints_format4 (void)
}
static void
-test_get_all_codepoints_format12 (void)
+test_collect_unicodes_format12 (void)
{
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.format12.ttf");
hb_set_t *codepoints = hb_set_create();
- hb_subset_get_all_codepoints (face, codepoints);
+ hb_face_collect_unicodes (face, codepoints);
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
g_assert (hb_set_next (codepoints, &cp));
@@ -70,12 +70,12 @@ test_get_all_codepoints_format12 (void)
}
static void
-test_get_all_codepoints (void)
+test_collect_unicodes (void)
{
hb_face_t *face = hb_subset_test_open_font("fonts/Roboto-Regular.abc.ttf");
hb_set_t *codepoints = hb_set_create();
- hb_subset_get_all_codepoints (face, codepoints);
+ hb_face_collect_unicodes (face, codepoints);
hb_codepoint_t cp = HB_SET_VALUE_INVALID;
g_assert (hb_set_next (codepoints, &cp));
@@ -95,9 +95,9 @@ main (int argc, char **argv)
{
hb_test_init (&argc, &argv);
- hb_test_add (test_get_all_codepoints);
- hb_test_add (test_get_all_codepoints_format4);
- hb_test_add (test_get_all_codepoints_format12);
+ hb_test_add (test_collect_unicodes);
+ hb_test_add (test_collect_unicodes_format4);
+ hb_test_add (test_collect_unicodes_format12);
return hb_test_run();
}
diff --git a/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc b/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc
index 38f338ba4..3d43627b3 100644
--- a/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc
+++ b/test/fuzzing/hb-subset-get-codepoints-fuzzer.cc
@@ -13,7 +13,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
hb_face_t *face = hb_face_create (blob, 0);
hb_set_t *output = hb_set_create();
- hb_subset_get_all_codepoints (face, output);
+ hb_face_collect_unicodes (face, output);
hb_set_destroy (output);
hb_face_destroy (face);
diff --git a/test/shaping/data/in-house/tests/fuzzed.tests b/test/shaping/data/in-house/tests/fuzzed.tests
index 43a193341..a6ce93d02 100644
--- a/test/shaping/data/in-house/tests/fuzzed.tests
+++ b/test/shaping/data/in-house/tests/fuzzed.tests
@@ -10,7 +10,7 @@
../fonts/fab39d60d758cb586db5a504f218442cd1395725.ttf:--font-funcs=ot:U+0041,U+0041:[gid0=0+1000|gid0=1+1000]
../fonts/205edd09bd3d141cc9580f650109556cc28b22cb.ttf:--font-funcs=ot:U+0041:[gid0=0+1000]
../fonts/217a934cfe15c548b572c203dceb2befdf026462.ttf:--font-funcs=ot:U+0061,U+0061,U+0061:[]
-../fonts/558661aa659912f4d30ecd27bd09835171a8e2b0.ttf:--font-funcs=ot:U+FFFD,U+E0100,U+FFFD,U+E0010:[]
+../fonts/558661aa659912f4d30ecd27bd09835171a8e2b0.ttf:--font-funcs=ot:U+FFFD,U+E0100,U+FFFD,U+E0010:[gid3584=0+1000|gid1024=0+1000|gid1=0+1000|gid8=0+1000|gid3=0+1000|gid0=0+1000|gid1=0+1000|gid3584=0+1000|gid3584=2+1000|gid1024=2+1000|gid1=2+1000|gid8=2+1000|gid3=2+1000|gid0=2+1000|gid1=2+1000|gid3584=2+1000]
../fonts/a34a9191d9376bda419836effeef7e75c1386016.ttf:--font-funcs=ot:U+0041:[]
../fonts/a69118c2c2ada48ff803d9149daa54c9ebdae30e.ttf:--font-funcs=ot:U+0041:[gid0=0+1229]
../fonts/b6acef662e0beb8d5fcf5b61c6b0ca69537b7402.ttf:--font-funcs=ot:U+0041:[gid0=0+1000]
diff --git a/test/shaping/data/in-house/tests/vertical.tests b/test/shaping/data/in-house/tests/vertical.tests
index 17df28e6a..a16a7a002 100644
--- a/test/shaping/data/in-house/tests/vertical.tests
+++ b/test/shaping/data/in-house/tests/vertical.tests
@@ -1,3 +1,3 @@
../fonts/191826b9643e3f124d865d617ae609db6a2ce203.ttf:--direction=t --font-funcs=ft:U+300C:[uni300C.vert=0@-512,-578+0,-1024]
../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ft:U+0041,U+0042:[gid1=0@-654,-2128+0,-2789|gid2=1@-665,-2125+0,-2789]
-../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ot:U+0041,U+0042:[gid1=0@-654,-2189+0,-2789|gid2=1@-665,-2189+0,-2789]
+../fonts/f9b1dd4dcb515e757789a22cb4241107746fd3d0.ttf:--direction=t --font-funcs=ot:U+0041,U+0042:[gid1=0@-654,-2189+0,-2048|gid2=1@-665,-2189+0,-2048]
diff --git a/util/Makefile.am b/util/Makefile.am
index d4ab9cdc5..b8bf88418 100644
--- a/util/Makefile.am
+++ b/util/Makefile.am
@@ -47,7 +47,9 @@ hb_shape_SOURCES = $(HB_SHAPE_sources)
bin_PROGRAMS += hb-shape
hb_subset_SOURCES = $(HB_SUBSET_CLI_sources)
-hb_subset_LDADD = $(LDADD) $(top_builddir)/src/libharfbuzz-subset.la
+hb_subset_LDADD = \
+ $(LDADD) \
+ $(top_builddir)/src/libharfbuzz-subset.la
bin_PROGRAMS += hb-subset
if HAVE_OT
diff --git a/util/ansi-print.hh b/util/ansi-print.hh
index 1ea5b3742..9640d892d 100644
--- a/util/ansi-print.hh
+++ b/util/ansi-print.hh
@@ -27,8 +27,7 @@
#ifndef ANSI_PRINT_HH
#define ANSI_PRINT_HH
-#include "hb-private.hh"
-#include /* for int types */
+#include "hb.hh"
void
ansi_print_image_rgb24 (const uint32_t *data,
diff --git a/util/hb-subset.cc b/util/hb-subset.cc
index 20617554c..a15495fa2 100644
--- a/util/hb-subset.cc
+++ b/util/hb-subset.cc
@@ -29,7 +29,7 @@
#include "main-font-text.hh"
#include "hb-subset.h"
-#include "hb-subset-private.hh"
+#include "hb-subset.hh" /* XXX */
/*
* Command line interface to the harfbuzz font subsetter.
diff --git a/util/helper-cairo-ansi.hh b/util/helper-cairo-ansi.hh
index cf18ea495..bc2313219 100644
--- a/util/helper-cairo-ansi.hh
+++ b/util/helper-cairo-ansi.hh
@@ -27,7 +27,7 @@
#ifndef HELPER_CAIRO_ANSI_HH
#define HELPER_CAIRO_ANSI_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include
diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh
index 50bc0af09..1613ce427 100644
--- a/util/helper-cairo.hh
+++ b/util/helper-cairo.hh
@@ -27,7 +27,7 @@
#ifndef HELPER_CAIRO_HH
#define HELPER_CAIRO_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "options.hh"
#include
diff --git a/util/main-font-text.hh b/util/main-font-text.hh
index 3390371c5..01bd2d4d9 100644
--- a/util/main-font-text.hh
+++ b/util/main-font-text.hh
@@ -27,7 +27,7 @@
#ifndef HB_MAIN_FONT_TEXT_HH
#define HB_MAIN_FONT_TEXT_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "options.hh"
/* main() body for utilities taking font and processing text.*/
diff --git a/util/options.hh b/util/options.hh
index 2160d5ec3..345790943 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -27,7 +27,7 @@
#ifndef OPTIONS_HH
#define OPTIONS_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include
#include
diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh
index fa419f185..da0d88033 100644
--- a/util/shape-consumer.hh
+++ b/util/shape-consumer.hh
@@ -27,7 +27,7 @@
#ifndef HB_SHAPE_CONSUMER_HH
#define HB_SHAPE_CONSUMER_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "options.hh"
diff --git a/util/view-cairo.hh b/util/view-cairo.hh
index 00df68c29..677f74b38 100644
--- a/util/view-cairo.hh
+++ b/util/view-cairo.hh
@@ -27,7 +27,7 @@
#ifndef VIEW_CAIRO_HH
#define VIEW_CAIRO_HH
-#include "hb-private.hh"
+#include "hb.hh"
#include "options.hh"
#include "helper-cairo.hh"