@@ -236,8 +236,8 @@ ft_outline_move_to(FT_Vector const* to, void* user)
236
236
*(d->vertices ++) = 0 ;
237
237
*(d->codes ++) = CLOSEPOLY;
238
238
}
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 .) ;
241
241
*(d->codes ++) = MOVETO;
242
242
}
243
243
d->index += d->index ? 2 : 1 ;
@@ -249,8 +249,8 @@ ft_outline_line_to(FT_Vector const* to, void* user)
249
249
{
250
250
ft_outline_decomposer* d = reinterpret_cast <ft_outline_decomposer*>(user);
251
251
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 .) ;
254
254
*(d->codes ++) = LINETO;
255
255
}
256
256
d->index ++;
@@ -262,10 +262,10 @@ ft_outline_conic_to(FT_Vector const* control, FT_Vector const* to, void* user)
262
262
{
263
263
ft_outline_decomposer* d = reinterpret_cast <ft_outline_decomposer*>(user);
264
264
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 .) ;
269
269
*(d->codes ++) = CURVE3;
270
270
*(d->codes ++) = CURVE3;
271
271
}
@@ -279,12 +279,12 @@ ft_outline_cubic_to(
279
279
{
280
280
ft_outline_decomposer* d = reinterpret_cast <ft_outline_decomposer*>(user);
281
281
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 .) ;
288
288
*(d->codes ++) = CURVE4;
289
289
*(d->codes ++) = CURVE4;
290
290
*(d->codes ++) = CURVE4;
@@ -485,13 +485,16 @@ void FT2Font::set_text(
485
485
{
486
486
FT_Matrix matrix; /* transformation matrix */
487
487
488
- angle = angle / 360.0 * 2 * M_PI;
488
+ angle = angle * ( 2 * M_PI / 360.0 ) ;
489
489
490
490
// 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;
495
498
496
499
clear ();
497
500
@@ -762,8 +765,8 @@ void FT2Font::draw_glyphs_to_bitmap(bool antialiased)
762
765
// now, draw to our target surface (convert position)
763
766
764
767
// 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 );
767
770
768
771
image.draw_bitmap (&bitmap->bitmap , x, y);
769
772
}
@@ -782,8 +785,8 @@ void FT2Font::get_xys(bool antialiased, std::vector<double> &xys)
782
785
FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyphs[n];
783
786
784
787
// 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 );
787
790
// make sure the index is non-neg
788
791
x = x < 0 ? 0 : x;
789
792
y = y < 0 ? 0 : y;
0 commit comments