mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Gfx: Fix that empty strings have a width and/or height with D2D
This commit is contained in:
parent
d97128e2ab
commit
5fcf4b785d
@ -29,12 +29,20 @@ DWRITE_TEXT_METRICS GetAdjustedDWriteTextLayoutMetrics(
|
|||||||
DWRITE_TEXT_METRICS metrics;
|
DWRITE_TEXT_METRICS metrics;
|
||||||
textLayout->GetMetrics(&metrics);
|
textLayout->GetMetrics(&metrics);
|
||||||
|
|
||||||
if (gdiEmulation)
|
if (metrics.width > 0.0f)
|
||||||
{
|
{
|
||||||
float size = 0.0f;
|
if (gdiEmulation)
|
||||||
textLayout->GetFontSize(0, &size);
|
{
|
||||||
metrics.width = floor(metrics.width + (size / 2.05f) + (metrics.width / 55.0f) - 0.5f);
|
float size = 0.0f;
|
||||||
metrics.height = floor(metrics.height + (size / 9.25f) + 0.3f);
|
textLayout->GetFontSize(0, &size);
|
||||||
|
metrics.width = floor(metrics.width + (size / 2.05f) + (metrics.width / 55.0f) - 0.5f);
|
||||||
|
metrics.height = floor(metrics.height + (size / 9.25f) + 0.3f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Get rid of the height that DirectWrite assigns to zero-width strings.
|
||||||
|
metrics.height = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return metrics;
|
return metrics;
|
||||||
|
Loading…
Reference in New Issue
Block a user