/usr/lib/python3/dist-packages/openpyxl/styles/fonts.py is in python3-openpyxl 2.3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.descriptors import Alias
from openpyxl.descriptors.nested import (
NestedValue,
NestedBool,
NestedNoneSet,
NestedMinMax,
NestedString,
NestedInteger,
NestedFloat,
)
from .hashable import HashableObject
from .colors import ColorDescriptor, BLACK
from openpyxl.compat import safe_string
from openpyxl.xml.functions import Element, SubElement
def _no_value(tagname, value, namespace=None):
if value:
return Element(tagname, val=safe_string(value))
class Font(HashableObject):
"""Font options used in styles."""
UNDERLINE_DOUBLE = 'double'
UNDERLINE_DOUBLE_ACCOUNTING = 'doubleAccounting'
UNDERLINE_SINGLE = 'single'
UNDERLINE_SINGLE_ACCOUNTING = 'singleAccounting'
name = NestedString()
charset = NestedInteger(allow_none=True)
family = NestedMinMax(min=0, max=14)
sz = NestedFloat()
size = Alias("sz")
b = NestedBool(to_tree=_no_value)
bold = Alias("b")
i = NestedBool(to_tree=_no_value)
italic = Alias("i")
strike = NestedBool(to_tree=_no_value)
strikethrough = Alias("strike")
outline = NestedBool(to_tree=_no_value)
shadow = NestedBool(to_tree=_no_value)
condense = NestedBool(to_tree=_no_value)
extend = NestedBool(to_tree=_no_value)
u = NestedNoneSet(values=('single', 'double', 'singleAccounting',
'doubleAccounting'))
underline = Alias("u")
vertAlign = NestedNoneSet(values=('superscript', 'subscript', 'baseline'))
color = ColorDescriptor()
scheme = NestedNoneSet(values=("major", "minor"))
tagname = "font"
__elements__ = ('name', 'charset', 'family', 'b', 'i', 'strike', 'outline',
'shadow', 'condense', 'color', 'extend', 'sz', 'u', 'vertAlign',
'scheme')
__fields__ = __elements__
def __init__(self, name='Calibri', sz=11, b=False, i=False, charset=None,
u=None, strike=False, color=BLACK, scheme=None, family=2, size=None,
bold=None, italic=None, strikethrough=None, underline=None,
vertAlign=None, outline=False, shadow=False, condense=False,
extend=False):
self.name = name
self.family = family
if size is not None:
sz = size
self.sz = sz
if bold is not None:
b = bold
self.b = b
if italic is not None:
i = italic
self.i = i
if underline is not None:
u = underline
self.u = u
if strikethrough is not None:
strike = strikethrough
self.strike = strike
self.color = color
self.vertAlign = vertAlign
self.charset = charset
self.outline = outline
self.shadow = shadow
self.condense = condense
self.extend = extend
self.scheme = scheme
from . colors import Color
DEFAULT_FONT = Font(color=Color(theme=1), scheme="minor")
|