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
Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Answer accepted by question author
-
Castorix31 91,506 Reputation points2022-09-16T08:16:31.467+00:00