ooodev.format.inner.direct.write.char.font.font module
Module for managing character fonts.
New in version 0.9.0.
- class ooodev.format.inner.direct.write.char.font.font.Font(*, b=None, i=None, u=None, bg_color=None, bg_transparent=None, charset=None, color=None, family=None, name=None, overline=None, rotation=None, shadow_fmt=None, shadowed=None, size=None, slant=None, spacing=None, strike=None, subscript=None, superscript=None, underline=None, weight=None, word_mode=None)[source]
Bases:
StyleBase
Character Font
Any properties starting with
prop_
set or get current instance values.All methods starting with
fmt_
can be used to chain together font properties.Many properties such as
bold
,italic
,underline
can be chained together.Example
# chaining fonts together to add new properties ft = Font().bold.italic.underline ft_color = Font().style_color(CommonColor.GREEN).style_bg_color(CommonColor.LIGHT_BLUE)
See also
New in version 0.9.0.
- __init__(*, b=None, i=None, u=None, bg_color=None, bg_transparent=None, charset=None, color=None, family=None, name=None, overline=None, rotation=None, shadow_fmt=None, shadowed=None, size=None, slant=None, spacing=None, strike=None, subscript=None, superscript=None, underline=None, weight=None, word_mode=None)[source]
Font options used in styles.
- Parameters:
b (bool, optional) – Shortcut to set
weight
to bold.i (bool, optional) – Shortcut to set
slant
to italic.u (bool, optional) – Shortcut ot set
underline
to underline.bg_color (
Color
, optional) – The value of the text background color.bg_transparent (bool, optional) – Determines if the text background color is set to transparent.
charset (CharSetEnum, optional) – The text encoding of the font.
color (
Color
, optional) – The value of the text color. Setting to-1
will cause automatic color.family (FontFamilyEnum, optional) – Font Family.
name (str, optional) – This property specifies the name of the font style. It may contain more than one name separated by comma.
overline (FontLine, optional) – Character overline values.
rotation (int, Angle, optional) – Specifies the rotation of a character in degrees. Depending on the implementation only certain values may be allowed.
shadow_fmt (ShadowFormat | None) – (ShadowFormat, optional): Determines the type, color, and width of the shadow.
shadowed (bool, optional) – Specifies if the characters are formatted and displayed with a shadow effect.
size (float, UnitT, optional) – This value contains the size of the characters in
pt
(point) units or Class UnitT.slant (FontSlant, optional) – The value of the posture of the document such as
FontSlant.ITALIC
.spacing (CharSpacingKind, float, UnitT, optional) – Specifies character spacing in
pt
(point) units or Class UnitT.strike (FontStrikeoutEnum, optional) – Determines the type of the strike out of the character.
subscript (bool, optional) – Subscript option.
superscript (bool, optional) – Superscript option.
underline (FontLine, optional) – Character underline values.
weight (FontWeightEnum, float, optional) – The value of the font weight.
word_mode (bool, optional) – If
True
, the underline and strike-through properties are not applied to white spaces.
- Return type:
None
See also
- apply(obj: Any)[source]
- apply(obj: Any, **kwargs)
- apply(obj, **kwargs)
Applies styles to object
- Parameters:
obj (object) – UNO object that has supports
com.sun.star.style.CharacterProperties
service.- Return type:
None
- fmt_bg_color(value=None)[source]
Get copy of instance with text background color set or removed.
- Parameters:
value (
Color
, optional) – The text background color. IfNone
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_bg_transparent(value=None)[source]
Get copy of instance with text background transparency set or removed.
- Parameters:
value (bool, optional) – The text background transparency. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_charset(value=None)[source]
Gets a copy of instance with charset set or removed.
- Parameters:
value (CharSetEnum, optional) – The text encoding of the font. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_color(value=None)[source]
Get copy of instance with text color set or removed.
- Parameters:
value (
Color
, optional) – The text color. IfNone
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_family(value=None)[source]
Gets a copy of instance with charset set or removed.
- Parameters:
value (FontFamilyEnum, optional) – The Font Family. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_name(value=None)[source]
Get copy of instance with name set or removed.
- Parameters:
value (str, optional) – The name of the font style. It may contain more than one name separated by comma. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_overline(value=None)[source]
Get copy of instance with overline set or removed.
- Parameters:
value (FontUnderlineEnum, optional) – The size of the characters in point units. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_overline_color(value=None)[source]
Get copy of instance with text overline color set or removed.
- Parameters:
value (
Color
, optional) – The color is used for an overline. IfNone
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_shadow_fmt(value=None)[source]
Get copy of instance with shadow format set or removed.
- Parameters:
value (ShadowFormat, optional) – The type, color, and width of the shadow. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_size(value=None)[source]
Get copy of instance with text size set or removed.
- Parameters:
value (float, UnitT, optional) – The size of the characters in
pt
(point) units Class UnitT. IfNone
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_slant(value=None)[source]
Get copy of instance with slant set or removed.
- Parameters:
value (FontSlant, optional) – The value of the posture of the document such as
FontSlant.ITALIC
. IfNone
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
Note
This method changes or removes any italic settings.
- fmt_spacing(value=None)[source]
Get copy of instance with spacing set or removed.
- Parameters:
value (float, UnitT, optional) – The character spacing in
pt
(point) units Class UnitT. IfNone
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_strike(value=None)[source]
Get copy of instance with strike set or removed.
- Parameters:
value (FontStrikeoutEnum, optional) – The type of the strike out of the character. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_subscript(value=None)[source]
Get copy of instance with text subscript set or removed.
- Parameters:
value (bool, optional) – The subscript. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_superscript(value=None)[source]
Get copy of instance with text superscript set or removed.
- Parameters:
value (bool, optional) – The superscript. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_underline(value=None)[source]
Get copy of instance with underline set or removed.
- Parameters:
value (FontUnderlineEnum, optional) – The value for the character underline. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_underline_color(value=None)[source]
Gets copy of instance with text underline color set or removed.
- Parameters:
value (
Color
, optional) – The color is used for an underline. IfNone
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- fmt_weight(value=None)[source]
Get copy of instance with weight set or removed.
- Parameters:
value (FontWeightEnum, optional) – The value of the font weight. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
Note
This method changes or removes any bold settings.
- fmt_word_mode(value=None)[source]
Get copy of instance with word mode set or removed.
The underline and strike-through properties are not applied to white spaces when set to
True
.- Parameters:
value (bool, optional) – The word mode. If
None
style is removed. DefaultNone
self (_TFont) –
- Returns:
Font with style added or removed
- Return type:
- property bg_transparent: _TFont
Gets copy of instance with background transparent set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property bold: _TFont
Gets copy of instance with bold set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property italic: _TFont
Gets copy of instance with italic set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property overline: _TFont
Gets copy of instance with overline set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property prop_bg_color: Color | None
This property contains the text background color.
- Return type:
Color | None
- property prop_bg_color_transparent: bool | None
This property contains the text background color.
- Return type:
bool | None
- property prop_charset: CharSetEnum | None
This property contains the text encoding of the font.
- Return type:
CharSetEnum | None
- property prop_color: Color | None
This property contains the value of the text color.
- Return type:
Color | None
- property prop_family: FontFamilyEnum | None
This property contains font family.
- Return type:
FontFamilyEnum | None
- property prop_format_kind: FormatKind
Gets the kind of style
- Return type:
- property prop_is_bold: bool
Specifies bold
- Return type:
bool
- property prop_is_italic: bool | None
Specifies italic
- Return type:
bool | None
- property prop_is_underline: bool | None
Specifies underline
- Return type:
bool | None
- property prop_name: str | None
This property specifies the name of the font style. It may contain more than one name separated by comma.
- Return type:
str | None
- property prop_overline: FontLine
This property contains the value for the character overline.
- Return type:
- property prop_rotation: Angle | None
This optional property determines the rotation of a character in degrees.
Depending on the implementation only certain values may be allowed.
- Return type:
Angle | None
- property prop_shadow_fmt: ShadowFormat | None
This property specifies the type, color, and width of the shadow.
- Return type:
ShadowFormat | None
- property prop_shadowed: bool | None
This property specifies if the characters are formatted and displayed with a shadow effect.
- Return type:
bool | None
- property prop_size: UnitPT | None
This value contains the size of the characters in
pt
(point) units.- Return type:
UnitPT | None
- property prop_slant: FontSlant | None
This property contains the value of the posture of the document such as
FontSlant.ITALIC
- Return type:
FontSlant | None
- property prop_spacing: UnitPT | None
This value contains character spacing in
pt
(point) units- Return type:
UnitPT | None
- property prop_strike: FontStrikeoutEnum | None
This property determines the type of the strike out of the character.
- Return type:
FontStrikeoutEnum | None
- property prop_subscript: bool | None
Specifies if the font is sub script
- Return type:
bool | None
- property prop_superscript: bool | None
Specifies if the font is super script
- Return type:
bool | None
- property prop_underline: FontLine
This property contains the value for the character underline.
- Return type:
- property prop_weight: FontWeightEnum | None
This property contains the value of the font weight.
- Return type:
FontWeightEnum | None
- property prop_word_mode: bool | None
If this property is
True
, the underline and strike-through properties are not applied to white spaces.- Return type:
bool | None
- property shadowed: _TFont
Gets copy of instance with shadow set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property spacing_loose: _TFont
Gets copy of instance with spacing set to loose value
- Return type:
TypeVar
(_TFont
, bound= Font)
- property spacing_normal: _TFont
Gets copy of instance with spacing set to normal value
- Return type:
TypeVar
(_TFont
, bound= Font)
- property spacing_tight: _TFont
Gets copy of instance with spacing set to tight value
- Return type:
TypeVar
(_TFont
, bound= Font)
- property spacing_very_loose: _TFont
Gets copy of instance with spacing set to very loose value
- Return type:
TypeVar
(_TFont
, bound= Font)
- property spacing_very_tight: _TFont
Gets copy of instance with spacing set to very tight value
- Return type:
TypeVar
(_TFont
, bound= Font)
- property strike: _TFont
Gets copy of instance with strike set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property subscript: _TFont
Gets copy of instance with sub script set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property superscript: _TFont
Gets copy of instance with super script set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property underline: _TFont
Gets copy of instance with underline set
- Return type:
TypeVar
(_TFont
, bound= Font)
- property word_mode: _TFont
Gets copy of instance with word mode set
- Return type:
TypeVar
(_TFont
, bound= Font)