Pivot
  1. Pivot
  2. PIVOT-315

Terra's default font cannot display all UTF-8 characters

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1, 1.2, 1.3
    • Fix Version/s: 1.4
    • Component/s: wtk
    • Labels:
      None

      Description

      Verdana cannot display all characters in the UTF-8 character set, meaning that if you try to render a string containing extended UTF-8 characters (such as Chinese characters), you will get "non-renderable-character" boxes instead.

        Issue Links

          Activity

          Hide
          Todd Volkert added a comment -

          Theme.setFont() was added, allowing the application developer to override the default theme font.

          The localization tutorial has been updated to use this API to use a font that supports the necessary characters if they're not supported by the default font – see http://svn.apache.org/repos/asf/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java for an example of how an application might use this technique.

          Show
          Todd Volkert added a comment - Theme.setFont() was added, allowing the application developer to override the default theme font. The localization tutorial has been updated to use this API to use a font that supports the necessary characters if they're not supported by the default font – see http://svn.apache.org/repos/asf/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java for an example of how an application might use this technique.
          Hide
          liang xiao added a comment - - edited

          I'm not able to click into the linked provided above. Is there another url or something for it?

          I found the sample at least. but I follow the example, the the extended characters are still no-showed. the box character was showed instead.

          Show
          liang xiao added a comment - - edited I'm not able to click into the linked provided above. Is there another url or something for it? I found the sample at least. but I follow the example, the the extended characters are still no-showed. the box character was showed instead.
          Hide
          Greg Brown added a comment -

          Here's the new location:

          http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java

          What do you see when you run this test:

          http://svn.apache.org/repos/asf/pivot/trunk/tests/src/org/apache/pivot/tests/chinese_characters_test.bxml

          You can launch it using org.apache.pivot.wtk.ScriptApplication and passing the following argument:

          --src=org/apache/pivot/tests/chinese_characters_test.bxml

          Show
          Greg Brown added a comment - Here's the new location: http://svn.apache.org/repos/asf/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/localization/Localization.java What do you see when you run this test: http://svn.apache.org/repos/asf/pivot/trunk/tests/src/org/apache/pivot/tests/chinese_characters_test.bxml You can launch it using org.apache.pivot.wtk.ScriptApplication and passing the following argument: --src=org/apache/pivot/tests/chinese_characters_test.bxml
          Hide
          liang xiao added a comment -

          Thanks,

          It works on another computer. Seems there is something wrong on this one.

          Show
          liang xiao added a comment - Thanks, It works on another computer. Seems there is something wrong on this one.
          Hide
          liang xiao added a comment -

          I captrue the screenshot about extend utf8 characters won't show. for you convienience to take a look. I put them in same piture. Hope it's help.
          I also try to use org.apache.pivot.wtk.ScriptApplication to run simple_hello.xml script. but it's same result.

          Show
          liang xiao added a comment - I captrue the screenshot about extend utf8 characters won't show. for you convienience to take a look. I put them in same piture. Hope it's help. I also try to use org.apache.pivot.wtk.ScriptApplication to run simple_hello.xml script. but it's same result.
          Hide
          Greg Brown added a comment -

          Not all fonts support the Chinese character set. For example, the default Pivot font, Verdana, does not. Your application may need to override the default font in order to display these characters.

          The Localization tutorial includes code that shows how to do this. What happens when you run that app? If your default locale is not cn, you can specify the Chinese locale using the following command-line argument:

          --language=cn

          Show
          Greg Brown added a comment - Not all fonts support the Chinese character set. For example, the default Pivot font, Verdana, does not. Your application may need to override the default font in order to display these characters. The Localization tutorial includes code that shows how to do this. What happens when you run that app? If your default locale is not cn, you can specify the Chinese locale using the following command-line argument: --language=cn
          Hide
          liang xiao added a comment -

          I finally know why the code setting font to support chinese characters did not work. look into the code. it set font before method "readObject()". so font setting did not really effect pivot. I changed order as bellow. it work fine.

          theme.setFont(font.deriveFont(Font.PLAIN,12));
          serializer.readObject(this,"hello.xml");

          Show
          liang xiao added a comment - I finally know why the code setting font to support chinese characters did not work. look into the code. it set font before method "readObject()". so font setting did not really effect pivot. I changed order as bellow. it work fine. theme.setFont(font.deriveFont(Font.PLAIN,12)); serializer.readObject(this,"hello.xml");
          Hide
          liang xiao added a comment -

          I'm sorry, Previous post is incorrected. I want to say "it did not work AFTER method 'theme.setFont()'"

          Show
          liang xiao added a comment - I'm sorry, Previous post is incorrected. I want to say "it did not work AFTER method 'theme.setFont()'"
          Hide
          Greg Brown added a comment -

          Glad you got it working!

          Show
          Greg Brown added a comment - Glad you got it working!

            People

            • Assignee:
              Todd Volkert
              Reporter:
              Todd Volkert
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development