- double scale = min_size/1024.0;
- for(t=from;t<=to;t++) {
- if(t==x1) {
- row[t]=-1e20;
- continue;
- }
- double r1 = (t<x1?t:x1)*scale;
- double r2 = (t<x1?x1:t)*scale;
- double d1 = r2-r1;
- double d2 = d1+2;
- double s = d2/d1;
- double ext1 = r1-from*scale;
- double ext2 = to*scale-r2;
- double add1 = ext1*s - ext1;
- double add2 = ext2*s - ext2;
-
- /* don't allow the char to grow more than one pixel */
- if(add1>=1 || add2>=1) {
- row[t]=-1e20;
+
+ if(num<=1) {
+ *_x1=x1;
+ } else {
+ /* this code is slightly wrong, in that it assumes that the glyph distortion problem
+ gets worse when the font sizes get smaller. it doesn't. in fact, the smaller
+ the font size, the more of the scaling bugs disappear (http://www.quiss.org/files/scaletest.swf)
+ A better way would probably to use the font size you need for the two alignzones
+ to come to lie in different pixels, which what I think is what makes the problems
+ appear/disappear.
+ */
+
+ double scale = min_size/1024.0;
+ for(t=from;t<=to;t++) {
+ if(t==x1) {
+ row[t]=-1e20;
+ continue;
+ }
+ double r1 = (t<x1?t:x1)*scale;
+ double r2 = (t<x1?x1:t)*scale;
+ double d1 = r2-r1;
+ double d2 = d1+2;
+ double s = d2/d1;
+ double ext1 = r1-from*scale;
+ double ext2 = to*scale-r2;
+ double add1 = ext1*s - ext1;
+ double add2 = ext2*s - ext2;
+
+ /* don't allow the char to grow more than one pixel */
+ if(add1>=1 || add2>=1) {
+ row[t]=-1e20;
+ }