fixed rtl italic formatting

This commit is contained in:
rana saab 2025-04-03 13:24:01 +03:00
parent b97fa32f10
commit 994da90f66

View File

@ -38,6 +38,8 @@ class RichText(object):
strike=False, strike=False,
font=None, font=None,
url_id=None, url_id=None,
rtl=False,
lang=None,
): ):
# If a RichText is added # If a RichText is added
@ -73,8 +75,12 @@ class RichText(object):
prop += '<w:vertAlign w:val="superscript"/>' prop += '<w:vertAlign w:val="superscript"/>'
if bold: if bold:
prop += "<w:b/>" prop += "<w:b/>"
if rtl:
prop += '<w:bCs/>'
if italic: if italic:
prop += "<w:i/>" prop += "<w:i/>"
if rtl:
prop += '<w:iCs/>'
if underline: if underline:
if underline not in [ if underline not in [
"single", "single",
@ -98,7 +104,10 @@ class RichText(object):
prop += '<w:rFonts w:ascii="{font}" w:hAnsi="{font}" w:cs="{font}"{regional_font}/>'.format( prop += '<w:rFonts w:ascii="{font}" w:hAnsi="{font}" w:cs="{font}"{regional_font}/>'.format(
font=font, regional_font=regional_font font=font, regional_font=regional_font
) )
if rtl:
prop += '<w:rtl w:val="true"/>'
if lang:
prop += '<w:lang w:val="%s"/>' % lang
xml = "<w:r>" xml = "<w:r>"
if prop: if prop:
xml += "<w:rPr>%s</w:rPr>" % prop xml += "<w:rPr>%s</w:rPr>" % prop