[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] Autohinter only works for unrotated text
From: |
James Cloos |
Subject: |
Re: [ft-devel] Autohinter only works for unrotated text |
Date: |
Wed, 27 May 2009 17:24:49 -0400 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.92 (gnu/linux) |
>>>>> "Graham" == Graham Asher <address@hidden> writes:
Graham> When I coded this up for a private project a while ago I took a
Graham> simpler approach: I used the matrix to convert the point (1,0) to a
Graham> new point. If the new point is (x,0), (0,x), (-x,0) or (0,-x) for any
Graham> x we have a rotation by a multiple of 90 degrees, neglecting any
Graham> slant; the slant is ignored because we are transforming a vector along
Graham> the baseline, and that's what we're interested in.
Applying the matrix to the point (1,0) is a great idea. The result is
Sx×cos(θ), −Sx×sin(θ) or, picking from the matrix itself, (xx,yx).
The check, then, is:
(xx == 0 && yx != 0) || (yx == 0 && xx != 0)
Graham> This system worked perfectly.
Again, great simplification!
A proposed changeset is:
>From 5b1e0c0f4cc29a278cc2169c04dc56907a220f32 Mon Sep 17 00:00:00 2001
From: James Cloos <address@hidden>
Date: Wed, 27 May 2009 17:16:38 -0400
Subject: [PATCH 1/1]
=?utf-8?q?Allow=20autohinting=20when=20rotating=20by=20multiples=20of=2090=C2=B0.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
* src/base/ftobjs.c (FT_Load_Glyph): alter check for permitted
matrices to allow rotations by multiples of 90°, not only un-
rotated, possibility slanted matrices.
Signed-off-by: James Cloos <address@hidden>
---
src/base/ftobjs.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 613deef..c1ce2fd 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -590,7 +590,8 @@
*
* - Do only auto-hinting if we have a hinter module,
* a scalable font format dealing with outlines,
- * and no transforms except simple slants.
+ * and no transforms except simple slants and/or
+ * rotations by integer multiples of 90 degrees.
*
* - Then, autohint if FT_LOAD_FORCE_AUTOHINT is set
* or if we don't have a native font hinter.
@@ -607,8 +608,10 @@
FT_DRIVER_IS_SCALABLE( driver ) &&
FT_DRIVER_USES_OUTLINES( driver ) &&
!FT_IS_TRICKY( face ) &&
- face->internal->transform_matrix.yy > 0 &&
- face->internal->transform_matrix.yx == 0 )
+ ( ( face->internal->transform_matrix.yx == 0 &&
+ face->internal->transform_matrix.xx != 0 ) ||
+ ( face->internal->transform_matrix.xx == 0 &&
+ face->internal->transform_matrix.yx != 0 ) ) )
{
if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) ||
!FT_DRIVER_HAS_HINTER( driver ) )
--
1.6.3.rc0.53.g1a1f0.dirty
-JimC
--
James Cloos <address@hidden> OpenPGP: 1024D/ED7DAEA6