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:
Ebrahim Byagowi 2018-06-05 18:56:26 +04:30 committed by GitHub
parent 4a115fe7fe
commit 32da0c6bc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 38 deletions

2
TODO
View File

@ -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?

View File

@ -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

View File

@ -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
*/

View File

@ -37,6 +37,10 @@
HB_BEGIN_DECLS
HB_EXTERN unsigned int
hb_face_count (hb_blob_t *blob);
/*
* hb_face_t
*/