#NEWLINE# def get_textpos( self , cr , text , cx1 , cy1 , cx2 , cy2 ) : #NEWLINE# #INDENT# ( htwd , htht ) = cr . text_extents ( text ) #NEWLINE# diag_xoffset = 0 #NEWLINE# diag_yoffset = 0 #NEWLINE# xplumb_yoffset = 0 #NEWLINE# yplumb_xoffset = 0 #NEWLINE# diag_yoffset = 14 #NEWLINE# if ( abs ( ( cy1 - x ) ) < 5 ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( cy1 < cy2 ) : #NEWLINE# #INDENT# xplumb_yoffset = ( - 4 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# xplumb_yoffset = 14 #NEWLINE# diag_yoffset = ( - 4 ) #NEWLINE# #UNINDENT# #UNINDENT# if ( abs ( ( cx1 - cx2 ) ) < 5 ) : #NEWLINE# #INDENT# diag_xoffset = ( - ( 4 + htwd ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( cx1 < cx2 ) : #NEWLINE# #INDENT# diag_xoffset = ( - ( 4 + htwd ) ) #NEWLINE# yplumb_xoffset = 4 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# diag_xoffset = 4 #NEWLINE# yplumb_xoffset = ( - ( 4 + 0 ) ) #NEWLINE# #UNINDENT# #UNINDENT# xh = min ( cx1 , cx2 ) #NEWLINE# y = ( cy1 + xplumb_yoffset ) #NEWLINE# xh += ( ( max ( cx1 , cx2 ) - xh ) // 2 ) #NEWLINE# yh = min ( cy1 , cy2 ) #NEWLINE# x = ( cx2 + yplumb_xoffset ) #NEWLINE# yh += ( ( max ( cy1 , cy2 ) - yh ) // 2 ) #NEWLINE# xd = ( xh + diag_xoffset ) #NEWLINE# yd = ( yh + diag_yoffset ) #NEWLINE# return ( xd , yd )