Skip to content

Commit 5e66463

Browse files
committed
Update docs and code tidy up
1 parent c74511a commit 5e66463

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ if(PLUTOSVG_ENABLE_FREETYPE)
5656
endif()
5757

5858
include(GNUInstallDirs)
59-
6059
include(CMakePackageConfigHelpers)
60+
6161
configure_package_config_file(
6262
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/plutosvgConfig.cmake.in"
6363
"${CMAKE_CURRENT_BINARY_DIR}/plutosvgConfig.cmake"

source/plutosvg-ft.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
#include <math.h>
6666

6767
#include <ft2build.h>
68+
#include FT_FREETYPE_H
6869
#include FT_OTSVG_H
6970
#include FT_COLOR_H
7071

source/plutosvg.h

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -66,38 +66,38 @@ PLUTOSVG_API int plutosvg_version(void);
6666
/**
6767
* @brief Returns the version string of PlutoSVG.
6868
*
69-
* @return Pointer to a string containing the version information.
69+
* @return The version number as a null-terminated string.
7070
*/
7171
PLUTOSVG_API const char* plutosvg_version_string(void);
7272

7373
/**
74-
* @brief plutosvg_document_t
74+
* @brief Represents an abstract SVG document handle.
7575
*/
7676
typedef struct plutosvg_document plutosvg_document_t;
7777

7878
/**
7979
* @brief Callback type for resolving CSS color variables in SVG documents.
8080
*
81-
* @param closure User-defined data for the callback.
81+
* @param closure User-defined data passed to the callback.
8282
* @param name Name of the color variable.
8383
* @param length Length of the color variable name.
84-
* @param color Pointer to `plutovg_color_t` where the resolved color will be stored.
84+
* @param color Pointer to a `plutovg_color_t` object where the resolved color will be stored.
8585
* @return `true` if the color variable was successfully resolved; `false` otherwise.
8686
*/
87-
typedef bool(*plutosvg_palette_func_t)(void* closure, const char* name, int length, plutovg_color_t* color);
87+
typedef bool (*plutosvg_palette_func_t)(void* closure, const char* name, int length, plutovg_color_t* color);
8888

8989
/**
9090
* @brief Loads an SVG document from a data buffer.
9191
*
92-
* @note The buffer pointed to by `data` must remain valid until the `plutosvg_document_t` object is destroyed.
92+
* @note The buffer pointed to by `data` must remain valid until the returned `plutosvg_document_t` object is destroyed.
9393
*
9494
* @param data Pointer to the SVG data buffer.
9595
* @param length Length of the data buffer.
96-
* @param width Container width for resolving the initial viewport.
97-
* @param height Container height for resolving the initial viewport.
98-
* @param destroy_func Custom function to call when the document is destroyed.
99-
* @param closure User-defined data for the `destroy_func` callback.
100-
* @return Pointer to the loaded `plutosvg_document_t` structure, or NULL if loading fails.
96+
* @param width Container width used to resolve the intrinsic width, or `-1` if unspecified.
97+
* @param height Container height used to resolve the intrinsic height, or `-1` if unspecified.
98+
* @param destroy_func Custom function called when the document is destroyed.
99+
* @param closure User-defined data passed to the `destroy_func` callback.
100+
* @return Pointer to the loaded `plutosvg_document_t` object, or `NULL` if loading fails.
101101
*/
102102
PLUTOSVG_API plutosvg_document_t* plutosvg_document_load_from_data(const char* data, int length, float width, float height,
103103
plutovg_destroy_func_t destroy_func, void* closure);
@@ -106,9 +106,9 @@ PLUTOSVG_API plutosvg_document_t* plutosvg_document_load_from_data(const char* d
106106
* @brief Loads an SVG document from a file.
107107
*
108108
* @param filename Path to the SVG file.
109-
* @param width Container width for resolving the initial viewport.
110-
* @param height Container height for resolving the initial viewport.
111-
* @return Pointer to the loaded `plutosvg_document_t` structure, or NULL if loading fails.
109+
* @param width Container width used to resolve the intrinsic width, or `-1` if unspecified.
110+
* @param height Container height used to resolve the intrinsic height, or `-1` if unspecified.
111+
* @return Pointer to the loaded `plutosvg_document_t` object, or `NULL` if loading fails.
112112
*/
113113
PLUTOSVG_API plutosvg_document_t* plutosvg_document_load_from_file(const char* filename, float width, float height);
114114

@@ -119,24 +119,24 @@ PLUTOSVG_API plutosvg_document_t* plutosvg_document_load_from_file(const char* f
119119
* @param id ID of the SVG element to render, or `NULL` to render the entire document.
120120
* @param canvas Canvas onto which the SVG element or document will be rendered.
121121
* @param current_color Color used to resolve CSS `currentColor` values.
122-
* @param palette_func Callback for resolving CSS color variables.
123-
* @param closure User-defined data for the `palette_func` callback.
122+
* @param palette_func Callback function for resolving CSS color variables.
123+
* @param closure User-defined data passed to the `palette_func` callback.
124124
* @return `true` if rendering was successful; `false` otherwise.
125125
*/
126126
PLUTOSVG_API bool plutosvg_document_render(const plutosvg_document_t* document, const char* id, plutovg_canvas_t* canvas,
127127
const plutovg_color_t* current_color, plutosvg_palette_func_t palette_func, void* closure);
128128

129129
/**
130-
* @brief Renders an SVG document or a specific element onto a surface.
130+
* @brief Renders an SVG document or a specific element to a surface.
131131
*
132132
* @param document Pointer to the SVG document.
133133
* @param id ID of the SVG element to render, or `NULL` to render the entire document.
134-
* @param width Width of the surface, or `-1` if unspecified.
135-
* @param height Height of the surface, or `-1` if unspecified.
136-
* @param current_color Color for resolving CSS `currentColor` values.
137-
* @param palette_func Callback for resolving CSS color variables.
138-
* @param closure User-defined data for the `palette_func` callback.
139-
* @return Pointer to the rendered `plutovg_surface_t` structure, or `NULL` if rendering fails.
134+
* @param width Expected width of the surface, or `-1` if unspecified.
135+
* @param height Expected height of the surface, or `-1` if unspecified.
136+
* @param current_color Color used to resolve CSS `currentColor` values.
137+
* @param palette_func Callback function for resolving CSS color variables.
138+
* @param closure User-defined data passed to the `palette_func` callback.
139+
* @return Pointer to the rendered `plutovg_surface_t` object, or `NULL` if rendering fails.
140140
*/
141141
PLUTOSVG_API plutovg_surface_t* plutosvg_document_render_to_surface(const plutosvg_document_t* document, const char* id, int width, int height,
142142
const plutovg_color_t* current_color, plutosvg_palette_func_t palette_func, void* closure);
@@ -160,27 +160,27 @@ PLUTOSVG_API float plutosvg_document_get_height(const plutosvg_document_t* docum
160160
/**
161161
* @brief Retrieves the bounding box of a specific element or the entire SVG document.
162162
*
163-
* Calculates and retrieves the extents of an element identified by `id` or the whole document if `id` is `NULL`.
163+
* Calculates and retrieves the extents of an element identified by `id`, or the whole document if `id` is `NULL`.
164164
*
165165
* @param document Pointer to the SVG document.
166166
* @param id ID of the element whose extents to retrieve, or `NULL` to retrieve the extents of the entire document.
167-
* @param extents Pointer to a `plutovg_rect_t` structure where the extents will be stored.
168-
* @return `true` if extents were successfully retrieved; `false` otherwise.
167+
* @param extents Pointer to a `plutovg_rect_t` object where the extents will be stored.
168+
* @return `true` if the extents were successfully retrieved; `false` otherwise.
169169
*/
170170
PLUTOSVG_API bool plutosvg_document_extents(const plutosvg_document_t* document, const char* id, plutovg_rect_t* extents);
171171

172172
/**
173173
* @brief Destroys an SVG document and frees its resources.
174174
*
175-
* @param document Pointer to a `plutosvg_document_t` structure to be destroyed. If `NULL`, the function does nothing.
175+
* @param document Pointer to a `plutosvg_document_t` object to be destroyed. If `NULL`, the function does nothing.
176176
*/
177177
PLUTOSVG_API void plutosvg_document_destroy(plutosvg_document_t* document);
178178

179179
/**
180-
* @deprecated Use `plutosvg_ft_hooks` in "plutosvg-ft.h" instead.
181-
*
182180
* @brief Retrieves PlutoSVG hooks for integrating with FreeType's SVG module.
183181
*
182+
* @note Use `plutosvg_ft_hooks` in "plutosvg-ft.h" instead.
183+
*
184184
* Provides hooks that allow FreeType to use PlutoSVG for rendering SVG graphics in fonts.
185185
*
186186
* @return Pointer to the structure containing PlutoSVG hooks for FreeType's SVG module, or `NULL` if FreeType integration is not enabled.

0 commit comments

Comments
 (0)