Skip to content

Commit 591b51e

Browse files
Fix more docs
More fonts Update .readthedocs.yml readthedocs/readthedocs.org#4912 (comment)
1 parent 0cfc91e commit 591b51e

File tree

4 files changed

+49
-5
lines changed

4 files changed

+49
-5
lines changed

.readthedocs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ build:
2222
post_install:
2323
# Install dependencies with 'docs' dependency group
2424
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
25-
- poetry install --with docs
25+
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs
2626

2727
# Build documentation in the "docs/" directory with Sphinx
2828
sphinx:

docs/index.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Safe bindings to `resvg <https://github.com/RazrFalcon/resvg>`_
1313
:caption: Contents:
1414

1515
installation
16-
usgae
16+
usage
17+
resvg
1718
contributing
1819

1920
Indices and tables

docs/resvg.rst

+45-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,50 @@
11
Resvg Module
22
============
33

4-
.. currentmodule:: resvg_py.svg_to_base64
4+
.. py:function:: svg_to_base64(svg_string:str,width:int|None=None,height:int|None=None,zoom:int|None=None,dpi:int|None=None,resources_dir:width:str|None=None,languages:list[str]|None=None,font_size:float|None=None,font_family:str|None=None,serif_family:str|None=None,sans_serif_family:str|None=None,cursive_family:str|None=None,fantasy_family:str|None=None,monospace_family:str|None=None,font_files:list[str]|None=None,font_dirs:list[str]|None=None,shape_rendering:"optimize_speed"|"crisp_edges"|"geometric_precision"="geometric_precision",text_rendering:"optimize_speed"|"optimize_legibility"|"geometric_precision"="optimize_legibility",image_rendering:"optimize_quality"|"optimize_speed"="optimize_quality",background:str|None=None) -> str
55
6+
:param svg_string: A string containing valid svg.
7+
:type svg_string: string
68

7-
.. function
9+
:param width: An Integer containing the pixels size for width.
10+
:type width: int or None
11+
12+
:param height: An Integer containing the pixels size for height.
13+
:type height: int or None
14+
15+
:param zoom: An Integer containing the zoom percentage.
16+
:type zoom: int or None
17+
18+
:param dpi: An Integer containing DPI size for the svg rendering.
19+
:type dpi: int or None
20+
21+
:param resources_dir: A directory that contains resources for svg rendering. Such as `foreign objects <https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject>`_.
22+
:type resources_dir: string or None
23+
24+
:param languages: A list of string containing the languages used for `svg` rendering
25+
:type languages: list[str] or None
26+
27+
:param font_size: An integer describing the font_size.
28+
:param font_family: A string that describes the font family used in SVG.
29+
:param serif_family: A string that describes the serif font family used in SVG.
30+
:param sans_serif_family: A string that describes the sans serif font family used in SVG.
31+
:param cursive_family: A string that describes the cursive font family used in SVG.
32+
:param fantasy_family: A string that describes the fantasy font family used in SVG.
33+
:param monospace_family: A string that describes the monospace font family used in SVG.
34+
35+
:param font_files: A list of paths that contain the font file.
36+
:param font_dirs: A list of directories that contain the font file. This parameter will add all the present files in the directory.
37+
38+
:param shape_rendering: The `shape rendering method <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering>`_ used in resvg. **Defaults to "geometric_precision"**.
39+
:type shape_rendering: "optimize_speed" or "crisp_edges" or **"geometric_precision"**
40+
41+
:param text_rendering: The `text rendering method <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-rendering>`_ used in resvg. **Defaults to "optimize_legibility"**.
42+
:type text_rendering: "optimize_speed" or **"optimize_legibility"** or "geometric_precision"
43+
44+
:param image_rendering: The `image rendering method <https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering>`_ used in resvg. **Defaults to "optimize_quality"**.
45+
:type image_rendering: **"optimize_quality"** or "optimize_speed"
46+
47+
48+
49+
:return: base64 encoded string.
50+
:rtype: str

src/rust/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn svg_to_base64(
188188
};
189189

190190
let _text_rendering = match text_rendering
191-
.unwrap_or("geometric_precision".to_string())
191+
.unwrap_or("optimize_legibility".to_string())
192192
.as_ref()
193193
{
194194
"optimize_speed" => resvg::usvg::TextRendering::OptimizeSpeed,

0 commit comments

Comments
 (0)