diff --git a/odex25_transactions/cm_odex_barcode/models/barcode.py b/odex25_transactions/cm_odex_barcode/models/barcode.py index 94e57c704..d3a061b40 100644 --- a/odex25_transactions/cm_odex_barcode/models/barcode.py +++ b/odex25_transactions/cm_odex_barcode/models/barcode.py @@ -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)