Special characters shown with system font | Page 2

Discussion in '1.2.x' started by pilehave, November 27, 2011.

  1. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    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.


     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. ltfearme
    • Premium Supporter

    ltfearme Community Plugin Dev

    Joined:
    June 10, 2007
    Messages:
    6,447
    Likes Received:
    4,227
    Gender:
    Male
    Occupation:
    Software Test Engineer
    Location:
    Sydney
    Ratings:
    +5,365 / 0
    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.
     
    • Like Like x 1
  4. tourettes
    • Team MediaPortal

    tourettes Retired Team Member

    Joined:
    January 7, 2005
    Messages:
    17,301
    Likes Received:
    4,595
    Ratings:
    +4,810 / 3
    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).
     
  5. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    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 (Text):
    1.  
    2.     public bool containsOutOfBoundsChar(string text)
    3.     {
    4.       for (int i = 0; i < text.Length; ++i)
    5.       {
    6.         char c = text[i];
    7.         if ((c < _StartCharacter || c >= _EndCharacter) && c != '\n')
    8.         {
    9.         Log.Info("containsOutOfBoundsChar:" + c);
    10.           return true;
    11.         }
    12.       }
    13.       return false;
    14.     }
    15.  
     
  6. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    XBMC font-code has this interesting part;

    Code (Text):
    1.  
    2.  219 // remaps unsupported font glpyhs to other suitable ones
    3.  220 wchar_t CGUIFont::RemapGlyph(wchar_t letter)
    4.  221 {
    5.  222   if (letter == 0x2019 || letter == 0x2018) return 0x0027;  // single quotes
    6.  223   else if (letter == 0x201c || letter == 0x201d) return 0x0022;
    7.  224   return 0; // no decent character map
    8.  225 }
    9.  
    Seems like they have had problems with single quotes as well (both left and right).

    I'll test a fix...
     
  7. ltfearme
    • Premium Supporter

    ltfearme Community Plugin Dev

    Joined:
    June 10, 2007
    Messages:
    6,447
    Likes Received:
    4,227
    Gender:
    Male
    Occupation:
    Software Test Engineer
    Location:
    Sydney
    Ratings:
    +5,365 / 0
    Home Country:
    Australia Australia
    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.
     
  8. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    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):
    1.  
    2.       text = text.Replace("‘", "'");
    3.       text = text.Replace("’", "'");
    4.  
    Obviously that's not very clean, but it works. I would rather have normal looking apostrophe than weird looking right single quotation mark ;)
     

    Attached Files:

    • adele_ok.jpg
      adele_ok.jpg
      File size:
      138.2 KB
      Uploaded:
      November 28, 2011
      Views:
      148
  9. tourettes
    • Team MediaPortal

    tourettes Retired Team Member

    Joined:
    January 7, 2005
    Messages:
    17,301
    Likes Received:
    4,595
    Ratings:
    +4,810 / 3
    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.
     
  10. pilehave
    • Premium Supporter

    pilehave Community Skin Designer

    Joined:
    April 2, 2008
    Messages:
    2,566
    Likes Received:
    500
    Gender:
    Male
    Occupation:
    Technical consultant, marketing
    Location:
    Hornslet
    Ratings:
    +517 / 0
    Home Country:
    Denmark Denmark
    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.
     
  11. SilentException
    • Team MediaPortal

    SilentException Retired Team Member

    Joined:
    October 27, 2008
    Messages:
    2,617
    Likes Received:
    1,125
    Gender:
    Male
    Location:
    Rijeka, Croatia
    Ratings:
    +1,129 / 0
    Home Country:
    Croatia Croatia
    • Thank You! Thank You! x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!