> From: Konstantin Ritt <[email protected]> > Date: Fri, 24 May 2019 19:16:24 +0300 > Cc: Ebrahim Byagowi <[email protected]>, Harfbuzz > <[email protected]> > > hb_blob_t *my_reference_table(hb_face_t * /*face*/, hb_tag_t tag, void > *user_data) > { > HDC hdc = (HDC)user_data; > SelectObject(hdc, hfont); > > char *buffer = NULL; > DWORD length = 0; > > length = GetFontData(hdc, byte_swap<DWORD>(tag), 0, buffer, length); > if (length == GDI_ERROR) > return hb_blob_get_empty(); > > buffer = (char *)::malloc(length); > length = GetFontData(hdc, byte_swap<DWORD>(tag), 0, buffer, length); > if (length == GDI_ERROR) > length = 0; > > return hb_blob_create((const char *)buffer, length, > HB_MEMORY_MODE_READONLY, buffer, ::free); > } > > hb_face_t *my_face_create_from_hdc(HDC hdc) > { > return hb_face_create_for_tables(my_reference_table, (void *)hdc, NULL); > }
Thanks, I think how to manage the memory of a blob is now clear to me. But the question about hb_face_t management is still not entirely clear. I don't really need hb_face_t, I only create it as an intermediate step towards hb_font_t. So my question is: once I have hb_font_t, can I destroy the hb_face_t I used to create hb_font_t? If not, how do I arrange for hb_face_t to be destroyed when the corresponding hb_font_t is destroyed? TIA _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
