terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Refactor `_GetProposedFont` into a static function

Open DHowett opened this issue 3 years ago • 2 comments

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.

DHowett avatar Nov 15 '21 17:11 DHowett

(We still shouldn't be spinning up an entire renderer just to measure text. Is that fixed?)

DHowett avatar Feb 07 '24 00:02 DHowett

Oh I came across this issue while searching for another rendering bug and thought this one would be irrelevant because it's DxEngine (I only read the title). I'll reopen it.

lhecker avatar Feb 07 '24 00:02 lhecker