大网数据广告活动
打印与设备

WYSIWYG Display and Output

· 52CE 我爱测

Most applications attempt to support WYSIWYG (what you see is what you get) output.

Most applications attempt to support WYSIWYG (what you see is what you get) output. This means that text drawn with a 10-point Helvetica bold font in the application window should have a similar appearance when it is printed. Obtaining true WYSIWYG output is virtually impossible and even undesirable in most cases. This is due, in part, to the differences in video and printer technologies; a pixel on a screen is generally larger than a dot on a common laser printer. Viewing distances are different as well; a computer user typically sits about two feet away from the screen, but a reader's eyes are usually one foot or less from the printed page.

To compensate for legibility differences between screens and the printed page, the system supports a unit called the logical inch that is always specified in pixels. For a video display, the logical inch is always greater than the physical inch to compensate for the longer viewing distance and the (generally) coarser resolution. For printers, the logical inch is always equal to the physical inch.

To obtain a WYSIWYG effect when drawing text, two related issues are involved: making individual characters look the same, and device-independent page layout. To address the first issue, an application can use the CreateFont function to specify the font name and size of an ideal (or logical) font and then call the SelectObject function to identify the display or printer device context. When the application calls SelectObject , the system selects a physical font that is the closest possible match to the specified logical font. When the system selects the display font, it chooses a physical font that is larger than the actual size. This occurs because of the larger logical inch on the display. From the user's perspective, however, it appears to be very close to the correct height. When the system selects the font for the printer, it chooses a physical font that is actually the requested size. For more information about fonts and text output, see Fonts and Text.

The second issue, that of device-independent page layout, can be addressed by the use of TrueType metrics. This is true even when maintaining compatibility with 16-bit versions of Windows. For more information, see Using Portable TrueType Metrics.

To obtain a WYSIWYG effect when drawing bitmapped graphics, an application can retrieve the width and height, in logical inches, of the screen and the printed page. Using these values, the application can create horizontal and vertical scaling factors to maintain the proportion of bitmapped images when they are drawn on a printer. For more information about bitmaps and bitmap output, see Bitmaps.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。