microsoft / microsoft/terminal

Refactor `_GetProposedFont` into a static function

Open
#11,763 2 comments 0 reactions 0 assignees View on GitHub
Area-CodeHealth Area-Performance Help Wanted Issue-Task Priority-2 Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

Ported from MSFT-21254947

> With Dart/OpenConsole!3129098, I instantiate an entire DxEngine just to get the initial size of the control.
>
> Turns out there's only two things that _GetProposedFont really needs from the instance - the dwriteFactory, and the _chainMode. If we make those params, then we could make GetProposedFont a public static function, and not need to instantiate an entire engine (including all the dx resources it needs) just to get the font size.

We should not be spinning up an entire DX Renderer to ask it how big a cell should be.

Contributor guide

Open the contributing guide

Research direction

Start by locating `_GetProposedFont` and the `DxEngine` code that currently calls it. Trace its uses of `dwriteFactory` and `_chainMode`, then assess how those values can become parameters without constructing the full renderer. Done means the font-size calculation is exposed as a static function and callers no longer need an entire DxEngine for it; the issue names no tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.