michaelrsweet / pdfio

PDFio is a simple C library for reading and writing PDF files.
https://www.msweet.org/pdfio
Apache License 2.0
199 stars 44 forks source link

pdfioFileCreateFontObjFromFile should provide access to the underlying ttf_t struct #44

Closed zacii7 closed 1 year ago

zacii7 commented 1 year ago

when working with custom fonts, is is often necessary to calculate the bounds of a block of text. there is a function exported from ttf.h, ttfGetExtents which does this, requiring a struct of type ttf_t. I can get such a struct by calling ttfCreate, but I also need to embed it into the PDF document using pdfioFileCreateFontObjFromFile. this function already calls ttfCreate under the hood, and destroys it.

It would be convenient if there were a way to access the underlying ttf_t struct from the call to pdfioFileCreateFontObjFromFile. or alternatively, embed a font into the PDF directly from the ttf_t obtained from ttfCreate.

michaelrsweet commented 1 year ago

This is what issue #17 is meant to address…