From 097586cab016c10cfaefb3cf283355f74889a27d Mon Sep 17 00:00:00 2001 From: leon Date: Wed, 26 Oct 2016 13:38:54 +0800 Subject: [PATCH] east asia, chinese font family --- docx/oxml/text/font.py | 22 ++++++++++++++++++++++ docx/text/font.py | 1 + 2 files changed, 23 insertions(+) diff --git a/docx/oxml/text/font.py b/docx/oxml/text/font.py index 810ec2b30..eeb61c5a0 100644 --- a/docx/oxml/text/font.py +++ b/docx/oxml/text/font.py @@ -32,6 +32,7 @@ class CT_Fonts(BaseOxmlElement): """ ascii = OptionalAttribute('w:ascii', ST_String) hAnsi = OptionalAttribute('w:hAnsi', ST_String) + eastAsia = OptionalAttribute('w:eastAsia', ST_String) class CT_Highlight(BaseOxmlElement): @@ -138,6 +139,27 @@ def rFonts_ascii(self, value): rFonts = self.get_or_add_rFonts() rFonts.ascii = value + @property + def rFonts_eastAsia(self): + """ + The value of `w:rFonts/@w:eastAsia` or |None| if not present. Represents + the assigned typeface name. The rFonts element also specifies other + special-case typeface names; this method handles the case where just + the common name is required. + """ + rFonts = self.rFonts + if rFonts is None: + return None + return rFonts.eastAsia + + @rFonts_eastAsia.setter + def rFonts_eastAsia(self, value): + if value is None: + self._remove_rFonts() + return + rFonts = self.get_or_add_rFonts() + rFonts.eastAsia = value + @property def rFonts_hAnsi(self): """ diff --git a/docx/text/font.py b/docx/text/font.py index 162832101..55cda1df5 100644 --- a/docx/text/font.py +++ b/docx/text/font.py @@ -196,6 +196,7 @@ def name(self, value): rPr = self._element.get_or_add_rPr() rPr.rFonts_ascii = value rPr.rFonts_hAnsi = value + rPr.rFonts_eastAsia = value @property def no_proof(self):