Skip to content

[Win32] Emojis not displayed in text string when GC.setAdvanced(true) #3581

Description

@Phillipus

Describe the bug
On Windows when GC.setAdvanced(true) an emoji is displayed as a square box.

To Reproduce
Run the Snippet below. Set e.gc.setAdvanced(false); to see the emoji.

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class EmojiTest {
    
    public static void main(String[] args) {
        final Display display = new Display();

        final Shell shell = new Shell(display);
        shell.setText("SWT Test");
        shell.setLayout(new FillLayout());
        shell.setSize(300, 250);
        shell.setBackground(new Color(255, 255, 255));
        
        String emoji = Character.toString(0x1F600);
        
        shell.addPaintListener(e -> {
            e.gc.setAdvanced(true);
            e.gc.drawText("Hello World " + emoji, 20, 50);
        });
        
        shell.open();

        while(!shell.isDisposed()) {
            if(!display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();
    }
}

Expected behavior
Should see the emoji when advanced mode is true

Screenshots

With advanced mode false:

Image

With advanced mode true:

Image

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)
    Windows 11
    Java 21

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions