Tiny SVG rendering library in C
  • C 94.1%
  • CMake 4%
  • Meson 1.9%
Find a file
2026-04-14 19:03:43 +01:00
.github Bump actions/checkout to v6 2026-03-19 02:19:53 +01:00
cmake Add freetype dependency to plutosvgConfig.cmake.in 2025-05-15 09:02:50 +01:00
examples Update 2025-02-21 14:39:31 +01:00
plutovg@1a8412d057 Bump plutovg version to 1.1.0 2025-05-15 15:46:31 +01:00
source Fix closing tag parsing to exclude trailing whitespace from tag name 2026-04-14 19:03:43 +01:00
subprojects Update subproject fallback to track the latest PlutoVG commit 2024-09-10 11:29:32 +01:00
.gitignore Update codebase for initial release 2024-08-02 18:41:19 +01:00
.gitmodules Consume plutovg as submodule instead of FetchContent 2025-02-11 11:09:33 +01:00
camera.png Update examples 2024-08-13 03:04:07 +01:00
CMakeLists.txt Check If Target Library Plutovg Already Exists in CMake Project 2025-09-08 21:27:45 +08:00
LICENSE Update copyright year to 2026 2026-01-08 10:08:07 +01:00
meson.build Release v0.0.7 2025-05-15 16:08:50 +01:00
meson_options.txt Implement plutosvg_ft_svg_hooks 2024-08-04 00:26:11 +01:00
README.md Update README.md 2025-05-29 20:15:02 +01: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