sparkfish/glyphcast

Implement the full set of options

Opened this issue · 0 comments

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"