[face] Add hb_face_create_from_file_or_fail()
New API:
+ hb_face_create_from_file_or_fail()
diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt
index 49cae7f..fff7730 100644
--- a/docs/harfbuzz-sections.txt
+++ b/docs/harfbuzz-sections.txt
@@ -358,6 +358,7 @@
hb_face_t
hb_face_create
hb_face_create_or_fail
+hb_face_create_from_file_or_fail
hb_reference_table_func_t
hb_face_create_for_tables
hb_face_get_empty
diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 873d9b2..c363636 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -617,10 +617,9 @@
/**
* hb_blob_create_from_file_or_fail:
- * @file_name: A font filename
+ * @file_name: A filename
*
- * Creates a new blob containing the data from the
- * specified binary font file.
+ * Creates a new blob containing the data from the specified file.
*
* The filename is passed directly to the system on all platforms,
* except on Windows, where the filename is interpreted as UTF-8.
diff --git a/src/hb-face.cc b/src/hb-face.cc
index 8d429c6..6e743a3 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -272,7 +272,7 @@
* contains no usable font face at the specified index.
*
* Return value: (transfer full): The new face object, or `NULL` if
- * no face is found at the specified index
+ * no face is found at the specified index.
*
* XSince: REPLACEME
**/
@@ -292,6 +292,33 @@
}
/**
+ * hb_face_create_from_file_or_fail:
+ * @file_name: A font filename
+ * @index: The index of the face within the file
+ *
+ * A thin wrapper around hb_blob_create_from_file_or_fail()
+ * followed by hb_face_create_or_fail().
+ *
+ * Return value: (transfer full): The new face object, or `NULL` if
+ * no face is found at the specified index or the file cannot be read.
+ *
+ * XSince: REPLACEME
+ **/
+HB_EXTERN hb_face_t *
+hb_face_create_from_file_or_fail (const char *file_name,
+ unsigned int index)
+{
+ hb_blob_t *blob = hb_blob_create_from_file_or_fail (file_name);
+ if (unlikely (!blob))
+ return nullptr;
+
+ hb_face_t *face = hb_face_create_or_fail (blob, index);
+ hb_blob_destroy (blob);
+
+ return face;
+}
+
+/**
* hb_face_get_empty:
*
* Fetches the singleton empty face object.
diff --git a/src/hb-face.h b/src/hb-face.h
index f37bd3c..8aec681 100644
--- a/src/hb-face.h
+++ b/src/hb-face.h
@@ -63,6 +63,10 @@
hb_face_create_or_fail (hb_blob_t *blob,
unsigned int index);
+HB_EXTERN hb_face_t *
+hb_face_create_from_file_or_fail (const char *file_name,
+ unsigned int index);
+
/**
* hb_reference_table_func_t:
* @face: an #hb_face_t to reference table for