Page 1 of 1

ellipsis placement via clipstring option

Posted: October 17th, 2017, 6:35 am
by 2bndy5
My idea I want to contribute is letting the user specify the location of the ellipsis in the string of a meter by setting the clipstring option to 3 (for middle of string) or 4 (beginning of string).I've been looking at the source code for about a week now... It looks like I could modify trimming object (defined on line 399 of TextFormatD2D.cpp) to include a delimiter and delimiter count (starting from end of string). Therefore anything after the specified delimiter would be preserved and displayed after the ellipsis. MSDN Documentation

The clipstring option gets passed from MeterString.cpp onto TextFormatD2D.cpp via DrawString() but in the form of a boolean. It looks like the Boolean then determines the granularity argument of DWRITE_TRIMMING to Character (true) or none (false).

My thinking is if clipstring > 2 then set delimiting character and delimiter count (based on middle or beginning of string) and pass them along with the pre-existing Boolean from DrawSting(). I guess my question is: Should I create a DWRITE_TRIMMING object within DrawString() of MeterString.cpp or modify SetTrimming() within TextFormatD2D.cpp?
Furthermore, how do I determine the amount of characters displayed after clipping is applied? Is there a function in D2D that would help calculate this?

Re: ellipsis placement via clipstring option

Posted: October 22nd, 2017, 4:17 am
by 2bndy5
abandoned goal. preliminary test seemed to break clipstring functionality all together. :yawn: