Skip to content

Commit

Permalink
Fix more docs
Browse files Browse the repository at this point in the history
More fonts

Update .readthedocs.yml

readthedocs/readthedocs.org#4912 (comment)
  • Loading branch information
baseplate-admin committed Apr 13, 2024
1 parent 0cfc91e commit 591b51e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ build:
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
- poetry install --with docs
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

# Build documentation in the "docs/" directory with Sphinx
sphinx:
Expand Down
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Safe bindings to `resvg <https://github.com/RazrFalcon/resvg>`_
:caption: Contents:

installation
usgae
usage
resvg
contributing

Indices and tables
Expand Down
47 changes: 45 additions & 2 deletions docs/resvg.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
Resvg Module
============

.. currentmodule:: resvg_py.svg_to_base64
.. 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
:param svg_string: A string containing valid svg.
:type svg_string: string

.. function
:param width: An Integer containing the pixels size for width.
:type width: int or None

:param height: An Integer containing the pixels size for height.
:type height: int or None

:param zoom: An Integer containing the zoom percentage.
:type zoom: int or None

:param dpi: An Integer containing DPI size for the svg rendering.
:type dpi: int or None

: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>`_.
:type resources_dir: string or None

:param languages: A list of string containing the languages used for `svg` rendering
:type languages: list[str] or None

:param font_size: An integer describing the font_size.
:param font_family: A string that describes the font family used in SVG.
:param serif_family: A string that describes the serif font family used in SVG.
:param sans_serif_family: A string that describes the sans serif font family used in SVG.
:param cursive_family: A string that describes the cursive font family used in SVG.
:param fantasy_family: A string that describes the fantasy font family used in SVG.
:param monospace_family: A string that describes the monospace font family used in SVG.

:param font_files: A list of paths that contain the font file.
:param font_dirs: A list of directories that contain the font file. This parameter will add all the present files in the directory.

: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"**.
:type shape_rendering: "optimize_speed" or "crisp_edges" or **"geometric_precision"**

: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"**.
:type text_rendering: "optimize_speed" or **"optimize_legibility"** or "geometric_precision"

: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"**.
:type image_rendering: **"optimize_quality"** or "optimize_speed"



:return: base64 encoded string.
:rtype: str
2 changes: 1 addition & 1 deletion src/rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ fn svg_to_base64(
};

let _text_rendering = match text_rendering
.unwrap_or("geometric_precision".to_string())
.unwrap_or("optimize_legibility".to_string())
.as_ref()
{
"optimize_speed" => resvg::usvg::TextRendering::OptimizeSpeed,
Expand Down

0 comments on commit 591b51e

Please sign in to comment.