Skip to content

Remove GdiTextRenderer - #1628

Open
yukawa wants to merge 1 commit into
google:masterfrom
ciceroaware:issue_1612
Open

yukawa wants to merge 1 commit into
google:masterfrom
ciceroaware:issue_1612

Conversation

@yukawa

@yukawa yukawa commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Description

TextRenderer has had two implementations: DirectWriteTextRenderer and GdiTextRenderer. The GDI-based one has been kept only as a fallback for the case where Direct2D or DirectWrite cannot be initialized, which is unlikely to happen on Windows 10 1809 and later that Mozc currently supports.

This commit removes GdiTextRenderer so that we no longer need to keep the text rendering logic compatible with GDI.

With this commit, TextRenderer::Create returns nullptr when Direct2D or DirectWrite cannot be initialized. Rather than crashing in that case, the main function of mozc_renderer creates TextRenderer by itself before starting the server, and exits with an error code if it fails. The client then gives up launching mozc_renderer after several retries, in the same way as it does for other launch failures.

As Win32Server no longer owns TextRenderer, this commit also resolves the initialization order dependency between its members.

In subsequent commits, we can further simplify the code, e.g., redesigning the interface of TextRenderer to be more straightforward.

There should be no user-visible change as long as Direct2D and DirectWrite are available.

Closes #1612.

Issue IDs

Steps to test new behaviors (if any)

  • OS: Windows 11 26H2
  • Steps:
    1. Confirm candidate window and other UI components are still shown.

TextRenderer has had two implementations: DirectWriteTextRenderer and
GdiTextRenderer. The GDI-based one has been kept only as a fallback for
the case where Direct2D or DirectWrite cannot be initialized, which is
unlikely to happen on Windows 10 1809 and later that Mozc currently
supports.

This commit removes GdiTextRenderer so that we no longer need to keep
the text rendering logic compatible with GDI.

With this commit, TextRenderer::Create returns nullptr when Direct2D or
DirectWrite cannot be initialized. Rather than crashing in that case,
the main function of mozc_renderer creates TextRenderer by itself before
starting the server, and exits with an error code if it fails. The
client then gives up launching mozc_renderer after several retries, in
the same way as it does for other launch failures.

As Win32Server no longer owns TextRenderer, this commit also resolves
the initialization order dependency between its members.

In subsequent commits, we can further simplify the code, e.g.,
redesigning the interface of TextRenderer to be more straightforward.

There should be no user-visible change as long as Direct2D and
DirectWrite are available.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider removing GdiTextRenderer

1 participant