Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2026-09

New in FPC: SVG support.

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

FPC for a long time had support for raster images in fcl-image. It now has support for what is probably the most used vector image today: SVG.

Support is broad:

- All drawing primitives.
- Full font support (using platform native font support, freetype as fallback).
- CSS support (using fcl-css)
- Animation support (SMIL)
- Filters
- paint servers (patterns)

What is not supported:
- Javascript
- The DOM
- Color profiles (still planned)
Which is logical, since we're not in the browser.

The code renders a SVG file to a fcl-image supported format. For animated SVGs, the code can render a single frame at any given timestamp, or create a series of image frames in a GIF.

The results have been carefully tuned and compared with the W3C SVG reference set of images, and conformance to the standard is very good: mean/median difference <3%, barely visible with the naked eye.

An example of what can be done is viewable in

https://www.freepascal.org/~michael/svg/

As part of the work, the existing GIF reader was extended and a GIF writer was created - making the animation in the above page possible.

The code is compilable with FPC 3.2.2, I'll upload the code to a separate repo for those that want to use it with FPC 3.2.2
(it then needs trunk's fcl-css and image support included)

Still to do:
- Color profiles
- Generate a PDF image from the SVG.
- Lazarus component(s).

Enjoy!

Michael.

Thomas Kurz
to Michael Van Canneyt

That's great news! Cool!

Thank you for that. It's a really useful enhancement. 👍

Earlier message 50 lines
----- Original Message ----- From: Michael Van Canneyt via fpc-pascal To: FPC mailing list Sent: Sunday, September 20, 2026, 22:58:36 Subject: [fpc-pascal] New in FPC: SVG support. Hi, FPC for a long time had support for raster images in fcl-image. It now has support for what is probably the most used vector image today: SVG. Support is broad: - All drawing primitives. - Full font support (using platform native font support, freetype as fallback). - CSS support (using fcl-css) - Animation support (SMIL) - Filters - paint servers (patterns) What is not supported: - Javascript - The DOM - Color profiles (still planned) Which is logical, since we're not in the browser. The code renders a SVG file to a fcl-image supported format. For animated SVGs, the code can render a single frame at any given timestamp, or create a series of image frames in a GIF. The results have been carefully tuned and compared with the W3C SVG reference set of images, and conformance to the standard is very good: mean/median difference <3%, barely visible with the naked eye. An example of what can be done is viewable in https://www.freepascal.org/~michael/svg/ As part of the work, the existing GIF reader was extended and a GIF writer was created - making the animation in the above page possible. The code is compilable with FPC 3.2.2, I'll upload the code to a separate repo for those that want to use it with FPC 3.2.2 (it then needs trunk's fcl-css and image support included) Still to do: - Color profiles - Generate a PDF image from the SVG. - Lazarus component(s). Enjoy! Michael.