1212#include " common/hb_set_unique_ptr.h"
1313#include " hb.h"
1414#include " ift/encoder/condition.h"
15+ #include " util/encoder_config.pb.h"
1516
1617namespace ift ::encoder {
1718
@@ -25,8 +26,8 @@ typedef uint32_t glyph_id_t;
2526 *
2627 * A segmentation describes the groups of glyphs belong to each patch as well as
2728 * the conditions under which those patches should be loaded. A properly formed
28- * segmentation should have an associated set of patches and conditions which will
29- * satisfy the "glyph closure requirement", which is:
29+ * segmentation should have an associated set of patches and conditions which
30+ * will satisfy the "glyph closure requirement", which is:
3031 *
3132 * The set of glyphs contained in patches loaded for a font subset definition (a
3233 * set of Unicode codepoints and a set of layout feature tags) through the patch
@@ -111,6 +112,8 @@ class GlyphSegmentation {
111112 return conditions ().size () == 1 && conditions ().at (0 ).size () == 1 ;
112113 }
113114
115+ ActivationConditionProto ToConfigProto () const ;
116+
114117 bool operator <(const ActivationCondition& other) const ;
115118
116119 bool operator ==(const ActivationCondition& other) const {
@@ -126,9 +129,11 @@ class GlyphSegmentation {
126129 patch_id_t activated_;
127130 };
128131
129- GlyphSegmentation (absl::btree_set<glyph_id_t > init_font_glyphs,
132+ GlyphSegmentation (absl::btree_set<hb_codepoint_t > init_font_codepoints,
133+ absl::btree_set<glyph_id_t > init_font_glyphs,
130134 absl::btree_set<glyph_id_t > unmapped_glyphs)
131- : init_font_glyphs_(init_font_glyphs),
135+ : init_font_codepoints_(init_font_codepoints),
136+ init_font_glyphs_ (init_font_glyphs),
132137 unmapped_glyphs_(unmapped_glyphs) {}
133138
134139 /*
@@ -192,6 +197,15 @@ class GlyphSegmentation {
192197 return init_font_glyphs_;
193198 };
194199
200+ /*
201+ * These codepoints should be included in the initial font.
202+ */
203+ const absl::btree_set<hb_codepoint_t >& InitialFontCodepoints () const {
204+ return init_font_codepoints_;
205+ };
206+
207+ EncoderConfig ToConfigProto () const ;
208+
195209 static absl::Status GroupsToSegmentation (
196210 const absl::btree_map<absl::btree_set<segment_index_t >,
197211 absl::btree_set<glyph_id_t >>& and_glyph_groups,
@@ -203,6 +217,7 @@ class GlyphSegmentation {
203217 void CopySegments (const std::vector<common::hb_set_unique_ptr>& segments);
204218
205219 private:
220+ absl::btree_set<hb_codepoint_t > init_font_codepoints_;
206221 absl::btree_set<glyph_id_t > init_font_glyphs_;
207222 absl::btree_set<glyph_id_t > unmapped_glyphs_;
208223 absl::btree_set<ActivationCondition> conditions_;
0 commit comments