locale_id_bi property
Font.locale_id_bi property
Gets or sets the locale identifier (language) of the formatted right-to-left characters.
@property
def locale_id_bi(self) -> int:
...
@locale_id_bi.setter
def locale_id_bi(self, value: int):
...
Remarks
For the list of locale identifiers see https://msdn.microsoft.com/en-us/library/cc233965.aspx
Examples
Shows how to define separate sets of font settings for right-to-left, and right-to-left text.
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
# Define a set of font settings for left-to-right text.
builder.font.name = 'Courier New'
builder.font.size = 16
builder.font.italic = False
builder.font.bold = False
builder.font.locale_id = 1033 # en-US
# Define another set of font settings for right-to-left text.
builder.font.name_bi = 'Andalus'
builder.font.size_bi = 24
builder.font.italic_bi = True
builder.font.bold_bi = True
builder.font.locale_id_bi = 4096 # ar-AR
# We can use the "bidi" flag to indicate whether the text we are about to add
# with the document builder is right-to-left. When we add text with this flag set to True,
# it will be formatted using the right-to-left set of font settings.
builder.font.bidi = True
builder.write('مرحبًا')
# Set the flag to "False", and then add left-to-right text.
# The document builder will format these using the left-to-right set of font settings.
builder.font.bidi = False
builder.write(' Hello world!')
doc.save(ARTIFACTS_DIR + 'Font.bidi.docx')
See Also
- module aspose.words
- class Font