Windows font rendering

自古美人都是妖i 提交于 2019-12-12 05:56:20

问题


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.

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 ?

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.


回答1:


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.

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.

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



来源:https://stackoverflow.com/questions/11940048/windows-font-rendering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!