[gs-cvs] rev 7702 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Wed Feb 14 23:59:51 PST 2007
Author: leonardo
Date: 2007-02-14 23:59:50 -0800 (Wed, 14 Feb 2007)
New Revision: 7702
Modified:
trunk/gs/src/gxhintn.c
Log:
Fix (type 1 hinter) : An improvement for very small matrices.
DETAILS :
Debugged with this :
/Courier findfont 0.000000000000000000000000000000001 scalefont setfont
72 72 moveto
(ASDFGGH) show
showpage
In fraction_matrix__set the old code computed this->bitshift = 137,
and then
this->denominator = 1 << this->bitshift
gave a nonsnse result 512.
Here is the assembler code for the latter statement built with MSVC8 :
mov ecx,dword ptr [eax+14h]
shl edx,cl
It simply drops higher bytes.
Looks as MSVC compiler bug.
The new code replaces it with strong zero.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gxhintn.c
===================================================================
--- trunk/gs/src/gxhintn.c 2007-02-15 03:43:27 UTC (rev 7701)
+++ trunk/gs/src/gxhintn.c 2007-02-15 07:59:50 UTC (rev 7702)
@@ -236,16 +236,21 @@
double unused = frexp(scale, &matrix_exp);
this->bitshift = matrix_bits - matrix_exp;
- this->denominator = 1 << this->bitshift;
- /* Round towards zero for a better view of mirrored characters : */
- this->xx = (int32_t)(pmat->xx * this->denominator + 0.5);
- this->xy = (int32_t)(pmat->xy * this->denominator + 0.5);
- this->yx = (int32_t)(pmat->yx * this->denominator + 0.5);
- this->yy = (int32_t)(pmat->yy * this->denominator + 0.5);
- m = Max(Max(any_abs(this->xx), any_abs(this->xy)), Max(any_abs(this->yx), any_abs(this->yy)));
- unused = frexp(m, &matrix_exp);
- if (matrix_exp > matrix_bits)
- fraction_matrix__drop_bits(this, matrix_exp - matrix_bits);
+ if (this->bitshift >= sizeof( this->denominator) * 8) {
+ this->denominator = 0;
+ this->xx = this->xy = this->yx = this->yy = 0;
+ } else {
+ this->denominator = 1 << this->bitshift;
+ /* Round towards zero for a better view of mirrored characters : */
+ this->xx = (int32_t)(pmat->xx * this->denominator + 0.5);
+ this->xy = (int32_t)(pmat->xy * this->denominator + 0.5);
+ this->yx = (int32_t)(pmat->yx * this->denominator + 0.5);
+ this->yy = (int32_t)(pmat->yy * this->denominator + 0.5);
+ m = Max(Max(any_abs(this->xx), any_abs(this->xy)), Max(any_abs(this->yx), any_abs(this->yy)));
+ unused = frexp(m, &matrix_exp);
+ if (matrix_exp > matrix_bits)
+ fraction_matrix__drop_bits(this, matrix_exp - matrix_bits);
+ }
}
private inline int fraction_matrix__to_double(const fraction_matrix * this, double_matrix * pmat)
More information about the gs-cvs
mailing list