Skip to content

Commit ee46b09

Browse files
committed
ft2font: Ensure enums are documented
And also document the version changes.
1 parent 6a3b9fe commit ee46b09

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/ft2font_wrapper.cpp

+28-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const char *Kerning__doc__ = R"""(
2323
2424
For more information, see `the FreeType documentation
2525
<https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_kerning_mode>`_.
26+
27+
.. versionadded: 3.10
2628
)""";
2729

2830
P11X_DECLARE_ENUM(
@@ -37,6 +39,8 @@ const char *FaceFlags__doc__ = R"""(
3739
3840
For more information, see `the FreeType documentation
3941
<https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_face_flag_xxx>`_.
42+
43+
.. versionadded: 3.10
4044
)""";
4145

4246
enum class FaceFlags : FT_Long {
@@ -102,10 +106,12 @@ P11X_DECLARE_ENUM("FaceFlags", "enum.Flag",
102106
);
103107

104108
const char *LoadFlags__doc__ = R"""(
105-
Flags for `FT2Font.load_char`, `FT2font.load_glyph`, and `FT2Font.set_text`.
109+
Flags for `FT2Font.load_char`, `FT2Font.load_glyph`, and `FT2Font.set_text`.
106110
107111
For more information, see `the FreeType documentation
108112
<https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx>`_.
113+
114+
.. versionadded: 3.10
109115
)""";
110116

111117
enum class LoadFlags : FT_Int32 {
@@ -184,6 +190,8 @@ const char *StyleFlags__doc__ = R"""(
184190
185191
For more information, see `the FreeType documentation
186192
<https://freetype.org/freetype2/docs/reference/ft2-face_creation.html#ft_style_flag_xxx>`_.
193+
194+
.. versionadded: 3.10
187195
)""";
188196

189197
enum class StyleFlags : FT_Long {
@@ -551,6 +559,9 @@ const char *PyFT2Font_get_kerning__doc__ = R"""(
551559
- ``UNFITTED`` - Return scaled but un-grid-fitted kerning distances.
552560
- ``UNSCALED`` - Return the kerning vector in original font units.
553561
562+
.. versionchanged:: 3.10
563+
This now takes a `.ft2font.Kerning` value instead of an `int`.
564+
554565
Returns
555566
-------
556567
int
@@ -637,7 +648,10 @@ const char *PyFT2Font_set_text__doc__ = R"""(
637648
angle : float
638649
The angle at which to render the supplied text.
639650
flags : LoadFlags, default: `.LoadFlags.FORCE_AUTOHINT`
640-
Any bitwise-OR combination of the `.LoadFlags` enum.
651+
Any bitwise-OR combination of the `.LoadFlags` flags.
652+
653+
.. versionchanged:: 3.10
654+
This now takes an `.ft2font.LoadFlags` instead of an int.
641655
642656
Returns
643657
-------
@@ -689,7 +703,10 @@ const char *PyFT2Font_load_char__doc__ = R"""(
689703
The character code to prepare rendering information for. This code must be in
690704
the charmap, or else a ``.notdef`` glyph may be returned instead.
691705
flags : LoadFlags, default: `.LoadFlags.FORCE_AUTOHINT`
692-
Any bitwise-OR combination of the `.LoadFlags` enum.
706+
Any bitwise-OR combination of the `.LoadFlags` flags.
707+
708+
.. versionchanged:: 3.10
709+
This now takes an `.ft2font.LoadFlags` instead of an int.
693710
694711
Returns
695712
-------
@@ -737,7 +754,10 @@ const char *PyFT2Font_load_glyph__doc__ = R"""(
737754
glyph_index : int
738755
The glyph index to prepare rendering information for.
739756
flags : LoadFlags, default: `.LoadFlags.FORCE_AUTOHINT`
740-
Any bitwise-OR combination of the `.LoadFlags` enum.
757+
Any bitwise-OR combination of the `.LoadFlags` flags.
758+
759+
.. versionchanged:: 3.10
760+
This now takes an `.ft2font.LoadFlags` instead of an int.
741761
742762
Returns
743763
-------
@@ -1590,6 +1610,10 @@ PYBIND11_MODULE(ft2font, m)
15901610
snprintf(version_string, sizeof(version_string), "%d.%d.%d", major, minor, patch);
15911611

15921612
p11x::bind_enums(m);
1613+
p11x::enums["Kerning"].attr("__doc__") = Kerning__doc__;
1614+
p11x::enums["LoadFlags"].attr("__doc__") = LoadFlags__doc__;
1615+
p11x::enums["FaceFlags"].attr("__doc__") = FaceFlags__doc__;
1616+
p11x::enums["StyleFlags"].attr("__doc__") = StyleFlags__doc__;
15931617

15941618
py::class_<FT2Image>(m, "FT2Image", py::is_final(), py::buffer_protocol(),
15951619
PyFT2Image__doc__)

0 commit comments

Comments
 (0)