In the DirectWrite guides and examples I only found solutions for creating layout and rendering relatively small strings, i.e. with not a big number of characters.
Currently I understand that the method with the best performance is to create and cache IDWriteTextLayout
and draw it using ID2D1DeviceContext::DrawTextLayout
. Layout is needed to be recreated only when display text is need to be updated: when changing font size, family, text string itself, etc.
This method works fine for less then about 50 000 characters string, but starting from here, fps significantly drops. But I want more than 50K chars, I want 50M chars, for example. At my pc ID2D1DeviceContext::DrawTextLayout
takes about 23ms to draw 55 000 character string, which means that the result fps (there are another ui elements) will be already less then 1000/23 = 43 fps.
How, for example in classic notepad.exe there is no delay when I input some character in 10 000 000 characters text and all is rendering at 60fps? Maybe there I need to separate strings on chunks and draw individual but display as one string? I currently barely can imaging how to deal with ending position of one string and starting of another.