singe/thirdparty/SDL3_ttf/external/plutosvg
2026-09-10 23:27:10 -05:00
..
cmake More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
examples More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
source More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
subprojects More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
.gitignore More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
.gitmodules More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
camera.png More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
CMakeLists.txt More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
LICENSE More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
meson.build More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
meson_options.txt More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00
README.md More file formats supported. Actual MIDI. Framefiles now lazily open handles to prevent running out of them. 2026-09-10 23:27:10 -05:00

emoji-collection.png

PlutoSVG

PlutoSVG is a compact and efficient SVG rendering library written in C. It is specifically designed for parsing and rendering SVG documents embedded in OpenType fonts, providing an optimal balance between speed and minimal memory usage. It is also suitable for rendering scalable icons.

Basic Usage

#include <plutosvg.h>

#include <stdio.h>

int main(void)
{
    plutosvg_document_t* document = plutosvg_document_load_from_file("camera.svg", -1, -1);
    if(document == NULL) {
        printf("Unable to load: camera.svg\n");
        return -1;
    }

    plutovg_surface_t* surface = plutosvg_document_render_to_surface(document, NULL, -1, -1, NULL, NULL, NULL);
    plutovg_surface_write_to_png(surface, "camera.png");
    plutosvg_document_destroy(document);
    plutovg_surface_destroy(surface);
    return 0;
}

camera.png

Integrating with FreeType

#include <plutosvg-ft.h>

#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_MODULE_H

int main(void)
{
    FT_Library library;

    // Initialize the FreeType library
    if(FT_Init_FreeType(&library)) {
        // Handle error
        return -1;
    }

    // Set PlutoSVG hooks for the SVG module
    if(FT_Property_Set(library, "ot-svg", "svg-hooks", &plutosvg_ft_hooks)) {
        // Handle error
        return -1;
    }

    // Your code here

    // Clean up
    FT_Done_FreeType(library);
    return 0;
}

Installation

Follow the steps below to install PlutoSVG using either Meson or CMake.

Using Meson

git clone https://github.com/sammycage/plutosvg.git
cd plutosvg
meson setup build
meson compile -C build
meson install -C build

Using CMake

git clone --recursive https://github.com/sammycage/plutosvg.git
cd plutosvg
cmake -B build .
cmake --build build
cmake --install build

Projects Using PlutoSVG