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

[macos] Emoji only render half size on retina display

XMLWordPrintable

    • generic
    • os_x

      A DESCRIPTION OF THE PROBLEM :
      When using a retina display, AppleColorEmoji font render too small, the emojis only have half of the height and width as it should be.

      CTFontStrike get font ref with a CGAffineTransform, the arg matrix has field a and d value 2.0:
      fontRef = OS.CTFontCreateWithName(psNameRef, size, matrix);
      This works for ordinary font, but not for AppleColorEmoji font. It may be a bug for feature of Core Text.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the source code and run, a window showing emoji and plain text will show.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Emoji has same height as plain text, and take full width of it's frame.
      ACTUAL -
      Emoji only occupies 1/4 of its frame, leaving other region as blank space.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.text.Font;
      import javafx.stage.Stage;

      public class Test extends Application {

          @Override
          public void start(Stage stage) {
              var label = new Label("Text🐶Text");
              label.setFont(new Font(40));

              Scene scene = new Scene(label);
              stage.setWidth(400);
              stage.setHeight(100);
              stage.setScene(scene);

              stage.show();
          }

          public static void main(String[] args) {
              launch(args);
          }

      }

      ---------- END SOURCE ----------

        1. Windows10_Capture.PNG
          Windows10_Capture.PNG
          6 kB
        2. Test.java
          0.6 kB
        3. Screenshot 2023-01-02 at 7.51.10 PM.png
          Screenshot 2023-01-02 at 7.51.10 PM.png
          207 kB
        4. MacOSopenjfx18Output.png
          MacOSopenjfx18Output.png
          41 kB
        5. MacOSopenjfx17Output.png
          MacOSopenjfx17Output.png
          36 kB
        6. MacOSopenjfx16Output.png
          MacOSopenjfx16Output.png
          41 kB

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: