Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8219901

Noto fonts for East Asian countries cannot belong to CompositeFont

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11, 12, 13
    • Fix Version/s: 13
    • Component/s: client-libs
    • Labels:
    • Environment:

      Ubuntu18.04

    • Subcomponent:
      2d
    • Resolved In Build:
      b24
    • CPU:
      generic
    • OS:
      linux

      Backports

        Description

        When Google Noto fonts[1] were installed and listed by fontconfig library on Linux, CompositeFont couldn't contain it.
        The entry of Noto font could be replaced by another font which depends on an environment.

        Under our Ubuntu18.04 zLinux,
        "Noto Sans CJK JP Regular" was listed at the top of Japanese, but was replaced by
        "BPG Ingiri GPL&GNU".
        Then, we cannot show Japanese in the system.

        Under another our Ubuntu18.04 x86_64,
        "Noto Sans CJK JP Regular" was replaced by
        "Noto Serif CJK KR Light".
        Then, we saw unexpected glyphs. JP(Japanese) and KR(Korean) use similar but different glyphs.

        This problem is only for CompositeFont. Specific Font by filename can show expectedly.

        Evaluation:
        src/java.desktop/share/classes/sun/font/CompositeFont.java:doDeferredInitialisation() (l. 296)
        validates the target font by comparing names.
        The current code stored FamilyName to faceNames variable, then compared it with FullName (getFontName()).
        If they were different, the target font was treated as invalid.
        So, faceNames should be created by FullName.

        Noto fonts have different values between a preferred family name and a full name. And, this is the reason the problem was found with Noto fonts.

        The cached font list is stored under ~/.java/fonts directory. We should delete it before testing.

        [1] https://www.google.com/get/noto/

        Attached screenshots and a log file:
        Noto-problem.jpg - In the case that Noto font is the only Japanese font.
        Noto-fixed.jpg - With the proposed fix.
        fc-match.log - The result of fc-match command in above environment.

          Attachments

          1. AllLocalesFontTest.tar.gz
            23 kB
          2. fc-match.log
            2 kB
          3. Noto-fixed.jpg
            Noto-fixed.jpg
            95 kB
          4. Noto-problem.jpg
            Noto-problem.jpg
            105 kB

            Issue Links

              Activity

                People

                • Assignee:
                  tnakamura Toshio Nakamura
                  Reporter:
                  tnakamura Toshio Nakamura
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: