omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. captainunivac

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    captainunivac

    @captainunivac

    0
    Reputation
    460
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    captainunivac Unfollow Follow

    Latest posts made by captainunivac

    • RE: Draw_text is ignoring position and font_size parameters

      Thanks, @omz! Will do.

      posted in Pythonista
      captainunivac
      captainunivac
    • RE: Draw_text is ignoring position and font_size parameters

      @omz
      I have a workaround for the position issue, but the font_size issue is less tractable.

      def my_draw_text(txt, x, y, **kwargs):
      """ my_draw_text(txt, x, y, **kwargs):

      	The canvas.draw_text() method in this incarnation completely
      	ignores the x and y parameters and just uses (0, 0). This
      	function will use canvas.translate() to temporarily shift
      	the origin to the desired point, draw the text, and then
      	restore the gstate(). The keyword arguments (kwargs) are 
      	font_name and font_size as in the canvas.draw_text() definition.
      """
      canvas.save_gstate()
      canvas.translate(x, y)
      canvas.draw_text(txt, 0, 0, **kwargs)
      canvas.restore_gstate()
      
      posted in Pythonista
      captainunivac
      captainunivac
    • Draw_text is ignoring position and font_size parameters

      I am having problems with the canvas.draw_text() method. I have Pythonista 2.0 on an iPad and iPhone, and when I try to use the draw_text method it appears that the text is always drawn at (0, 0) in the current coordinate system. It also appears that the font_size parameter is ignored. This code on my implementation will draw the text with different fonts but with the same size and relative positions. What's up with that!

      coding: utf-8

      import canvas

      canvas.set_size(1000, 1000)
      canvas.translate(100, 100)
      canvas.draw_line(0 , 0, 50, 0)
      canvas.draw_line(0, 0, 0, 50)
      canvas.draw_text('Hello, World', 200, 200, font_name = 'Chalkduster', font_size = 64.0)
      canvas.translate(100, 100)
      canvas.draw_line(0 , 0, 50, 0)
      canvas.draw_line(0, 0, 0, 50)
      canvas.draw_text('Hello, World', 500, -200, font_name = 'Helvetica', font_size = 128.0)

      posted in Pythonista
      captainunivac
      captainunivac