Skip to content

Commit 9532bc2

Browse files
committed
renderTTF fix
1 parent 65c5d17 commit 9532bc2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

LuaSTG/Core/Graphics/Font_OpenGL.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,7 @@ namespace Core::Graphics
773773
{
774774
start_pos.x = start.x;
775775
start_pos.y -= line_height; // 向下换行
776+
spdlog::debug("[core] linebreak");
776777
continue;
777778
}
778779

LuaSTG/LuaSTG/AppFrameFontRenderer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "AppFrame.h"
22
// #include "utf8.hpp"
3+
#include "spdlog/spdlog.h"
34
#include "utility/utf.hpp"
45
#include "uni_algo/ranges_grapheme.h"
56
#include <iterator>
@@ -273,7 +274,8 @@ namespace LuaSTGPlus
273274
{
274275

275276
char32_t code_ = 0;
276-
utf::utf8reader reader_(u8_str.data() + iCurrChar, u8_str.size() - iCurrChar);
277+
int currCharActual = std::next(view.begin(), iCurrChar).begin() - u8_str.begin();
278+
utf::utf8reader reader_(u8_str.data() + currCharActual, u8_str.size() - currCharActual);
277279
while (reader_(code_))
278280
{
279281
if (code_ == U'\n' || code_ == U'\0')

0 commit comments

Comments
 (0)