[name] Start implementing hb_ot_name_get_utf16()
This commit is contained in:
parent
740cde8991
commit
c2aa409537
|
@ -165,8 +165,9 @@ struct name
|
||||||
inline void init (hb_face_t *face)
|
inline void init (hb_face_t *face)
|
||||||
{
|
{
|
||||||
this->blob = hb_sanitize_context_t().reference_table<name> (face);
|
this->blob = hb_sanitize_context_t().reference_table<name> (face);
|
||||||
const name *table = this->blob->as<name> ();
|
this->table = this->blob->as<name> ();
|
||||||
const hb_array_t<NameRecord> &all_names = hb_array_t<NameRecord> (table->nameRecordZ.arrayZ, table->count);
|
const hb_array_t<NameRecord> &all_names = hb_array_t<NameRecord> (this->table->nameRecordZ.arrayZ,
|
||||||
|
this->table->count);
|
||||||
|
|
||||||
this->names.init ();
|
this->names.init ();
|
||||||
|
|
||||||
|
@ -204,6 +205,7 @@ struct name
|
||||||
private:
|
private:
|
||||||
hb_blob_t *blob;
|
hb_blob_t *blob;
|
||||||
public:
|
public:
|
||||||
|
const name *table;
|
||||||
hb_vector_t<hb_ot_name_entry_t> names;
|
hb_vector_t<hb_ot_name_entry_t> names;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,3 +48,25 @@ hb_ot_name_get_names (hb_face_t *face,
|
||||||
*entries = name.names.arrayZ();
|
*entries = name.names.arrayZ();
|
||||||
return name.names.len;
|
return name.names.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hb_bool_t
|
||||||
|
hb_ot_name_get_utf16 (hb_face_t *face,
|
||||||
|
hb_name_id_t name_id,
|
||||||
|
hb_language_t language,
|
||||||
|
unsigned int *text_size /* IN/OUT */,
|
||||||
|
uint16_t *text /* OUT */)
|
||||||
|
{
|
||||||
|
const OT::name_accelerator_t &name = _get_name (face);
|
||||||
|
unsigned int idx = 0; //XXX
|
||||||
|
hb_bytes_t bytes = name.table->get_name (idx);
|
||||||
|
if (*text_size)
|
||||||
|
{
|
||||||
|
/* TODO Switch to walking string and validating. */
|
||||||
|
memcpy (text, bytes.arrayZ, MIN (*text_size * 2, bytes.len));
|
||||||
|
}
|
||||||
|
/* XXX Null-terminate. */
|
||||||
|
*text_size = bytes.len / 2; //TODO
|
||||||
|
/* TODO Fallback? */
|
||||||
|
return true; //XXX
|
||||||
|
}
|
||||||
|
|
|
@ -49,12 +49,14 @@ typedef unsigned int hb_name_id_t;
|
||||||
#define HB_NAME_ID_INVALID 0xFFFF
|
#define HB_NAME_ID_INVALID 0xFFFF
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
HB_EXTERN hb_bool_t
|
HB_EXTERN hb_bool_t
|
||||||
hb_ot_name_get_utf8 (hb_face_t *face,
|
Xhb_ot_name_get_utf8 (hb_face_t *face,
|
||||||
hb_name_id_t name_id,
|
hb_name_id_t name_id,
|
||||||
hb_language_t language,
|
hb_language_t language,
|
||||||
unsigned int *text_size /* IN/OUT */,
|
unsigned int *text_size /* IN/OUT */,
|
||||||
char *text /* OUT */);
|
char *text /* OUT */);
|
||||||
|
#endif
|
||||||
|
|
||||||
HB_EXTERN hb_bool_t
|
HB_EXTERN hb_bool_t
|
||||||
hb_ot_name_get_utf16 (hb_face_t *face,
|
hb_ot_name_get_utf16 (hb_face_t *face,
|
||||||
|
@ -63,12 +65,14 @@ hb_ot_name_get_utf16 (hb_face_t *face,
|
||||||
unsigned int *text_size /* IN/OUT */,
|
unsigned int *text_size /* IN/OUT */,
|
||||||
uint16_t *text /* OUT */);
|
uint16_t *text /* OUT */);
|
||||||
|
|
||||||
|
#if 0
|
||||||
HB_EXTERN hb_bool_t
|
HB_EXTERN hb_bool_t
|
||||||
hb_ot_name_get_utf32 (hb_face_t *face,
|
Xhb_ot_name_get_utf32 (hb_face_t *face,
|
||||||
hb_name_id_t name_id,
|
hb_name_id_t name_id,
|
||||||
hb_language_t language,
|
hb_language_t language,
|
||||||
unsigned int *text_size /* IN/OUT */,
|
unsigned int *text_size /* IN/OUT */,
|
||||||
uint32_t *text /* OUT */);
|
uint32_t *text /* OUT */);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct hb_ot_name_entry_t
|
typedef struct hb_ot_name_entry_t
|
||||||
|
|
Loading…
Reference in New Issue