Permalink
Browse files

[HB] Port ot-layout to new public API

  • Loading branch information...
1 parent 678bed4 commit 0ead481a5a8623103565fd7d924666e7342278dd @behdad behdad committed Aug 2, 2009
View
@@ -1,3 +1,4 @@
+- Get rid of custom GSUB/GPOS table type enum?
- Test OpenType 1.6 mark filtering sets
- When sanitizing, have to do a second round to make sure no toe-stepping
- HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH vs LookupType::... mess
View
@@ -45,6 +45,7 @@ typedef uint32_t hb_tag_t;
((const char *) s)[1], \
((const char *) s)[2], \
((const char *) s)[3]))
+#define HB_TAG_NONE HB_TAG(0,0,0,0)
typedef uint32_t hb_codepoint_t;
typedef int32_t hb_position_t;
View
@@ -314,6 +314,15 @@ hb_font_destroy (hb_font_t *font)
free (font);
}
+hb_face_t *
+hb_font_get_face (hb_font_t *font)
+{
+ if (HB_OBJECT_IS_INERT (font))
+ return &_hb_face_nil;
+
+ return font->face;
+}
+
void
hb_font_set_scale (hb_font_t *font,
hb_16dot16_t x_scale,
View
@@ -176,6 +176,9 @@ hb_font_get_reference_count (hb_font_t *font);
void
hb_font_destroy (hb_font_t *font);
+hb_face_t *
+hb_font_get_face (hb_font_t *font);
+
/*
* XXX
* should we decompose this to units_per_EM and font-size?
@@ -90,10 +90,10 @@ struct CaretValueFormat1
friend struct CaretValue;
private:
- inline int get_caret_value (hb_ot_layout_t *layout, hb_codepoint_t glyph_id) const
+ inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
{
/* XXX vertical */
- return layout->gpos_info.x_scale * coordinate / 0x10000;
+ return context->font->x_scale * coordinate / 0x10000;
}
private:
@@ -107,7 +107,7 @@ struct CaretValueFormat2
friend struct CaretValue;
private:
- inline int get_caret_value (hb_ot_layout_t *layout, hb_codepoint_t glyph_id) const
+ inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
{
return /* TODO contour point */ 0;
}
@@ -122,11 +122,11 @@ struct CaretValueFormat3
{
friend struct CaretValue;
- inline int get_caret_value (hb_ot_layout_t *layout, hb_codepoint_t glyph_id) const
+ inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
{
/* XXX vertical */
- return layout->gpos_info.x_scale * coordinate / 0x10000 +
- (this+deviceTable).get_delta (layout->gpos_info.x_ppem) << 6;
+ return context->font->x_scale * coordinate / 0x10000 +
+ (this+deviceTable).get_delta (context->font->x_ppem) << 6;
}
private:
@@ -142,12 +142,12 @@ ASSERT_SIZE (CaretValueFormat3, 6);
struct CaretValue
{
/* XXX we need access to a load-contour-point vfunc here */
- int get_caret_value (hb_ot_layout_t *layout, hb_codepoint_t glyph_id) const
+ int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
{
switch (u.format) {
- case 1: return u.format1->get_caret_value (layout, glyph_id);
- case 2: return u.format2->get_caret_value (layout, glyph_id);
- case 3: return u.format3->get_caret_value (layout, glyph_id);
+ case 1: return u.format1->get_caret_value (context, glyph_id);
+ case 2: return u.format2->get_caret_value (context, glyph_id);
+ case 3: return u.format3->get_caret_value (context, glyph_id);
default:return 0;
}
}
@@ -164,15 +164,15 @@ ASSERT_SIZE (CaretValue, 2);
struct LigGlyph
{
- inline void get_lig_carets (hb_ot_layout_t *layout,
+ inline void get_lig_carets (hb_ot_layout_context_t *context,
hb_codepoint_t glyph_id,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */) const
{
unsigned int count = MIN (carets.len, *caret_count);
for (unsigned int i = 0; i < count; i++)
- caret_array[i] = (this+carets[i]).get_caret_value (layout, glyph_id);
+ caret_array[i] = (this+carets[i]).get_caret_value (context, glyph_id);
*caret_count = carets.len;
}
@@ -187,7 +187,7 @@ ASSERT_SIZE (LigGlyph, 2);
struct LigCaretList
{
- inline bool get_lig_carets (hb_ot_layout_t *layout,
+ inline bool get_lig_carets (hb_ot_layout_context_t *context,
hb_codepoint_t glyph_id,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */) const
@@ -199,7 +199,7 @@ struct LigCaretList
return false;
}
const LigGlyph &lig_glyph = this+ligGlyph[index];
- lig_glyph.get_lig_carets (layout, glyph_id, caret_count, caret_array);
+ lig_glyph.get_lig_carets (context, glyph_id, caret_count, caret_array);
return true;
}
@@ -279,11 +279,11 @@ struct GDEF
{ return (this+attachList).get_attach_points (glyph_id, point_count, point_array); }
inline bool has_lig_carets () const { return ligCaretList != 0; }
- inline bool get_lig_carets (hb_ot_layout_t *layout,
+ inline bool get_lig_carets (hb_ot_layout_context_t *context,
hb_codepoint_t glyph_id,
unsigned int *caret_count /* IN/OUT */,
int *caret_array /* OUT */) const
- { return (this+ligCaretList).get_lig_carets (layout, glyph_id, caret_count, caret_array); }
+ { return (this+ligCaretList).get_lig_carets (context, glyph_id, caret_count, caret_array); }
inline bool has_mark_sets () const { return version >= 0x00010002 && markGlyphSetsDef[0] != 0; }
inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
Oops, something went wrong.

0 comments on commit 0ead481

Please sign in to comment.