• No results found

Chapter 2: Background

2.1 Proportional Text Display Process

2.1.3 Kerning

The next step in the text display process is to calculate and apply any special features for character bitmaps. Some of these special features are simply different kinds of

2. Background

13

decorations (underline, shadows, strike-thrus, etc.), however some are more important in the readability experience of user.

OS developers and application designers consider a number of restrictions for the users which ultimately makes the performance of their software better. E-Book readers generally only support certain types of fonts and certain sizes for the text; which eliminates the need for vector based font support. Although advertised as powerful processing units that can handle even more tasks than simply reading books, E-Book readers suffer from large delays when the user changes the size of the text or the font.

Kerning, an important factor to improve readability of displayed text [13], is an example of one of the features that are ignored in text rendering. Kerning, by definition, is the process of adjusting the spacing between characters in a word or a phrase to achieve a more readable result [14]. The designed rendering engine of this work has the ability to handle kerning without any significant performance loss comparing to the existing software based rendering engines.

The following example shows how kerning can affect the spacing between the two letters W and A.

2. Background

14

Figure ‎2-2: Comparing the effect of kerning on the placement of characters

In Figure 2-2(a) W and A are placed with no kerning applied, which means the bounding box of character A started immediately after the end of the bounding box of W. In (b) the bounding box of A has overlapped with bounding box of W since the A can be pushed closer to W. The importance of kerning arises when we have a situation like W and A in a word. The words WAKE and Wake are shown with and without kerning. This situation happens for many other combinations of letters.

Figure ‎2-3: Effect of Kerning on Readability. Part (a) is output of Microsoft Word without Kerning and Part (b) is output based on the proposed method.

2. Background

15

In the first set, the letter W looks to be disconnected from the word. This will lead to lower readability of the text. With kerning the second set shows words that feel more connected and easier to read.

There have been some efforts from software developers and font designers to come up with a kerning algorithm to make the displayed text more pleasant to read [15] [16]. These methods are mostly based on mathematical equations, and geometrical relationships of individual glyph curves. The TTF and OTF font files have the ability to provide kerning through the use of tables (described as combinations of pairs of characters), however the implementation is poor when using large font sizes. In most cases the data isn’t even provided at all. As one might have experienced, even with famous commercial text editing applications like Microsoft Word, none of these methods have made a significant difference in the appearance of text and especially for large sized texts where the situation can be very drastic.

Another approach to kerning is to use visual inspection; schemes similar to what humans do in hand writing. For example, we see that we can squeeze W and A more because their shapes allow us to without overlapping them onto each other.

The same approach can be used in by a computer by looking at the bitmaps of each characters and how close they can be placed on the screen beside each other. This method requires examining the bitmaps of the two letters row by row to determine what is the

2. Background

16

least amount of spacing such that they won’t overlap. We call this method “visual kerning”.

Figure ‎2-4: Visual Kerning Calculation

In order to make the visual kerning more appealing, one must take into consideration the fact the pixels at the edges of most characters don’t have the full luminance due to aliasing; we cell these sub pixels. If the minimum acceptable distance between two characters be considered as one pixel, there is difference in appearance of two pixels that are fully illuminated and separated by one empty pixel and other two that are partially illuminated and again separated by one empty pixel. Kerning does not have to consider sub pixels, however the results are far better but with the cost of more resources as it requires going through each of the bitmaps row by row and calculating the kerning distance for each pair.

2. Background

17

The author of this work has implemented both scenarios in the software version but in the final hardware version does not take sub pixels in to consideration so that the final design is simpler.

The additional overhead of this method comes from two sets of calculations being added to the text display process. As noted before, FreeType extracts the properties of characters, the metrics, from the font file. Figure 2-1 shows some of these properties in relation to the glyph.

The width of each glyph is considered to be the width of the bounding box of the character bitmap. Also for many cases the advance (the horizontal increment to the next character) is either equal or larger than the width. As shown in Figure 2-2, in many occasions, the characters can be pushed even closer to each other than the suggested advancement. Therefore the information provided by the font renderer is not necessarily accurate when determining the kerning distance between a pair of characters.

In order to accurately measure the visual kerning distance between any pairs of characters, first the proposed engine needs to generate two more sets of data from the bitmaps of characters: The actual distance between the glyph bitmap and the bounding box for each row on the right and the left. Once two characters need to be placed, these measurements are compared on a row by row basis to determine how closely the bitmaps can be placed.

2. Background

18

Figure ‎2-5: Measured distance between bitmap and bounding box edges

It is possible to cache the kerning distances for different character pairs, but this may not be a good choice since so many possible combinations can exist due to the number of characters that exist in font files today. Unicode offers up to 32-bits to reference a character; the goal being to generate single font files for all languages. Any use of caching would require strict frequency rules and memory management; a task for software, not hardware.

One of the advantages of the proposed hardware-software hybrid text display engine is to make it possible to implement features like visual kerning in a way that the resulting experience is still faster than traditional software methods.

In document Hardware Accelerated Text Display (Page 30-36)

Related documents