atexit (free_ft_library);
#endif
}
- FT_New_Face (ft_library,
- font_opts->font_file,
- font_opts->face_index,
- &ft_face);
+
+ unsigned int blob_length;
+ const char *blob_data = hb_blob_get_data (font_opts->blob, &blob_length);
+
+ if (FT_New_Memory_Face (ft_library,
+ (const FT_Byte *) blob_data,
+ blob_length,
+ font_opts->face_index,
+ &ft_face))
+ fail (false, "FT_New_Memory_Face fail");
}
if (!ft_face)
{
if (font)
return font;
- hb_blob_t *blob = nullptr;
-
/* Create the blob */
if (!font_file)
fail (true, "No font file set");
strerror (errno));
g_string_append_len (gs, buf, ret);
}
+ unsigned int len = gs->len;
char *font_data = g_string_free (gs, false);
- blob = hb_blob_create (font_data, gs->len,
+ blob = hb_blob_create (font_data, len,
HB_MEMORY_MODE_WRITABLE, font_data,
(hb_destroy_func_t) g_free);
} else {
font_size_x = font_size_y = default_font_size;
font_funcs = nullptr;
+ blob = nullptr;
font = nullptr;
add_options (parser);
hb_font_t *get_font (void) const;
char *font_file;
+ mutable hb_blob_t *blob;
int face_index;
hb_variation_t *variations;
unsigned int num_variations;
mutable double font_size_y;
char *font_funcs;
- private:
+private:
mutable hb_font_t *font;
};