I want to display text with directwrite in a specified rectangle and with a specified font size, the text outside the rect should be cutted off.
By searching I found something about CreateTextLayout but it looked like it isn't possible to define the font size with it.
Thanks for answers.
It's not something DirectWrite is responsible for, unless you're using IDWriteBitmapRenderTarget
. If you're using DrawText/DrawTextLayout from Direct2D you simply need to use D2D1_DRAW_TEXT_OPTIONS_CLIP
option. If you are using DirectWrite bitmap target, it's enough to set target size to layout size, or to blit layout size portion to your destination context.