Windows字体渲染 [英] Windows font rendering

查看:97
本文介绍了Windows字体渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,它将数据流发送到打印机(来自 Redmon )作为输入.数据流具有以单色位图呈现的文本,打印机将使用该文本将其打印在纸上.我计划解析此数据流,并了解发送到打印机的文本.我的应用程序将解析来自任何Windows应用程序并进入打印机的数据.

I am writing an application which gets the data stream going to the printer (from Redmon) as input. The data stream has text rendered as monochromatic bitmap which printer would use to print it on the paper. I plan to parse this data stream and understand the text going to the printer. My application would parse the data coming from any windows application and going to the printer.

我解析数据流的方式是通过匹配像素信息(逐字节),如果存在精确匹配,则可以唯一地标识一个字符.为此,我假设所有Windows应用程序都使用相同的Windows渲染器以像素为单位渲染字体.因此,如果这些应用程序(包括基于Java的应用程序)使用相同的字体和字体大小来打印其文本,则我将始终从任何应用程序获得相同字符的字节序列.这是正确的假设吗,还是Windows为应用程序提供了多种选项来渲染要打印的文本?

The way I parse the data stream is by matching the pixel information (byte by byte) and if there is an exact match then I can uniquely identify a character. For this I am assuming that all windows applications use same windows renderer to render the font in terms of pixel. Hence I would always get the same sequence of bytes for a particular character from any application if these application(including the ones based on java) use same font and font size for printing their text. Is this a correct assumption or do windows provide various options to applications for rendering the text for printing ?

还有一个可用于使用单色位图数据进行字符识别的库吗?

Also is there a library which I can use for doing character recognition using monochromatic bitmap data ?

注意:我使用的打印机是ESC/POS兼容打印机.这些打印机的打印机驱动程序将要打印的数据作为单色位图发送.

NOTE: The printers I am using are ESC/POS compatible printers. The printer driver for these printers send the data to be printed as a monochromatic bitmap.

推荐答案

我对ESC/POS打印机不熟悉,但是如果可以保证驱动程序始终将文本呈现为单色位图,则字符对于相同的字体和大小非常高,但不是100%.首先,您还需要考虑旋转,缩放和剪切.您需要考虑整个转换矩阵,而不仅仅是字体大小.

I'm not familiar with ESC/POS printers, but if you can guarantee the driver always renders text as monochrome bitmaps, your chances of characters being identical for the same font and size are very high, but they are not 100%. First, you also need to account for rotation, scaling and shearing. You would need to consider the entire transformation matrix, not just the font size.

我至少可以想到另外两个故障点:1)透明胶片覆盖的文本; 2)如果计算机上安装了具有相同名称的备用字体.例如,可以从许多来源获得像Helvetica这样的常见字体,并且它们之间的字符将不相同.第三种可能的失败是一个应用程序,它忽略了打印机是单色的并且以彩色或灰度打印的事实.将颜色或灰度转换为单色会为不同的颜色生成不同的位图.

There are at least two other failure points I can think of: 1) Text overlaid with transparencies and 2) if the machine has alternate fonts installed with the same names. For example, common fonts like Helvetica can be obtained from many sources and the characters will not be identical between them. A third possible failure is an application that ignores the fact that a printer is monochromatic and prints in color or grayscale. Converting color or grayscale to monochrome will produce different bitmaps for different colors.

对于OCR软件, Wikipedia 具有OCR SDK的比较表.

As for OCR software, Wikipedia has a nice comparison chart of OCR SDKs.

这篇关于Windows字体渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆