When dlls/win32u fails to load/initialize the \`FreeType font library', a device context object ends up with the only GDI driver attached -- `null_driver`. The latter implements the `pGetTextMetrics` callback function as do-nothing code. This causes the `NtGdiGetTextMetricsW()` function to fail not modifying fields of its `metrics` argument. In result the `normalize_nonclientmetrics()` ends up with uninitialized `tm` local variable after call to the `get_text_metr_size()` function. Using uninitialized fields of the `TEXTMETRICW` structure gives unpredictable results.
This memset(3)'s the `tm` structure before using. After that, even if we failed to load the \`FreeType font library', the \`CaptionHeight', \`SmCaptionHeight' and \`MenuHeight' metrics keep their current values (the `normalize_nonclientmetrics()` function is called after `get_twips_entry()` callback function, thus value of an entry should not be negative).
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7316
This broke after d58e917e2cb36c6ffcb259356c06171d8f6d4dcc in some situations, since it resulted in us calling wined3d_texture_download_from_texture() with CLEARED location. The latter was not aware of CLEARED and incorrectly assumed the source texture was in TEXTURE_SRGB.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7313