GetMetrics normally works.
I had adapted MS code for more precise calculations with GetOverhangMetrics in
CScrollingText.cpp
(inside OnPaintProc)
How to get text width and height in DirectWrite/Direct2D

thebluetropics
1,046
Reputation points
I need an approach to get the text width and height (like getBoundingClientRect()
in DOM) in DirectWrite/Direct2D.
I know IDWriteTextLayout::GetMetrics()
but, the width
and height
seems doesn't right. Is there built-in helper method to achieve this in DirectWrite?
Windows development | Windows API - Win32
2,791 questions
Developer technologies | C++
3,978 questions
Accepted answer
-
Castorix31 90,686 Reputation points
2022-09-16T08:16:31.467+00:00