This is a read-only mirror of pymolwiki.org
Difference between revisions of "Label font id"
Jump to navigation
Jump to search
m (Fixed Unicdoe) |
m (1 revision) |
(No difference)
|
Revision as of 02:16, 28 March 2014
Overview
Set which fonts PyMol uses to render labels. Font IDs 5—14 are normal fonts, while 15 and 16 are for unicode fonts (and can support many more characters).
Syntax
set label_font_id, 10 # use font no. 10
set label_font_id, 11 # use font no. 11
set label_font_id, 12 # use font no. 12
UTF-8 Fonts
Newer versions support UTF8 fonts; use label_font_id from above to 15 or 16. The good news about the UTF8 fonts is that they support the alpha and beta characters. (See image.)
Here's some example code for the image at right:
# roman
set label_font_id, 15
set label_shadow_mode, 3
label 5/CA, "\316\261-Helix"
label 10/CA, "\316\262-Sheet"
# italic
set label_font_id, 16
# make bigger
set label_size, 50
Unicode Fonts
PyMOL gives you the flexibility to use encoded unicode fonts. This allows us to insert various symbols, like the symbol used for Angstrom. Here are the steps to insert a character from the unicode character set.
- Find the code for your character at Unicode Charts. The Angstrom character, <math>\textrm{\AA}</math> is u"\u00c5" and <math>\pm</math> is u"\u00b1".
- Label the selection. For simple strings, just type the string in double quote, -- "like this" -- and append to the end of that .encode('utf-8') -- "like this".encode('utf-8'). A working example is shown here,
# label residue 30 with "4.1 Ang^2 +/- 0.65 Ang^2; see the image at right
label i. 30, "4.1" + u"\u00c5\u00b2 \u00b1 0.65 \u00c5\u00b2 ".encode('utf-8')