From 15b4331fb18e37294e48330c54fe732f836db145 Mon Sep 17 00:00:00 2001 From: AThousandShips <96648715+AThousandShips@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:31:06 -0500 Subject: [PATCH] [TextServer] Fix use of `find_char` in text servers The `find_char` method is not (currently) available to extensions and can't be used in the text servers which can be built as extensions, so now controlled by compile option --- modules/text_server_adv/thorvg_svg_in_ot.cpp | 4 ++++ modules/text_server_fb/thorvg_svg_in_ot.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/modules/text_server_adv/thorvg_svg_in_ot.cpp b/modules/text_server_adv/thorvg_svg_in_ot.cpp index a64ae043a8c..62aadf1b0bb 100644 --- a/modules/text_server_adv/thorvg_svg_in_ot.cpp +++ b/modules/text_server_adv/thorvg_svg_in_ot.cpp @@ -175,7 +175,11 @@ FT_Error tvg_svg_in_ot_preset_slot(FT_GlyphSlot p_slot, FT_Bool p_cache, FT_Poin if (parser->has_attribute("id")) { const String &gl_name = parser->get_named_attribute_value("id"); if (gl_name.begins_with("glyph")) { +#ifdef GDEXTENSION + int dot_pos = gl_name.find("."); +#else int dot_pos = gl_name.find_char('.'); +#endif // GDEXTENSION int64_t gl_idx = gl_name.substr(5, (dot_pos > 0) ? dot_pos - 5 : -1).to_int(); TVG_NodeCache node_cache = TVG_NodeCache(); diff --git a/modules/text_server_fb/thorvg_svg_in_ot.cpp b/modules/text_server_fb/thorvg_svg_in_ot.cpp index a64ae043a8c..62aadf1b0bb 100644 --- a/modules/text_server_fb/thorvg_svg_in_ot.cpp +++ b/modules/text_server_fb/thorvg_svg_in_ot.cpp @@ -175,7 +175,11 @@ FT_Error tvg_svg_in_ot_preset_slot(FT_GlyphSlot p_slot, FT_Bool p_cache, FT_Poin if (parser->has_attribute("id")) { const String &gl_name = parser->get_named_attribute_value("id"); if (gl_name.begins_with("glyph")) { +#ifdef GDEXTENSION + int dot_pos = gl_name.find("."); +#else int dot_pos = gl_name.find_char('.'); +#endif // GDEXTENSION int64_t gl_idx = gl_name.substr(5, (dot_pos > 0) ? dot_pos - 5 : -1).to_int(); TVG_NodeCache node_cache = TVG_NodeCache();