I am using a message EM_FORMATRANGEto map the output of an extended text control to an arbitrary device context. However, when rendering to a bitmap, the dots per inch of the context of the bitmap device are the same as the DPI display device, which is 96 dpi. This is much lower than I would like to do. I would prefer to do it at a much higher DPI so that the user can zoom in and possibly print to a high DPI printer later.
I suspect what is happening is that the RTF control calls GetDeviceCapswith LOGPIXELSXand LOGPIXELSYto get the number of pixels per inch of the device. It then displays the document using this DPI value with a 100% zoom level. Windows display devices always return 96 DPI if the system does not use large fonts (as indicated in the control panel) and the application supports DPI.
Many examples on the Internet offer output scaling EM_FORMATRANGE. This is so that any arbitrary DPI resolution can be achieved. The most commonly used examples SetMapMode, SetWindowExtExand SetViewportExtEx(for example, see. Http://social.msdn.microsoft.com/Forums/en-us/netfxbcl/thread/37fd1bfb-f07b-421d-9b5e-5f4492ffbbc3 ), these functions can be used to scale the output of processed text with expanded text: for example, if I specify 400% scaling, then if the control with large text displayed what was 5 pixels wide, it would actually get a width of 20 pixels.
Unfortunately, the old GDI functions use integers instead of floating point numbers. For example, suppose the RTF control decided that the element should be drawn at (12.7, 15.3) pixels. This will be rounded to the position (13, 15). These rounded coordinates are passed to the GDI, which then scales the image using the scaling specified in SetMapMode: for example, 400% will be (13 * 4, 15 * 4) or (52, 60). But this is inaccurate: the element would be better placed in (12.7 * 4, 15.3 * 4) or (51, 61). Worst of all, in some cases the error becomes cumulative.
I believe this is the main reason for this very noticeable error when scaling plain text:

8- Segoe, 400% EM_FORMATRANGE SetMapMode 96 DPI. 32 , .

WordPad, 8- Segoe, 400%. . 32- 100% - .
, . 400%.
, , , , , , - 96 DPI - . , - , , , .
, :
- , ,
GetDeviceCaps . (: , DPI, , , , .) - edit , ,
GetDeviceCaps.
, .
- (1) , , (2) , DPI ?