提交 c8accf1d 编写于 作者: B Behdad Esfahbod

[OT] Templatize Coverage::add_coverage()

上级 8fbfda92
...@@ -134,7 +134,8 @@ struct RangeRecord ...@@ -134,7 +134,8 @@ struct RangeRecord
return glyphs->intersects (start, end); return glyphs->intersects (start, end);
} }
inline void add_coverage (hb_set_t *glyphs) const { template <typename set_t>
inline void add_coverage (set_t *glyphs) const {
glyphs->add_range (start, end); glyphs->add_range (start, end);
} }
...@@ -361,7 +362,8 @@ struct CoverageFormat1 ...@@ -361,7 +362,8 @@ struct CoverageFormat1
return glyphs->has (glyphArray[index]); return glyphs->has (glyphArray[index]);
} }
inline void add_coverage (hb_set_t *glyphs) const { template <typename set_t>
inline void add_coverage (set_t *glyphs) const {
unsigned int count = glyphArray.len; unsigned int count = glyphArray.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
glyphs->add (glyphArray[i]); glyphs->add (glyphArray[i]);
...@@ -422,7 +424,8 @@ struct CoverageFormat2 ...@@ -422,7 +424,8 @@ struct CoverageFormat2
return false; return false;
} }
inline void add_coverage (hb_set_t *glyphs) const { template <typename set_t>
inline void add_coverage (set_t *glyphs) const {
unsigned int count = rangeRecord.len; unsigned int count = rangeRecord.len;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
rangeRecord[i].add_coverage (glyphs); rangeRecord[i].add_coverage (glyphs);
...@@ -505,7 +508,8 @@ struct Coverage ...@@ -505,7 +508,8 @@ struct Coverage
} }
} }
inline void add_coverage (hb_set_t *glyphs) const { template <typename set_t>
inline void add_coverage (set_t *glyphs) const {
switch (u.format) { switch (u.format) {
case 1: u.format1.add_coverage (glyphs); break; case 1: u.format1.add_coverage (glyphs); break;
case 2: u.format2.add_coverage (glyphs); break; case 2: u.format2.add_coverage (glyphs); break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册