-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce DxFontRenderData #9096
Introduce DxFontRenderData #9096
Conversation
I'm putting Michael and Dustin on this one - Michael since he's the rendering expert, and Dustin because I know he had some other thoughts on how to deal with implementing bold. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very excited by this. There were SO MANY PARAMETERS being passed around for this font information and it just kept getting bigger and bigger.
I just had a few small things to discuss/address before signoff.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm good with this now. Thanks!
@@ -6,7 +6,7 @@ | |||
<RootNamespace>base</RootNamespace> | |||
<ProjectName>RendererBase</ProjectName> | |||
<TargetName>ConRenderBase</TargetName> | |||
<ConfigurationType>StaticLibrary</ConfigurationType> | |||
<ConfigurationType>StaticLibrary</ConfigurationType> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you’re wondering why this is modified, originally I added an “interface” class here but then found it useless. VS modified the line ending anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is the only change in the file, would you mind reverting it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took a while for me to realize I'm actually changing the LF here to CRLF, to make it 'correct'. Do you still want me to revert this?...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. Since this makes it correct, you can keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor things!
// - dpi - The DPI of the screen | ||
// Return Value: | ||
// - S_OK or relevant DirectX error | ||
[[nodiscard]] HRESULT DxFontRenderData::UpdateFont(const FontInfoDesired& desired, FontInfo& actual, const int dpi) noexcept |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This monstrous method will be refactored in my following PRs, which will introduce DxFontInfo
and clear the logic in DxFontRenderData
. @DHowett Probably not what you initially expect ("cascading FontInfo", See #8580 (comment) ) but I'll try my best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
note: i brought up the sources thing because technically the dx renderer still works in conhost ... sometimes. 😄
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
This PR Introduces `DxFontInfo` to simplify the logic in `DxFontRenderData`. `DxFontInfo` aims to be the DWrite equivalent of `FontInfo` & `FontInfoBase` in GDI. It encapsulates the needed information to represent a displayable font face. It also provides the ability to resolve a font face based on the available fonts on the system. ## References This is a follow-up of #9096. Initial Italic support was introduced by #8580. The motivation behind this is to support bold & bold-italic text in Windows Terminal.
This commit adds support for bold text in DxRenderer. For now, bold fonts are always rendered using DWRITE_FONT_WEIGHT_BOLD regardless of the base weight. As yet, this behavior is unconfigurable. References Previous refactoring PRs: #9096 (DxFontRenderData) #9201 (DxFontInfo) SGR support tracking issue: #6879 Closes #109
This is my attempt to isolate all the dwrite font related thing by
introducing a new layer -
DxFontRenderData
. This will freeDxRenderer
&CustomTextLayout
from the burden of handling fonts &box effects. The logic is more simplified & streamlined.
In short I just moved everything fonts-related into
DxFontRenderData
and started from there. There's no modification to code logic. Just pure
structural stuff.
SGR support tracking issue: #6879
Initial Italic support PR: #8580