ChartDirector 7.0 (Python Edition)

pychartdir.ClearTypeColor


Usage

ClearTypeColor([ gamma ])

Description

Gets a value to represent that standard ClearType or a similar technology be used for drawing text.

This constant is used in BaseChart.setAntiAlias and DrawArea.setAntiAlias.

ClearType is a Microsoft font rendering technology that renders text more accurately with subpixel rendering. Similar technologies include Quartz in Mac OS X, Adobe CoolType and other unnamed algorithms. Although this API uses ClearType in its name, ChartDirector may use ClearType or a similar technology depending on the operating system and programming language.

In most modern flat panel displays, a pixel is consisted of 3 sub-pixels R, G and B for the red, green and blue colors, typically arranged horizontally. So a row of pixels is actually a sequence of subpixels like RGBRGBRGBRGB... To display a white pixel, the display hardware turns on the RGB subpixels.

It happens a white dot can also be made by turning on the GB subpixels of one pixel, and the R subpixel of the next pixel to the right. This will result in 3 consecutive subpixels GBR, which is also white. This white dot will be in between the two pixels, with 2/3 on the left pixel, and 1/3 on the right pixel. In other words, it is possible to position a white dot in between two pixels without blurring it. ClearType uses this effect to render text with subpixel accuracy.

Apart from subpixel rendering, ClearType may adjust the glyph shapes to fit the pixel grid (technically called hinting) differently from classical rendering. As a result, the glyph shapes and sizes in ClearType may be different from classical rendering.

One issue with ClearType is that it is hardware dependent. To work perfectly, it needs to know the subpixels ordering of the display. In many applications, the charts are rendered on one computer, but viewed using another computer. For example, in a web application, the charts can be rendered on the server but displayed on the browser computer. The chart generating computer may not know the subpixel configuration of the viewing computer. If ClearType is used, there is a risk that the text may look suboptimal on the viewing computer.

To address the above issues, ChartDirector supports a monochrome ClearType method, represented by ClearTypeMono. This is basically ClearType with subpixel rendering disabled. The resulting text has no color distortion. Black and white text will not be as sharp as standard ClearType, but is still better than classical anti-alias. The charts rendered can be viewed equally well with different types of displays. This is especially useful for applications in which the charts are rendered and viewed by different computers.

Arguments

ArgumentDefaultDescription
gamma0Specifies the level of gamma correction used for ClearType font rendering. This is usually a number between 1 to 2.5. A value of 0 means the default gamma level.

Return Value

An integer representing that standard ClearType or a similar technology be used for font rendering.