mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
D2D: Adjusted character spacing for AccurateText=0
This commit is contained in:
parent
52b5e2584a
commit
6aab840dfb
@ -318,6 +318,17 @@ void CanvasD2D::DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& forma
|
|||||||
formatD2D.m_TextLayout->GetFontSize(0, &xOffset);
|
formatD2D.m_TextLayout->GetFontSize(0, &xOffset);
|
||||||
xOffset /= 6.0f;
|
xOffset /= 6.0f;
|
||||||
|
|
||||||
|
if (!m_AccurateText)
|
||||||
|
{
|
||||||
|
float emOffset = xOffset / 22.0f;
|
||||||
|
|
||||||
|
DWRITE_TEXT_RANGE range = {0, strLen};
|
||||||
|
Microsoft::WRL::ComPtr<IDWriteTextLayout1> textLayout;
|
||||||
|
formatD2D.m_TextLayout.As(&textLayout);
|
||||||
|
|
||||||
|
textLayout->SetCharacterSpacing(emOffset, emOffset, 0.0f, range);
|
||||||
|
}
|
||||||
|
|
||||||
m_Target->DrawTextLayout(
|
m_Target->DrawTextLayout(
|
||||||
D2D1::Point2F(m_AccurateText ? rect.X : right ? rect.X - xOffset : rect.X + xOffset,
|
D2D1::Point2F(m_AccurateText ? rect.X : right ? rect.X - xOffset : rect.X + xOffset,
|
||||||
m_AccurateText || !bottom ? rect.Y : rect.Y - 1.0f),
|
m_AccurateText || !bottom ? rect.Y : rect.Y - 1.0f),
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <GdiPlus.h>
|
#include <GdiPlus.h>
|
||||||
#include <d2d1.h>
|
#include <d2d1.h>
|
||||||
#include <d2d1helper.h>
|
#include <d2d1helper.h>
|
||||||
#include <dwrite.h>
|
#include <dwrite_1.h>
|
||||||
#include <wincodec.h>
|
#include <wincodec.h>
|
||||||
#include <wrl/client.h>
|
#include <wrl/client.h>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user