• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient bug letters or pappers? how fix?

Yes, someone did the job for me

Rules for the Support board

[...]

  • If you solved your problem, post the solution, do not remove the content in your posts. Instead write the solution you found. This can help other users with the same problem.
  • Threads with removed content are useless and are seen as spam.
  • If you were able to solve the issue yourself, post the solution and report your own post so a moderator can tag it as the "Best Answer".
 
Rules for the Support board

[...]

  • If you solved your problem, post the solution, do not remove the content in your posts. Instead write the solution you found. This can help other users with the same problem.
  • Threads with removed content are useless and are seen as spam.
  • If you were able to solve the issue yourself, post the solution and report your own post so a moderator can tag it as the "Best Answer".
he is talking about another problem, the problem of letters has not been solved here.
 
the problem maybe is here?

uiwidgettext.cpp
Lua:
void UIWidget::drawText(const Rect& screenCoords)
{
    if(m_drawText.length() == 0 || m_color.aF() == 0.0f)
        return;

    if(screenCoords != m_textCachedScreenCoords || m_textMustRecache) {
        Rect coords = Rect(screenCoords.topLeft() + m_textOffset, screenCoords.bottomRight());
        m_textMustRecache = false;
        m_textCachedScreenCoords = coords;
    }

    if (!m_drawTextColors.empty()) {
        m_font->drawColoredText(m_drawText, m_textCachedScreenCoords, m_textAlign, m_drawTextColors, m_shadow);
    } else {
        m_font->drawText(m_drawText, m_textCachedScreenCoords, m_textAlign, m_color, m_shadow);
    }
}


in modules corelib uiwindget

Lua:
function UIWidget:setMargin(...)
  local params = {...}
  if #params == 1 then
    self:setMarginTop(params[1])
    self:setMarginRight(params[1])
    self:setMarginBottom(params[1])
    self:setMarginLeft(params[1])
  elseif #params == 2 then
    self:setMarginTop(params[1])
    self:setMarginRight(params[2])
    self:setMarginBottom(params[1])
    self:setMarginLeft(params[2])
  elseif #params == 4 then
    self:setMarginTop(params[1])
    self:setMarginRight(params[2])
    self:setMarginBottom(params[3])
    self:setMarginLeft(params[4])
  end
end
Post automatically merged:

From what I understand, the bug happens when the paragraph is broken, after reaching the end of the textedit it adds the last letters to the front and the cursor stays behind, but as you continue typing it corrects it, however it is a bug that needs to be fixed.
Post automatically merged:

I found this, it helps, but still no results, it has to do with paragraph skipping. This affects the letter box directly, for example. The problem is the letter that comes right after, it only goes back if you press space for example, but if you continue writing without space the letters repeat themselves.

Lua:
std::string BitmapFont::wrapText(const std::string& text, int maxWidth, std::vector<std::pair<int, Color>>* colors)
{
    std::string outText;
    outText.reserve(text.size() * 2); // string append optimization

    int lastSeparator = 0, lastColorSeparator = 0, lineLength = 0, wordLength = 0;
    for (size_t i = 0, c = 0; i < text.size(); ++i) {
        uchar glyph = (uchar)text[i];
        if (text[i] == '\n' || text[i] == ' ') {
            lineLength += wordLength;
            if (lineLength > maxWidth) { // too long line with this word
                if (text[lastSeparator] == ' ') {
                    c -= 1;
                    updateColors(colors, lastColorSeparator, -1);
                    lastSeparator += 1;
                    lastColorSeparator += 1;
                }
                outText += '\n';
                lineLength = wordLength;
            }
            for (size_t j = lastSeparator; j < i; ++j) { // copy word
                outText += text[j];
            }
            if (text[i] == '\n') { // if new line was added reset line length
                outText += '\n';
                wordLength = 0;
                lineLength = 0;
                lastSeparator = i + 1;
                lastColorSeparator = c;
            } else { // space
                wordLength = m_glyphsSize[glyph].width() + m_glyphSpacing.width(); // space
                lastSeparator = i;
                lastColorSeparator = c;
                c += 1;
            }
            continue;
        }

        if (glyph < 32) // invalid character
            continue;

        wordLength += m_glyphsSize[glyph].width() + m_glyphSpacing.width();
        if (wordLength > maxWidth) { // too long word, split it
            if (lineLength != 0) { // add new line if current one is not empty
                outText += '\n';
            }
            if (text[lastSeparator] == ' ') { // ignore space if it's first character in new line
                c -= 1;
                lastSeparator += 1;
                lastColorSeparator += 1;
            }
            for (size_t j = lastSeparator; j < i; ++j) { // copy word
                outText += text[j];
            }
            updateColors(colors, lastColorSeparator, 1);
            outText += '-'; // word continuation
            outText += '\n'; // new line

            wordLength = m_glyphsSize[glyph].width() + m_glyphSpacing.width();
            lineLength = 0;
            lastSeparator = i;
            lastColorSeparator = c;
        }
        c += 1;
    }

    lineLength += wordLength;
    if (lineLength > maxWidth) { // too long line with this word
        updateColors(colors, lastColorSeparator, 1);
        outText += '\n';
        lineLength = wordLength;
    }
    for (size_t j = lastSeparator; j < text.size(); ++j) { // copy word
        outText += text[j];
    }
    return outText;
}
Post automatically merged:

the problem are bitmapfont. but idk how fix.

the bug starts when a whole word breaks the 32 characters of the paragraph, so the system creates 2 letters in front, because after reaching the end it does not calculate the end correctly, so it creates one in the next paragraph. Something related to this needs to be fixed.
 
Last edited:
I tried everything, something like cpp. ui, otui, but I was unsuccessful
I also tried to find the cursor configuration, when pressing Enter the cursor is hidden and does not appear.

1711028066915.png

i use enter here
and no appear cursor.

after space show cursor
1711028100155.png
 
Back
Top