Skip to content

Support for loading fontfiles from buffer/stream? #233

@AdamT213

Description

@AdamT213

I have many fontfiles stored in an s3 bucket. Currently I write them to a temp file, then read them, something like this:

res = s3.get_object(bucket: 'bucket', key: 'key', response_target: "#{Dir.tmpdir()}/#{font}.ttf")
text = Vips::Image.text("some text", {fontfile: "#{Dir.tmpdir()}/#{font}.ttf", font: font_name})

This seems to have a significant impact on the performance of the whole processing operation, compared to just loading images, which can be done without writing to disk. Is there a similar way to load fontfiles? I don't assume that a stream would help much, since unlike images, I imagine the font files must be read entirely before the fonts can be applied, but how about reading from a buffer? If this is not supported, would it be possible to add? As far as I can tell from the source, it seems like the Image::text method comes directly from libvips, but perhaps I am missing something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions