0

Whenever I render a text using text layout object, it's apparent that actual width of text is not same as the width of layout depending on enable option in text wrapping.

I would like to know if there is anyway I could do to set width and layout width to be the same?

So When I pass in width and height in a creation of text layout object, I want it to render the text in the exact dimension I provided.

Mazer
  • 11
  • 2

1 Answers1

0

Initial layout dimensions are used to control word wrapping or trimming, if enabled. So it depends on what you want to achieve, normally you set desired layout box, and text does not have to fit or fully fill to any degree. When rendering you might be interested in effective rectangle that your text fits in fully, you need to call GetMetrics for that, and use returned DWRITE_TEXT_METRICS struct fields. Metrics data will contain actual rectangle sizes for your text, regardless of what you specified on layout creation.

bunglehead
  • 1,104
  • 1
  • 14
  • 22