sparkfish / glyphcast Goto Github PK
View Code? Open in Web Editor NEWCairo-inspired dependency-free replacement for casting SVG to PNG or PDF format
License: MIT License
Cairo-inspired dependency-free replacement for casting SVG to PNG or PDF format
License: MIT License
This addition would expose an ability to render a PDF from an SVG using a provided set of Options
, so the identical will be almost interface to the existing interface to convert SVG to PNG.
Though the Options
will vary, we should aim to unify them as much as possible so that we could use the same Options
class if that appears possible after exploring this further.
See repo located at https://github.com/typst/svg2pdf. This lib shares many of the same dependencies as resvg
so hopefully the size of the final package binary will not be overly affected.
For this issue, we need to include adding all the cute little buttons to the README, such as:
In preparation for building a solid framework for the community, we want strong checks in place to ensure the quality of the code being produced.
When a new branch is merged to rel
and a tag is created on that branch, we should trigger a new release.
Automation of the build will ensure we can separately set up a process that keeps track of upstream updates to resvg
.
Since our key dependency is resvg
, we need to ensure we are getting all the latest updates when those are released.
There does not appear to be a GitHub Action trigger available that activates when an update to a dependency is released. So, we will need to come up with a mechanism for identifying the current release number and comparing that to some tracking that within GH Actions, such as use of upload-artifact
and download-artifact
for tracking that state.
Another approach may be to leverage GitHub's Dependabot to trigger a PR based on the release of a dependency.
This may be done as the options are added, but this issue tracks the additional work effort and assurance that all the options have test coverage.
resvg
's existing benchmark offers a set of over 1,600 SVG files, each prepared with an associated PNG baseline for testing standard's compatibility. This will provide us with a reference dataset for establishing our own metrics for comparing to alternative Python libraries against the full set of test images.
Tests should be performed by converting SVGs to both PNGs and PDFs (as separate timing-level benchmarks).
resvg
filters support and this example that tests the turbulence filter)The Options
class provides customization and configuration options for rendering SVG files. The main options have been documented in the README, but now we need to ensure they are all implemented.
Also, it would be ideal to allow the options to be defined as a dictionary as a possible style for passing the options, so either as a dictionary or instance of a proper Options
class.
If there are parameters that are problematic to deal with, we may defer those until later. But, if they are trivial to address now, then we should knock them all out now.
Name | Purpose | Type | Allowed Values | Example |
---|---|---|---|---|
width | Defines the width of the output image in pixels | Integer | Positive integers (1 and above) | options.width = 300 |
height | Defines the height of the output image in pixels | Integer | Positive integers (1 and above) | options.height = 200 |
fit_to | Controls how the SVG should be scaled to fit the output | String or Tuple | "original", ("width", value), ("height", value), ("zoom", factor) | options.fit_to = ("width", 300) |
background | Sets the background color of the output image | String or None | 6 or 8-digit hex color codes or None |
options.background = "#FFAABB" |
dpi | Specifies the DPI value used for rendering | Float | Positive float values (greater than 0) | options.dpi = 96.0 |
languages | Sets the list of languages for systemLanguage attribute |
List of strings | Valid BCP 47 language codes | options.languages = ["en", "fr", "es"] |
shape_rendering | Controls the rendering mode for shapes | String | "optimizeSpeed", "crispEdges", "geometricPrecision | options.shape_rendering = "optimizeSpeed" |
text_rendering | Controls the rendering mode for text | String | "optimizeSpeed", "optimizeLegibility", "geometricPrecision | options.text_rendering = "optimizeLegibility" |
image_rendering | Controls the rendering mode for images | String | "optimizeQuality", "optimizeSpeed", "pixelated | options.image_rendering = "optimizeQuality" |
skip_system_fonts | Skip loading system fonts when rendering text | Boolean | True or False |
options.skip_system_fonts = True |
font_size | Specifies the default font size for text elements | Float | Positive float values (greater than 0) | options.font_size = 14.0 |
font_family | Specifies the default font family for text elements | String | Valid font family names | options.font_family = "Arial" |
font_path | Path to a custom font file | String | Valid file path | options.font_path = "path/to/font.ttf" |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.