MCPcopy Create free account
hub / github.com/PageBot/PageBot / _get_font

Method _get_font

Lib/pagebot/contexts/basecontext/babelstring.py:933–950  ·  view source on GitHub ↗

Answers the font that is defined in the current style. If the font is just a string, then find the font and answer it. Answers the default font, if the font name cannot be found. >>> from pagebot.contexts import getContext >>> context = getContext() >>> bs =

(self)

Source from the content-addressed store, hash-verified

931 hyphenation = property(_get_hyphenation, _set_hyphenation)
932
933 def _get_font(self):
934 """Answers the font that is defined in the current style. If the font
935 is just a string, then find the font and answer it. Answers the default
936 font, if the font name cannot be found.
937
938 >>> from pagebot.contexts import getContext
939 >>> context = getContext()
940 >>> bs = BabelString('ABCD', dict(font='PageBot-Regular'), context=context)
941 >>> bs.font
942 <Font PageBot-Regular>
943 >>> bs.font = 'Roboto-Regular'
944 >>> bs.font # Answer the new defined Font instance
945 <Font Roboto-Regular>
946 >>> bs = BabelString('ABCD', context=context)
947 >>> bs.font, isinstance(bs.font, Font) # Default font instance
948 (<Font PageBot-Regular>, True)
949 """
950 return self.getFont()
951
952 def _set_font(self, font):
953 assert isinstance(font, (str, Font))

Callers

nothing calls this directly

Calls 1

getFontMethod · 0.95

Tested by

no test coverage detected