Here is a script so you can see if you like the effect of having a
non-monospaced font for non-code bodies. It only works for @language rest
nodes. Copy the script below into a node in your workbook. Run it with
CTRL-B. After that, any time you switch to an *@language rest* node, it
will use the alternate font. It hooks *select3* so it won't detect if you
change the *@language* directive until you switch nodes again.
STYLE = ('QTextBrowser {'
'font-family: Corbel, "Opens Sans","Sans-serif";'
'font-size: 12pt;}')
NOSTYLE = 'QTextBrowser {}'
DIRECT = '@language rest'
def set_alt_body_font(tag, keys):
c = keys['c']
css = NOSTYLE
for p in c.p.self_and_parents():
lines = p.b[:300].splitlines() # find directive if it's not in the
first line
has_direct = [True for line in lines if line.startswith(DIRECT)]
if DIRECT in p.h or has_direct:
css = STYLE
break
editor = c.frame.body.wrapper.widget
editor.setStyleSheet(css)
ud = g.user_dict
ud['alt_body_font_proc'] = set_alt_body_font
g.registerHandler('select3', ud['alt_body_font_proc'])
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/6290ba0e-7173-4849-8838-34033163f1adn%40googlegroups.com.