Skip to content

Add bold font support to the GDI renderer#19441

Merged
DHowett merged 3 commits intomicrosoft:mainfrom
alabuzhev:gh-18919-bold-fonts-support-in-gdi-engine
Oct 14, 2025
Merged

Add bold font support to the GDI renderer#19441
DHowett merged 3 commits intomicrosoft:mainfrom
alabuzhev:gh-18919-bold-fonts-support-in-gdi-engine

Conversation

@alabuzhev
Copy link
Contributor

Summary of the Pull Request

Bold fonts support in GDI engine

References and Relevant Issues

#18919

Detailed Description of the Pull Request / Additional comments

Render SGR1 as bold in 256 and true colors, where "bold is intense" is not applicable.
Implemented by creating 2 extra fonts: bold for 1 and bold italic for 1 + 3.

No non-trivial changes, just extensions.
LOGFONT also supports Underline and StrikeOut, but they seem to be already covered by other means, so no combinatorial explosion of fonts expected.

Validation Steps Performed

PR Checklist

  • Tests added/passed
  • Documentation updated
  • Schema updated (if necessary)

@alabuzhev alabuzhev force-pushed the gh-18919-bold-fonts-support-in-gdi-engine branch from f61ca48 to be4a8eb Compare October 13, 2025 20:53
Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this!

Comment on lines +105 to +108
HFONT _hfont;
HFONT _hfontBold;
HFONT _hfontItalic;
HFONT _hfontBoldItalic;
Copy link
Member

@lhecker lhecker Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose at this point we could consider making this an HFONT[4] array so that we can replace things like the DeleteObject code with loops. FontType could be changed to map the 4 styles to 0-3.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to mix features and refactoring, but if you think it's ok - sure, why not. Done.

Copy link
Member

@lhecker lhecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a commit to make the style checker happy. Thank you for your PR!

@lhecker lhecker changed the title gh-18919: Bold fonts support in GDI engine Add bold font support to the GDI renderer Oct 14, 2025
@lhecker lhecker requested a review from DHowett October 14, 2025 19:20

// Select into DC
RETURN_HR_IF_NULL(E_FAIL, SelectFont(_hdcMemoryContext, hFont.get()));
RETURN_HR_IF_NULL(E_FAIL, SelectFont(_hdcMemoryContext, hFonts[static_cast<size_t>(FontType::Default)].get()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lhecker surprised this would pass audit mode; it hates []

@DHowett DHowett merged commit 84cc3e3 into microsoft:main Oct 14, 2025
15 checks passed
@DHowett
Copy link
Member

DHowett commented Oct 14, 2025

thanks for doing this! Since it doesn't afford for the intense text option, I chose not to close the bug bug rather just link the PR to it :)

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.

3 participants