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

Noto fonts for East Asian countries cannot belong to CompositeFont

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 13
    • 11, 12, 13
    • client-libs
    • Ubuntu18.04

    • 2d
    • b24
    • generic
    • linux

        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.

          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

              tnakamura Toshio Nakamura
              tnakamura Toshio Nakamura
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: