Commits

Anonymous committed 37400b7

Fixed text size when rotating text.

  • Participants
  • Parent commits 63f9a19
  • Branches pgreloaded

Comments (0)

Files changed (3)

examples/freetype/sdlfont.py

     screen.fill (pygame2.Color (200, 200, 200))
     w, h, _ = font.render("Hello", pygame2.Color(100, 100, 100), None, screen, 100, 100, ptsize=48)
 
-    w, h, _ = font.render("World", pygame2.Color(200, 100, 100), pygame2.Color(255, 0xCC, 0), screen, 100, 200, ptsize=48, vertical = True, rotation = 45, antialias = False)
+    w, h, _ = font.render("World", pygame2.Color(200, 100, 100), pygame2.Color(255, 0xCC, 0), screen, 100, 200, ptsize=48, vertical = False, rotation = 0, antialias = True)
 
 #    w, g, buf = font.render("Hello World, Jay",
 #            pygame2.Color(100, 200, 32),

src/freetype/ft_metrics.c

 
     if (render->matrix)
     {   
-        FT_Vector_Rotate(&size, render->_rotation_angle);
+        size.x = MAX(size.x, size.y);
+        size.y = MAX(size.x, size.y);
     }
 
     text->text_size.x = PGFT_TRUNC(PGFT_ROUND(ABS(size.x)));

src/freetype/ft_render.c

     mode->autohint = 0;
     mode->antialias = (FT_Byte)antialias;
     mode->matrix = NULL;
+    mode->_rotation_angle = 0;
 
     if (angle != 0)
     {
     assert(text->text_size.x);
     assert(text->text_size.y);
 
-
-    if (render->_rotation_angle)
+    if (render->matrix)
     {
         x += ((text->text_size.x + 1) & ~1) / 2;
         y += ((text->text_size.y + 1) & ~1) / 2;