Label font id: Difference between revisions

From PyMOLWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
== Overview ==
== Overview ==
Set which fonts PyMol uses to render labels.
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 ==
== Syntax ==
Line 9: Line 9:
</source>
</source>


Note: available font ids 10-16.
== UTF-8 Fonts ==
[[Image:New_fonts.jpeg|thumb|New fonts in PyMol.  Notice the alpha and beta characters.]]
 
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:
<source lang="python">
# 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
</source>
 
==Unicdoe Fonts==
[[Image:Font_ex.png|300px|thumb|right|Notice the Angstrom and superscript 2 characters.  You can add other characters as well.]]
 
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 [http://www.unicode.org/charts 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,
<source lang="python">
# 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')
</source>
 
 


[[Category:Settings|Label font id]]
[[Category:Settings|Label font id]]
[[Category:Labeling|Label font id]]
[[Category:Labeling|Label font id]]

Revision as of 20:23, 8 June 2009

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

New fonts in PyMol. Notice the alpha and beta characters.

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

Unicdoe Fonts

Notice the Angstrom and superscript 2 characters. You can add other characters as well.

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, is u"\u00c5" and 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')