Irritating Text Wrapping with GDI & Direct3D
If I use Direct3D's DrawText, which behaves like the GDI counterpart, and I e开发者_开发问答nable the DT_WORDBREAK
formatting flag, it'll cut the text on apostrophes whenever the situation arises, which leaves many titles and text displays looking like a mess. For instance, it will appear as:
The Horseman'
s Head
When it should say:
The
Horseman's Head
It seems unlikely considering the restrictive nature of the font handling functions, but is there any way of specifying it so that it only cuts text on white-space or when there's absolutely nothing that can be done?
You can wrap manually with the help of the GetTextExtentPoint32 function.
I've run in to this before, and the only solution is to write your own word wrapper, using DT_CALCRECT to measure the width of a given string. It's annoying and it does suck, but I've never seen an alternative.
I don't think so (i may be wrong). But you can set a "virtual" limit on a Width. Calculate line length (char_count*font_width) and make the jumps yourself. You can even add special char "\n", to insert your own jumps...
精彩评论