@@ -194,6 +194,18 @@ py::class_<BFont>(m, "BFont")
194
194
.def (" GetTunedInfo" , &BFont::GetTunedInfo, " " , py::arg (" index" ), py::arg (" info" ))
195
195
.def (" TruncateString" , &BFont::TruncateString, " " , py::arg (" inOut" ), py::arg (" mode" ), py::arg (" width" ))
196
196
// .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, BString>(&BFont::GetTruncatedStrings, py::const_), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
197
+ .def (" GetTruncatedStrings" , [](BFont& self, std::vector<const char *> stringArray, uint32 mode,float width)->std ::vector<BString>{
198
+ // BString resArray[stringArray.size()];
199
+ std::vector<BString> resArray (stringArray.size ());
200
+ self.GetTruncatedStrings (stringArray.data (),stringArray.size (),mode,width,resArray.data ());
201
+ return resArray;
202
+ }," " , py::arg (" stringArray" ),py::arg (" mode" ), py::arg (" width" ))
203
+ /* This below works but don't returns values we should return as function return value like "return resultArray;"
204
+ .def("GetTruncatedStrings", [](BFont& self, std::vector<const char *> stringArray, uint32 mode, float width, std::vector<BString>& resultArray) {
205
+ // Chiamata alla funzione GetTruncatedStrings senza creare un array locale
206
+ resultArray.resize(stringArray.size()); // Assicurati che resultArray abbia la dimensione corretta
207
+ self.GetTruncatedStrings(stringArray.data(), stringArray.size(), mode, width, resultArray.data());
208
+ }, "", py::arg("stringArray"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))*/
197
209
// .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, char *>(&BFont::GetTruncatedStrings, py::const_), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
198
210
.def (" StringWidth" , py::overload_cast<const char *>(&BFont::StringWidth, py::const_), " " , py::arg (" string" ))
199
211
.def (" StringWidth" , py::overload_cast<const char *, int32>(&BFont::StringWidth, py::const_), " " , py::arg (" string" ), py::arg (" length" ))
0 commit comments