I investigated what metrics I can get from DirectWrite text layout (IDWriteTextLayout).
IDWriteTextLayout::GetMaxWidth(), GetMaxHeight()
It seems that GetMaxWidth() and GetMaxHeight() simply return the layout width and height which are specified at IDWriteFactory::CreateTextLayout method().
IDWriteTextLayout::DetermineMinWidth(FLOAT)
DetermineMinWidth() returns the maximum width of the word in the text. If the layout width is smaller than this width, the word in the text is broken.
example 1:
m_pDWriteFactory->CreateTextLayout(
text.c_str(),
text.length(),
textFormat,
120.0f, 30.0f,
&textLayout);
FLOAT width;
textLayout->DetermineMinWidth(&width);
example 2:
...
DWRITE_TEXT_METRICS layoutWidth/layoutHeight
layoutWidth and layoutHeight of a DWRITE_TEXT_METRICS structure are same as the layout width and height which are specified at IDWriteFactory::CreateTextLayout method().
DWRITE_TEXT_METRICS width/height
DWRITE_TEXT_METRICS.width indicates the width of the formatted text, while ignoring trailing whitespace at the end of each line.
DWRITE_TEXT_METRICS.height indicates the height of the formatted text.
example 1:
m_pDWriteFactory->CreateTextLayout(
text.c_str(),
text.length(),
textFormat,
120.0f, 30.0f,
&textLayout);
DWRITE_TEXT_METRICS textMetrics;
textLayout->GetMetrics(&textMetrics);
example 2:
...
example 3:
...
DWRITE_TEXT_METRICS widthIncludingTrailingWhitespace
DWRITE_TEXT_METRICS.widthIncludingTrailingWhitespace indicates the width of the formatted text, taking into account the trailing whitespace at the end of each line.