Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - SileNTViP

#1
Engine Development / Text translation
Sat 29/12/2012 15:56:11
Please remove limit 128 chars from wfn fonts and make 256 for full ASCII support (2 languages)

acfonts.cpp
Spoiler
class WFNFontRenderer : public IAGSFontRenderer {
public:
  ...
  virtual bool SupportsExtendedCharacters(int fontNumber) { return false; } // Make TRUE
  ...
};

void WFNFontRenderer::EnsureTextValidForFont(char *text, int fontNumber)
{
    // Clear
}

int WFNFontRenderer::GetTextWidth(const char *texx, int fontNumber)
{
    ...
    if (((unsigned char)thisCharacter > 127) && (sizeof(tabaddr) <= 128)) thisCharacter = '?'; // Remove
    ...
}

int WFNFontRenderer::GetTextHeight(const char *texx, int fontNumber)
{
    ...
    if (((unsigned char)thisCharacter > 127) && (sizeof(tabaddr) <= 128)) thisCharacter = '?'; // Remove
    ...
}

int WFNFontRenderer::printchar(int xxx, int yyy, wgtfont foo, int charr)
{
  ...
  if (((unsigned char)charr > 127) && (sizeof(tabaddr) <= 128)) // Remove this strings
    charr = '?';
  ...
}

[close]

and add translation GUI::ListBox in acgui.c
Spoiler

void GUIListBox::Draw()
{
   ...
#ifdef THIS_IS_THE_ENGINE
    // Allow it to change the string to unicode if it's TTF
    char oritext[200];
    strcpy(oritext, get_translation(items[a + topItem]));
    ensure_text_valid_for_font(oritext, font);
#else
    char *oritext = items[a + topItem];
#endif

    if (alignment == GALIGN_LEFT)
      wouttext_outline(x + 1 + pixel_size, thisyp + 1, font, oritext);
    else {
      int textWidth = wgettextwidth(oritext, font);

      if (alignment == GALIGN_RIGHT)
        wouttext_outline(rightHandEdge - textWidth, thisyp + 1, font, oritext);
      else
        wouttext_outline(((rightHandEdge - x) / 2) + x - (textWidth / 2), thisyp + 1, font, oritext);
    }
  ...
[close]
SMF spam blocked by CleanTalk