@@ -236,8 +236,8 @@ ft_outline_move_to(FT_Vector const* to, void* user)
236236 *(d->vertices ++) = 0 ;
237237 *(d->codes ++) = CLOSEPOLY;
238238 }
239- *(d->vertices ++) = to->x / 64 .;
240- *(d->vertices ++) = to->y / 64 .;
239+ *(d->vertices ++) = to->x * ( 1 . / 64 .) ;
240+ *(d->vertices ++) = to->y * ( 1 . / 64 .) ;
241241 *(d->codes ++) = MOVETO;
242242 }
243243 d->index += d->index ? 2 : 1 ;
@@ -249,8 +249,8 @@ ft_outline_line_to(FT_Vector const* to, void* user)
249249{
250250 ft_outline_decomposer* d = reinterpret_cast <ft_outline_decomposer*>(user);
251251 if (d->codes ) {
252- *(d->vertices ++) = to->x / 64 .;
253- *(d->vertices ++) = to->y / 64 .;
252+ *(d->vertices ++) = to->x * ( 1 . / 64 .) ;
253+ *(d->vertices ++) = to->y * ( 1 . / 64 .) ;
254254 *(d->codes ++) = LINETO;
255255 }
256256 d->index ++;
@@ -262,10 +262,10 @@ ft_outline_conic_to(FT_Vector const* control, FT_Vector const* to, void* user)
262262{
263263 ft_outline_decomposer* d = reinterpret_cast <ft_outline_decomposer*>(user);
264264 if (d->codes ) {
265- *(d->vertices ++) = control->x / 64 .;
266- *(d->vertices ++) = control->y / 64 .;
267- *(d->vertices ++) = to->x / 64 .;
268- *(d->vertices ++) = to->y / 64 .;
265+ *(d->vertices ++) = control->x * ( 1 . / 64 .) ;
266+ *(d->vertices ++) = control->y * ( 1 . / 64 .) ;
267+ *(d->vertices ++) = to->x * ( 1 . / 64 .) ;
268+ *(d->vertices ++) = to->y * ( 1 . / 64 .) ;
269269 *(d->codes ++) = CURVE3;
270270 *(d->codes ++) = CURVE3;
271271 }
@@ -279,12 +279,12 @@ ft_outline_cubic_to(
279279{
280280 ft_outline_decomposer* d = reinterpret_cast <ft_outline_decomposer*>(user);
281281 if (d->codes ) {
282- *(d->vertices ++) = c1->x / 64 .;
283- *(d->vertices ++) = c1->y / 64 .;
284- *(d->vertices ++) = c2->x / 64 .;
285- *(d->vertices ++) = c2->y / 64 .;
286- *(d->vertices ++) = to->x / 64 .;
287- *(d->vertices ++) = to->y / 64 .;
282+ *(d->vertices ++) = c1->x * ( 1 . / 64 .) ;
283+ *(d->vertices ++) = c1->y * ( 1 . / 64 .) ;
284+ *(d->vertices ++) = c2->x * ( 1 . / 64 .) ;
285+ *(d->vertices ++) = c2->y * ( 1 . / 64 .) ;
286+ *(d->vertices ++) = to->x * ( 1 . / 64 .) ;
287+ *(d->vertices ++) = to->y * ( 1 . / 64 .) ;
288288 *(d->codes ++) = CURVE4;
289289 *(d->codes ++) = CURVE4;
290290 *(d->codes ++) = CURVE4;
@@ -485,13 +485,16 @@ void FT2Font::set_text(
485485{
486486 FT_Matrix matrix; /* transformation matrix */
487487
488- angle = angle / 360.0 * 2 * M_PI;
488+ angle = angle * ( 2 * M_PI / 360.0 ) ;
489489
490490 // this computes width and height in subpixels so we have to multiply by 64
491- matrix.xx = (FT_Fixed)(cos (angle) * 0x10000L );
492- matrix.xy = (FT_Fixed)(-sin (angle) * 0x10000L );
493- matrix.yx = (FT_Fixed)(sin (angle) * 0x10000L );
494- matrix.yy = (FT_Fixed)(cos (angle) * 0x10000L );
491+ double cosangle = cos (angle) * 0x10000L ;
492+ double sinangle = sin (angle) * 0x10000L ;
493+
494+ matrix.xx = (FT_Fixed)cosangle;
495+ matrix.xy = (FT_Fixed)-sinangle;
496+ matrix.yx = (FT_Fixed)sinangle;
497+ matrix.yy = (FT_Fixed)cosangle;
495498
496499 clear ();
497500
@@ -762,8 +765,8 @@ void FT2Font::draw_glyphs_to_bitmap(bool antialiased)
762765 // now, draw to our target surface (convert position)
763766
764767 // bitmap left and top in pixel, string bbox in subpixel
765- FT_Int x = (FT_Int)(bitmap->left - (bbox.xMin / 64 .));
766- FT_Int y = (FT_Int)((bbox.yMax / 64 .) - bitmap->top + 1 );
768+ FT_Int x = (FT_Int)(bitmap->left - (bbox.xMin * ( 1 . / 64 .) ));
769+ FT_Int y = (FT_Int)((bbox.yMax * ( 1 . / 64 .) ) - bitmap->top + 1 );
767770
768771 image.draw_bitmap (&bitmap->bitmap , x, y);
769772 }
@@ -782,8 +785,8 @@ void FT2Font::get_xys(bool antialiased, std::vector<double> &xys)
782785 FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyphs[n];
783786
784787 // bitmap left and top in pixel, string bbox in subpixel
785- FT_Int x = (FT_Int)(bitmap->left - bbox.xMin / 64 .);
786- FT_Int y = (FT_Int)(bbox.yMax / 64 . - bitmap->top + 1 );
788+ FT_Int x = (FT_Int)(bitmap->left - bbox.xMin * ( 1 . / 64 .) );
789+ FT_Int y = (FT_Int)(bbox.yMax * ( 1 . / 64 .) - bitmap->top + 1 );
787790 // make sure the index is non-neg
788791 x = x < 0 ? 0 : x;
789792 y = y < 0 ? 0 : y;
0 commit comments