Special characters shown with system font (1 Viewer)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #11
    I'll try and look into it one of these days. Unfortunately XBMC uses C++ and a totally re-writte font-system, so it won't be easy.
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    This sux for StreamedMP facades where we use CAPS for fonts...it really stands out. Also an issue with fadelabel scrolling and recently I suspect this is the reason why I see textbox scrolling go beyond the boundaries defined.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    I'll try and look into it one of these days. Unfortunately XBMC uses C++ and a totally re-writte font-system, so it won't be easy.

    C++ is not a problem. Real problem is that fixing the issue properly would require a complete re-write of the font handling in MediaPortal. If you can read C# you can read the C++ as well. Writing might C++ be different :p In any case if someone starts to re-write the font handling it should be designed well before jumping into the action.

    One good area to be studied is DirectWrite (http://msdn.microsoft.com/en-us/library/windows/desktop/dd368038(v=vs.85).aspx). Of course this would mean dropping support for Windows XP (== it could use the old existing engine).
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #14
    Could the problem be in FontEngine.dll? I don't see any of the important code in either GUIFont og GUIFontManager.

    Anyways, in GUIFont there is an out of bound check, how can I get this to log the char which is too high?

    If I do this, the log just writes out the character, not it's char number:

    Code:
        public bool containsOutOfBoundsChar(string text)
        {
          for (int i = 0; i < text.Length; ++i)
          {
            char c = text[i];
            if ((c < _StartCharacter || c >= _EndCharacter) && c != '\n')
            {
            Log.Info("containsOutOfBoundsChar:" + c);
              return true;
            }
          }
          return false;
        }
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #15
    XBMC font-code has this interesting part;

    Code:
     219 // remaps unsupported font glpyhs to other suitable ones
     220 wchar_t CGUIFont::RemapGlyph(wchar_t letter)
     221 {
     222   if (letter == 0x2019 || letter == 0x2018) return 0x0027;  // single quotes
     223   else if (letter == 0x201c || letter == 0x201d) return 0x0022;
     224   return 0; // no decent character map
     225 }

    Seems like they have had problems with single quotes as well (both left and right).

    I'll test a fix...
     

    ltfearme

    Community Plugin Dev
  • Premium Supporter
  • June 10, 2007
    6,751
    7,196
    Sydney
    Home Country
    Australia Australia
    XBMC font-code has this interesting part;

    Code:
     219 // remaps unsupported font glpyhs to other suitable ones
     220 wchar_t CGUIFont::RemapGlyph(wchar_t letter)
     221 {
     222   if (letter == 0x2019 || letter == 0x2018) return 0x0027;  // single quotes
     223   else if (letter == 0x201c || letter == 0x201d) return 0x0022;
     224   return 0; // no decent character map
     225 }

    Seems like they have had problems with single quotes as well (both left and right).

    I'll test a fix...
    Cool, would be nice to do for all the problematic characters:
    C# How to replace Microsoft's Smart Quotes with straight quotation marks? - Stack Overflow

    Obviously need to get the hex code of the normal char.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #17
    I don't know how to get the HEX values, from all the testing I did, I only found that the strings are handled as...strings.

    Putting this in a few places in GUIFont.cs, fixes the problem for me (fixes as in replaces single left/right quotation mark with apostrophe):

    Code:
          text = text.Replace("‘", "'");
          text = text.Replace("’", "'");

    Obviously that's not very clean, but it works. I would rather have normal looking apostrophe than weird looking right single quotation mark ;)
     

    Attachments

    • adele_ok.jpg
      adele_ok.jpg
      138.2 KB

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    I don't know how to get the HEX values, from all the testing I did, I only found that the strings are handled as...strings.

    Putting this in a few places in GUIFont.cs, fixes the problem for me (fixes as in replaces single left/right quotation mark with apostrophe):

    Code:
          text = text.Replace("‘", "'");
          text = text.Replace("’", "'");

    Obviously that's not very clean, but it works. I would rather have normal looking apostrophe than weird looking right single quotation mark ;)

    Also it is highly inefficient to run that replace on rendering pass. At least I would assume it gets done there. Much better way (still a hack) would be to replace the content that is passed to the GUI controls.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #19
    I don't know how to get the HEX values, from all the testing I did, I only found that the strings are handled as...strings.

    Putting this in a few places in GUIFont.cs, fixes the problem for me (fixes as in replaces single left/right quotation mark with apostrophe):

    Code:
          text = text.Replace("‘", "'");
          text = text.Replace("’", "'");

    Obviously that's not very clean, but it works. I would rather have normal looking apostrophe than weird looking right single quotation mark ;)

    Also it is highly inefficient to run that replace on rendering pass. At least I would assume it gets done there. Much better way (still a hack) would be to replace the content that is passed to the GUI controls.

    I have no idea where to put the replacement to make it least inefficient, but I'm sure others have ;)

    Your answer sounds reasonable enough, for me it was just a matter of testing whether it would fix the issue.
     

    Users who are viewing this thread

    Top Bottom