|
From: | Artur Zaprzała |
Subject: | Re: [Devel] pixel size, hinting and scaling |
Date: | Fri, 24 Jan 2003 23:37:46 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130 |
Graham Asher wrote:
Here's some working code that decomposes a FreeType matrix into scale and the rest. I'd be grateful for comments. It converts the matrix's effect on a vector pointing rightward into a new matrix representing the inverse of the rotation. It then removes the rotation, stores the scale factors, removes the scales, and adds the rotation back. The scales are forced positive so that they can be used to set pixel sizes without further manipulation (apart from converting to 1/64 pixels). I developed this code as part of my work for Artifex on the GhostScript-to-FreeType bridge.
Decomposing affine transform to scaling and the rest is ambiguous. Notice that you can docompose each rotation (except when a=0||b=0) to shearing and scaling:
|a b| |a 0| | 1 b/a| | | = | | * | | |c d| |0 d| |c/d 1 | so you cannot get scaling only part and rotation-and-shear only part.Using [1,0] vector to find rotation you miss x-axis skew. If you use e.g. [0,1] vector in you, you'll get different scales.
-- Artur Zaprzała
[Prev in Thread] | Current Thread | [Next in Thread] |