Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Here you should submit your bug reports with logcat.
  • Page:
  • 1

TOPIC:

Font substitution does not working. 1 week 3 days ago #15512

  • Hinata
  • Hinata's Avatar Topic Author
  • Visitor
  • Visitor
I am using the following Xamarin module for Android.
github.com/RadaeePDF-Jugaad/RadaeePDF-Xa...id/RadaeePDF-Xamarin
  
Garbled characters occur in Japanese PDF files.
Font substitution does not seem to be working.
 
Is this a bug?
Also, is there any problem with the following fixes?


There seems to be a problem with the following files.
  • RadaeePDF-Xamarin/Jars/ViewLib.aar

The font substitution problem was solved by using "RadaeePDF AndroidStudio 3.55.4", available from the following link, and replacing the above file.
www.radaeepdf.com/download/category/1-android

The fixes are as follows
  •  Fixed a problem that could override the default font for GB1.
  •  Changed the priority of the default font for CJK.
      Note: For Japan1, we expect that the risk of garbled characters is lower if Noto Sans CJK Regular is set rather than DroidSansFallback. (This is just a prediction.)
               GB1, CNS1, and Korea1 have also been revised to match the changes in Japna1.

After line 758 of RadaeePDF-Android\PDFSample\ViewLib\src\main\java\com\radaee\pdf\Global.java
  • Before
    // set default font for Simplified Chinese. 简体
    if (!setDefaultFont("GB1", "DroidSansFallback", true) &&
        !setDefaultFont("GB1", "Noto Sans CJK SC Regular", true) &&
        !setDefaultFont("GB1", "DroidSansChinese", true) &&
        !setDefaultFont("GB1", "Noto Sans SC Regular", true) && face_name != null)
        setDefaultFont("GB1", face_name, true);
    if (!setDefaultFont("GB1", "DroidSansFallback", false) &&
        !setDefaultFont("GB1", "Noto Sans CJK SC Regular", false) &&
        !setDefaultFont("GB1", "Noto Sans SC Regular", false) && face_name != null)
        setDefaultFont("GB1", face_name, false);

    // set default font for Traditional Chinese. 繁體
    if (!setDefaultFont("CNS1", "DroidSansFallback", true) &&
        !setDefaultFont("GB1", "Noto Sans CJK TC Regular", true) &&
        !setDefaultFont("CNS1", "Noto Sans TC Regular", true) && face_name != null)
        setDefaultFont("CNS1", face_name, true);
    if (!setDefaultFont("CNS1", "DroidSansFallback", false) &&
        !setDefaultFont("GB1", "Noto Sans CJK TC Regular", false) &&
        !setDefaultFont("CNS1", "Noto Sans TC Regular", false) && face_name != null)
        setDefaultFont("CNS1", face_name, false);

    // set default font for Japanese.
    if (!setDefaultFont("Japan1", "DroidSansFallback", true) &&
        !setDefaultFont("GB1", "Noto Sans CJK JP Regular", true) &&
        !setDefaultFont("Japan1", "Noto Sans JP Regular", true) && face_name != null)
        setDefaultFont("Japan1", face_name, true);
    if (!setDefaultFont("Japan1", "DroidSansFallback", false) &&
        !setDefaultFont("GB1", "Noto Sans CJK JP Regular", false) &&
        !setDefaultFont("Japan1", "Noto Sans JP Regular", false) && face_name != null)
        setDefaultFont("Japan1", face_name, false);

    // set default font for Korean.
    if (!setDefaultFont("Korea1", "DroidSansFallback", true) &&
        !setDefaultFont("GB1", "Noto Sans CJK KR Regular", true) &&
        !setDefaultFont("Korea1", "Noto Sans KR Regular", true) && face_name != null)
        setDefaultFont("Korea1", face_name, true);
    if (!setDefaultFont("Korea1", "DroidSansFallback", false) &&
        !setDefaultFont("GB1", "Noto Sans CJK KR Regular", false) &&
        !setDefaultFont("Korea1", "Noto Sans KR Regular", false) && face_name != null)
        setDefaultFont("Korea1", face_name, false);
  • After
    if (!setDefaultFont("GB1", "Noto Sans CJK SC Regular", true) &&
            !setDefaultFont("GB1", "DroidSansChinese", true) &&
            !setDefaultFont("GB1", "Noto Sans SC Regular", true) &&
            !setDefaultFont("GB1", "DroidSansFallback", true) && face_name != null)
        setDefaultFont("GB1", face_name, true);
    if (!setDefaultFont("GB1", "Noto Sans CJK SC Regular", false) &&
            !setDefaultFont("GB1", "Noto Sans SC Regular", false) &&
            !setDefaultFont("GB1", "DroidSansFallback", false) && face_name != null)
        setDefaultFont("GB1", face_name, false);

    // set default font for Traditional Chinese. 繁體
    if (!setDefaultFont("CNS1", "Noto Sans CJK TC Regular", true) &&
            !setDefaultFont("CNS1", "Noto Sans TC Regular", true) &&
            !setDefaultFont("CNS1", "DroidSansFallback", true) && face_name != null)
        setDefaultFont("CNS1", face_name, true);
    if (!setDefaultFont("CNS1", "Noto Sans CJK TC Regular", false) &&
            !setDefaultFont("CNS1", "Noto Sans TC Regular", false) &&
            !setDefaultFont("CNS1", "DroidSansFallback", false) && face_name != null)
        setDefaultFont("CNS1", face_name, false);

    // set default font for Japanese.
    if (!setDefaultFont("Japan1", "Noto Sans CJK JP Regular", true) &&
            !setDefaultFont("Japan1", "Noto Sans JP Regular", true) &&
            !setDefaultFont("Japan1", "DroidSansFallback", true) && face_name != null)
        setDefaultFont("Japan1", face_name, true);
    if (!setDefaultFont("Japan1", "Noto Sans CJK JP Regular", false) &&
            !setDefaultFont("Japan1", "Noto Sans JP Regular", false) &&
            !setDefaultFont("Japan1", "DroidSansFallback", false) && face_name != null)
        setDefaultFont("Japan1", face_name, false);

    // set default font for Korean.
    if (!setDefaultFont("Korea1", "Noto Sans CJK KR Regular", true) &&
            !setDefaultFont("Korea1", "Noto Sans KR Regular", true) &&
            !setDefaultFont("Korea1", "DroidSansFallback", true) && face_name != null)
        setDefaultFont("Korea1", face_name, true);
    if (!setDefaultFont("Korea1", "Noto Sans CJK KR Regular", false) &&
            !setDefaultFont("Korea1", "Noto Sans KR Regular", false) &&
            !setDefaultFont("Korea1", "DroidSansFallback", false) && face_name != null)
        setDefaultFont("Korea1", face_name, false);


Thank you in advance.
 

Please Log in or Create an account to join the conversation.

Font substitution does not working. 1 week 3 days ago #15513

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1050
  • Thank you received: 64
dear user:
thanks, we have found some problems:
    if (!setDefaultFont("Japan1", "DroidSansFallback", true) &&
        !setDefaultFont("GB1", "Noto Sans CJK JP Regular", true) &&
        !setDefaultFont("Japan1", "Noto Sans JP Regular", true) && face_name != null)
        setDefaultFont("Japan1", face_name, true);
    if (!setDefaultFont("Japan1", "DroidSansFallback", false) &&
        !setDefaultFont("GB1", "Noto Sans CJK JP Regular", false) &&
        !setDefaultFont("Japan1", "Noto Sans JP Regular", false) && face_name != null)
        setDefaultFont("Japan1", face_name, false);

shall change to:
if (!setDefaultFont("Japan1", "Noto Sans CJK JP Regular", true) &&
!setDefaultFont("Japan1", "Noto Sans JP Regular", true) &&
!setDefaultFont("Japan1", "DroidSansFallback", true) && face_name != null)
setDefaultFont("Japan1", face_name, true);
if (!setDefaultFont("Japan1", "DroidSansFallback", false) &&
!setDefaultFont("Japan1", "Noto Sans CJK JP Regular", false) &&
!setDefaultFont("Japan1", "Noto Sans JP Regular", false) && face_name != null)
setDefaultFont("Japan1", face_name, false);
the method call "setDefaultFont("GB1", "Noto Sans CJK JP Regular", true)" is wrong for Japan1.we will update this issue in next demo version.

Please Log in or Create an account to join the conversation.

Last edit: by radaee.
  • Page:
  • 1
Powered by Kunena Forum