Skip to content

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

Open

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

  1. HeikoKlare commented on Sep 10, 2026

    @HeikoKlare
    Contributor

    We see more and more flaws with GDI+. We also have to roll back the text layouting with GDI+ because of limitations with respect to text kerning:

    And there is no chance that anything improves, as Microsoft considers GDI and GDI+ as legacy with Direct2D being a more modern successor: https://learn.microsoft.com/en-us/windows/win32/learnwin32/overview-of-the-windows-graphics-architecture
    I have no idea how much effort adopting Direct2D for SWT advanced mode may be, but it could be worth giving a try (with the help of an AI agent).

    So I am not sure if there a solution for the reported issue. A quick search just revealed that "Segoe UI Emoji" seems to be the only font for emojis with GDI+.

  2. Phillipus commented on Sep 10, 2026

    @Phillipus
    ContributorAuthor

    @HeikoKlare Understood. Thanks for the feedback.

  3. laeubi commented on Sep 10, 2026

    @laeubi
    Contributor

    I once made a little experiment moving to direct2d/directx and it seems doable but nothing for one weekend :-)

  4. laeubi commented on Sep 10, 2026

    @laeubi
    Contributor

    I've proposed this work item to the IDE-WG Development Funding Initiative for potential funding:

    Please keep expectations in check — funding decisions and subsequent work will likely take some time. That said, anyone interested in helping move this forward is of course welcome, and funding from outside the IDE-WG program is always appreciated too. And if you'd like to have a direct say in prioritizing efforts like this one, consider joining the IDE-WG!

  5. Phillipus commented on Sep 11, 2026

    @Phillipus
    ContributorAuthor

    Would the Skia Initiative 31 solve the problem of GDI?

  6. HeikoKlare commented on Sep 11, 2026

    @HeikoKlare
    Contributor

    I have not tried but I am confident that Skia is able to render emojis.

  7. Phillipus commented on Sep 11, 2026

    @Phillipus
    ContributorAuthor

    I have not tried but I am confident that Skia is able to render emojis.

    Sorry, I meant would Skia Initiative 31 solve all the problems of GDI and GDi+ rather than porting to Direct2D?

  8. HeikoKlare commented on Sep 11, 2026

    @HeikoKlare
    Contributor

    It would solve issues regarding performance, and it would probably not have the issues we have discussed for GDI+ recently (such as strange text layouting and kerning, missing capability to render some symbols). But we do of course not have a "complete" list of known issue with GDI and GDI+. And adopting Skia will introduce other challenges, like third-party dependencies with maintenance effort, maybe other technical limitations and the like. I am still convinced that the benefits would outweigh that, but there is of course also some cost coming with it. See also the PR for the Skia integration:

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