Repository navigation
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TextRenderer has had two implementations:
DirectWriteTextRendererandGdiTextRenderer. 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
GdiTextRendererso that we no longer need to keep the text rendering logic compatible with GDI.With this commit,
TextRenderer::Createreturns 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
Win32Serverno longer ownsTextRenderer, 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
GdiTextRenderer#1612Steps to test new behaviors (if any)