Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the full set of options #3

Open
jboarman opened this issue Apr 7, 2023 · 0 comments
Open

Implement the full set of options #3

jboarman opened this issue Apr 7, 2023 · 0 comments
Assignees

Comments

@jboarman
Copy link
Member

jboarman commented Apr 7, 2023

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants