Merge pull request #2368 from expsa/dev_odex25_transactions
Dev odex25 transactions
This commit is contained in:
commit
5f19849b43
|
|
@ -49,16 +49,17 @@ class Transaction(models.Model):
|
|||
def draw_text(draw, text, y_position, font):
|
||||
""" Draw centered Arabic text """
|
||||
reshaped_text = arabic_reshaper.reshape(text) # Fix Arabic character joining
|
||||
bidi_text = get_display(reshaped_text) # Fix right-to-left rendering
|
||||
|
||||
# Get text size
|
||||
text_bbox = draw.textbbox((0, 0), reshaped_text, font=font)
|
||||
text_bbox = draw.textbbox((0, 0), bidi_text, font=font)
|
||||
text_width = text_bbox[2] - text_bbox[0]
|
||||
|
||||
# Calculate x position for centering
|
||||
x_position = (image_width - text_width) // 2
|
||||
|
||||
# Draw text
|
||||
draw.text((x_position, y_position), reshaped_text, "black", font=font)
|
||||
draw.text((x_position, y_position), bidi_text, "black", font=font)
|
||||
|
||||
# Draw centered Arabic text
|
||||
draw_text(draw, "رقم المعاملة : " + (self.name or ''), 20, font)
|
||||
|
|
|
|||
Loading…
Reference in New Issue