提交 5ebabece 编写于 作者: B Behdad Esfahbod

Move unicode_funcs to buffer

上级 d5a8e460
- cmap14 support in get_glyph callback - cmap14 support in get_glyph callback
- Use size_t in sanitize? - Use size_t in sanitize?
- Move unicode_funcs to buffer
- Buffer error handling? - Buffer error handling?
hb-ot: hb-ot:
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "hb-private.h" #include "hb-private.h"
#include "hb-buffer.h" #include "hb-buffer.h"
#include "hb-unicode-private.h"
HB_BEGIN_DECLS HB_BEGIN_DECLS
...@@ -69,6 +70,14 @@ ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)); ...@@ -69,6 +70,14 @@ ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
struct _hb_buffer_t { struct _hb_buffer_t {
hb_reference_count_t ref_count; hb_reference_count_t ref_count;
/* Information about how the text in the buffer should be treated */
hb_unicode_funcs_t *unicode;
hb_direction_t direction;
/* Buffer contents */
unsigned int allocated; unsigned int allocated;
hb_bool_t have_output; /* weather we have an output buffer going on */ hb_bool_t have_output; /* weather we have an output buffer going on */
...@@ -81,7 +90,8 @@ struct _hb_buffer_t { ...@@ -81,7 +90,8 @@ struct _hb_buffer_t {
hb_internal_glyph_info_t *out_string; hb_internal_glyph_info_t *out_string;
hb_internal_glyph_position_t *positions; hb_internal_glyph_position_t *positions;
hb_direction_t direction; /* Other stuff */
unsigned int max_lig_id; unsigned int max_lig_id;
}; };
......
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
static hb_buffer_t _hb_buffer_nil = { static hb_buffer_t _hb_buffer_nil = {
HB_REFERENCE_COUNT_INVALID /* ref_count */ HB_REFERENCE_COUNT_INVALID, /* ref_count */
&_hb_unicode_funcs_nil /* unicode */
}; };
/* Here is how the buffer works internally: /* Here is how the buffer works internally:
...@@ -84,6 +86,8 @@ hb_buffer_create (unsigned int pre_alloc_size) ...@@ -84,6 +86,8 @@ hb_buffer_create (unsigned int pre_alloc_size)
if (pre_alloc_size) if (pre_alloc_size)
hb_buffer_ensure(buffer, pre_alloc_size); hb_buffer_ensure(buffer, pre_alloc_size);
buffer->unicode = &_hb_unicode_funcs_nil;
return buffer; return buffer;
} }
...@@ -104,12 +108,45 @@ hb_buffer_destroy (hb_buffer_t *buffer) ...@@ -104,12 +108,45 @@ hb_buffer_destroy (hb_buffer_t *buffer)
{ {
HB_OBJECT_DO_DESTROY (buffer); HB_OBJECT_DO_DESTROY (buffer);
hb_unicode_funcs_destroy (buffer->unicode);
free (buffer->in_string); free (buffer->in_string);
free (buffer->positions); free (buffer->positions);
free (buffer); free (buffer);
} }
void
hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
hb_unicode_funcs_t *unicode)
{
hb_unicode_funcs_reference (unicode);
hb_unicode_funcs_destroy (buffer->unicode);
buffer->unicode = unicode;
}
hb_unicode_funcs_t *
hb_buffer_get_unicode_funcs (hb_buffer_t *buffer)
{
return buffer->unicode;
}
void
hb_buffer_set_direction (hb_buffer_t *buffer,
hb_direction_t direction)
{
buffer->direction = direction;
}
hb_direction_t
hb_buffer_get_direction (hb_buffer_t *buffer)
{
return buffer->direction;
}
void void
hb_buffer_clear (hb_buffer_t *buffer) hb_buffer_clear (hb_buffer_t *buffer)
{ {
...@@ -171,14 +208,6 @@ hb_buffer_add_glyph (hb_buffer_t *buffer, ...@@ -171,14 +208,6 @@ hb_buffer_add_glyph (hb_buffer_t *buffer,
buffer->in_length++; buffer->in_length++;
} }
void
hb_buffer_set_direction (hb_buffer_t *buffer,
hb_direction_t direction)
{
buffer->direction = direction;
}
/* HarfBuzz-Internal API */ /* HarfBuzz-Internal API */
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#define HB_BUFFER_H #define HB_BUFFER_H
#include "hb-common.h" #include "hb-common.h"
#include "hb-unicode.h"
HB_BEGIN_DECLS HB_BEGIN_DECLS
...@@ -80,6 +81,14 @@ void ...@@ -80,6 +81,14 @@ void
hb_buffer_destroy (hb_buffer_t *buffer); hb_buffer_destroy (hb_buffer_t *buffer);
void
hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
hb_unicode_funcs_t *unicode_funcs);
hb_unicode_funcs_t *
hb_buffer_get_unicode_funcs (hb_buffer_t *buffer);
void void
hb_buffer_set_direction (hb_buffer_t *buffer, hb_buffer_set_direction (hb_buffer_t *buffer,
hb_direction_t direction); hb_direction_t direction);
...@@ -88,6 +97,7 @@ hb_direction_t ...@@ -88,6 +97,7 @@ hb_direction_t
hb_buffer_get_direction (hb_buffer_t *buffer); hb_buffer_get_direction (hb_buffer_t *buffer);
void void
hb_buffer_clear (hb_buffer_t *buffer); hb_buffer_clear (hb_buffer_t *buffer);
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "hb-font.h" #include "hb-font.h"
#include "hb-unicode-private.h"
#include "hb-ot-layout-private.h" #include "hb-ot-layout-private.h"
HB_BEGIN_DECLS HB_BEGIN_DECLS
...@@ -68,8 +67,6 @@ struct _hb_face_t { ...@@ -68,8 +67,6 @@ struct _hb_face_t {
hb_destroy_func_t destroy; hb_destroy_func_t destroy;
void *user_data; void *user_data;
hb_unicode_funcs_t *unicode;
hb_ot_layout_t ot_layout; hb_ot_layout_t ot_layout;
}; };
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "hb-private.h" #include "hb-private.h"
#include "hb-font-private.h" #include "hb-font-private.h"
#include "hb-unicode-private.h"
#include "hb-open-file-private.hh" #include "hb-open-file-private.hh"
#include "hb-blob.h" #include "hb-blob.h"
...@@ -138,8 +137,6 @@ static hb_face_t _hb_face_nil = { ...@@ -138,8 +137,6 @@ static hb_face_t _hb_face_nil = {
NULL, /* destroy */ NULL, /* destroy */
NULL, /* user_data */ NULL, /* user_data */
&_hb_unicode_funcs_nil, /* unicode */
{} /* ot_layout */ {} /* ot_layout */
}; };
...@@ -208,23 +205,9 @@ hb_face_destroy (hb_face_t *face) ...@@ -208,23 +205,9 @@ hb_face_destroy (hb_face_t *face)
if (face->destroy) if (face->destroy)
face->destroy (face->user_data); face->destroy (face->user_data);
hb_unicode_funcs_destroy (face->unicode);
free (face); free (face);
} }
void
hb_face_set_unicode_funcs (hb_face_t *face,
hb_unicode_funcs_t *unicode)
{
if (HB_OBJECT_IS_INERT (face))
return;
hb_unicode_funcs_reference (unicode);
hb_unicode_funcs_destroy (face->unicode);
face->unicode = unicode;
}
hb_blob_t * hb_blob_t *
hb_face_get_table (hb_face_t *face, hb_face_get_table (hb_face_t *face,
hb_tag_t tag) hb_tag_t tag)
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "hb-common.h" #include "hb-common.h"
#include "hb-blob.h" #include "hb-blob.h"
#include "hb-unicode.h"
HB_BEGIN_DECLS HB_BEGIN_DECLS
...@@ -61,10 +60,6 @@ hb_face_get_reference_count (hb_face_t *face); ...@@ -61,10 +60,6 @@ hb_face_get_reference_count (hb_face_t *face);
void void
hb_face_destroy (hb_face_t *face); hb_face_destroy (hb_face_t *face);
void
hb_face_set_unicode_funcs (hb_face_t *face,
hb_unicode_funcs_t *unicode_funcs);
hb_blob_t * hb_blob_t *
hb_face_get_table (hb_face_t *face, hb_face_get_table (hb_face_t *face,
hb_tag_t tag); hb_tag_t tag);
...@@ -158,6 +153,10 @@ void ...@@ -158,6 +153,10 @@ void
hb_font_set_funcs (hb_font_t *font, hb_font_set_funcs (hb_font_t *font,
hb_font_funcs_t *klass); hb_font_funcs_t *klass);
hb_font_funcs_t *
hb_font_get_funcs (hb_font_t *font);
/* /*
* XXX * XXX
* should we decompose this to units_per_EM and font-size? * should we decompose this to units_per_EM and font-size?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册