mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-01-03 01:04:12 +01:00
26 lines
969 B
Python
26 lines
969 B
Python
__license__ = 'GPL v3'
|
|
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
|
|
|
|
|
class Theme(object):
|
|
|
|
def __init__(self, namespace):
|
|
self.major_latin_font = 'Cambria'
|
|
self.minor_latin_font = 'Calibri'
|
|
self.namespace = namespace
|
|
|
|
def __call__(self, root):
|
|
for fs in self.namespace.XPath('//a:fontScheme')(root):
|
|
for mj in self.namespace.XPath('./a:majorFont')(fs):
|
|
for l in self.namespace.XPath('./a:latin[@typeface]')(mj):
|
|
self.major_latin_font = l.get('typeface')
|
|
for mj in self.namespace.XPath('./a:minorFont')(fs):
|
|
for l in self.namespace.XPath('./a:latin[@typeface]')(mj):
|
|
self.minor_latin_font = l.get('typeface')
|
|
|
|
def resolve_font_family(self, ff):
|
|
if ff.startswith('|'):
|
|
ff = ff[1:-1]
|
|
ff = self.major_latin_font if ff.startswith('major') else self.minor_latin_font
|
|
return ff
|