With regard to the representation of characters, we can split clipping into area clipping or line clipping. Area clipping is used in the case where characters are represented by a bitmap, and line clipping is practical if characters are represented by lines. But, in the majority of cases we use characters composed from lines and curves, so-called vectors. Its advantage is that we can zoom or scale, without a loss of quality.
According to how precise we want the clipping of a text, we categorize clipping a text as follows:
In normal text coding, each character is represented by one value totaling 1 byte. In clipping, we should look at a character as an inseparable object. Every character comprises a minimum rectangle, which we will call a 'character envelope'. While clipping a character to a character, we test whether the center of an envelope is in the display box, or whether the envelope is wholly inside the display box or not. On the basis of this we decide whether to display the given character.
In the case of precise clipping of a text, represented by vectors, we should test the conjunctions of every abscissa and of every curve forming the given character. This method is time consuming.
Applet Clipping text into window
Applet Text Clipping. Author Ladicky JurajSource code