Add hb_face_count, a new API (#1002)
Simply, it returns the number of faces on a font blob. To be used on hb-sanitizer tool but other clients also can benefit from it.
This commit is contained in:
parent
4a115fe7fe
commit
32da0c6bc4
2
TODO
2
TODO
|
@ -27,8 +27,6 @@ API additions
|
|||
|
||||
- Add query / enumeration API for aalt-like features?
|
||||
|
||||
- SFNT api? get_num_faces?
|
||||
|
||||
- Add segmentation API
|
||||
|
||||
- Add hb-fribidi glue?
|
||||
|
|
|
@ -169,6 +169,7 @@ hb_coretext_font_get_ct_font
|
|||
|
||||
<SECTION>
|
||||
<FILE>hb-face</FILE>
|
||||
hb_face_count
|
||||
hb_face_create
|
||||
hb_face_create_for_tables
|
||||
hb_face_destroy
|
||||
|
|
|
@ -35,6 +35,29 @@
|
|||
#include "hb-ot-maxp-table.hh"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* hb_face_count: Get number of faces on the blob
|
||||
* @blob:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value: Number of faces on the blob
|
||||
*
|
||||
* Since: REPLACEME
|
||||
**/
|
||||
unsigned int
|
||||
hb_face_count (hb_blob_t *blob)
|
||||
{
|
||||
if (unlikely (!blob))
|
||||
return 0;
|
||||
|
||||
hb_blob_t *sanitized = OT::Sanitizer<OT::OpenTypeFontFile> ().sanitize (blob);
|
||||
const OT::OpenTypeFontFile& ot = *OT::Sanitizer<OT::OpenTypeFontFile>::lock_instance (sanitized);
|
||||
|
||||
return ot.get_face_count ();
|
||||
}
|
||||
|
||||
/*
|
||||
* hb_face_t
|
||||
*/
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
HB_BEGIN_DECLS
|
||||
|
||||
|
||||
HB_EXTERN unsigned int
|
||||
hb_face_count (hb_blob_t *blob);
|
||||
|
||||
|
||||
/*
|
||||
* hb_face_t
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue