This is a read-only mirror of pymolwiki.org
Difference between revisions of "Label font id"
Jump to navigation
Jump to search
m (1 revision) |
m (6 revisions) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | The [[label_font_id]] setting sets the typeface (font family) for atom [[label|labels]]. | |
− | |||
== Syntax == | == Syntax == | ||
+ | |||
<source lang="python"> | <source lang="python"> | ||
− | + | # use "Serif Bold" font family | |
− | set label_font_id, | + | set label_font_id, 10 |
− | |||
</source> | </source> | ||
− | == | + | == Available Font Families == |
− | [[ | + | |
+ | ''Font IDs 0-4 were fixed size GLUT fonts, their support was dropped in PyMOL 1.6.'' | ||
+ | |||
+ | {| class="wikitable" | ||
+ | !Name!!label_font_id | ||
+ | |- | ||
+ | |Sans||5 | ||
+ | |- | ||
+ | |Sans Oblique||6 | ||
+ | |- | ||
+ | |Sans Bold||7 | ||
+ | |- | ||
+ | |Sans Bold Oblique||8 | ||
+ | |- | ||
+ | |Serif||9 | ||
+ | |- | ||
+ | |Serif Oblique||17 | ||
+ | |- | ||
+ | |Serif Bold||10 | ||
+ | |- | ||
+ | |Serif Bold Oblique||18 | ||
+ | |- | ||
+ | |Mono||11 | ||
+ | |- | ||
+ | |Mono Oblique||12 | ||
+ | |- | ||
+ | |Mono Bold||13 | ||
+ | |- | ||
+ | |Mono Bold Oblique||14 | ||
+ | |- | ||
+ | |Gentium Roman||15 | ||
+ | |- | ||
+ | |Gentium Italic||16 | ||
+ | |} | ||
+ | |||
+ | == Special Characters == | ||
+ | |||
+ | Several [http://www.unicode.org/ Unicode] characters are supported. | ||
+ | They can be entered with [https://docs.python.org/2/howto/unicode.html#unicode-literals-in-python-source-code unicode literals] as 4-digit hexadecimal escape sequences. | ||
+ | |||
+ | '''Example characters''' (find the code for your character at [http://www.unicode.org/charts Unicode Charts]): | ||
+ | |||
+ | {| class="wikitable" | ||
+ | !Code!!Character!!Name | ||
+ | |- | ||
+ | |<code>u"\u03b1"</code>||α||Alpha | ||
+ | |- | ||
+ | |<code>u"\u03b2"</code>||β||Beta | ||
+ | |- | ||
+ | |<code>u"\u00c5"</code>||Å||Ångström | ||
+ | |- | ||
+ | |<code>u"\u00b1"</code>||±||plus/minus | ||
+ | |- | ||
+ | |<code>u"\u00b2"</code>||²||superscript 2 | ||
+ | |} | ||
+ | |||
+ | == Example 1 == | ||
− | + | [[Image:New_fonts.jpeg|thumb|The alpha and beta are Unicode characters.]] | |
− | |||
<source lang="python"> | <source lang="python"> | ||
− | # | + | # if Python is configured with utf-8 default encoding (all incentive builds) |
− | + | label 5/CA, u"\u03b1-Helix" | |
− | + | label 10/CA, u"\u03b2-Sheet" | |
− | label 5/CA, "\ | + | |
− | label 10/CA, "\ | + | # if Python is configured differently, explicit utf-8 encoding is necessary |
+ | label 5/CA, u"\u03b1-Helix".encode("utf-8") | ||
+ | label 10/CA, u"\u03b2-Sheet".encode("utf-8") | ||
# italic | # italic | ||
Line 27: | Line 83: | ||
# make bigger | # make bigger | ||
set label_size, 50 | set label_size, 50 | ||
+ | |||
+ | # cast shadows in ray tracing | ||
+ | set label_shadow_mode, 3 | ||
</source> | </source> | ||
− | == | + | == Example 2 == |
+ | |||
[[Image:Font_ex.png|300px|thumb|right|Notice the Angstrom and superscript 2 characters. You can add other characters as well.]] | [[Image:Font_ex.png|300px|thumb|right|Notice the Angstrom and superscript 2 characters. You can add other characters as well.]] | ||
− | |||
− | |||
− | |||
− | |||
<source lang="python"> | <source lang="python"> | ||
− | # label residue 30 with "4.1 Ang^2 +/- 0.65 Ang^2 | + | # label residue 30 with "4.1 Ang^2 +/- 0.65 Ang^2 |
− | label i. 30, "4.1" + u"\u00c5\u00b2 \u00b1 0.65 \u00c5\u00b2 " | + | label i. 30, "4.1" + u"\u00c5\u00b2 \u00b1 0.65 \u00c5\u00b2 " |
</source> | </source> | ||
+ | == See Also == | ||
+ | * [[label]] | ||
+ | * [[label_size]] | ||
+ | * [[label_shadow_mode]] | ||
[[Category:Settings|Label font id]] | [[Category:Settings|Label font id]] | ||
[[Category:Labeling|Label font id]] | [[Category:Labeling|Label font id]] |
Latest revision as of 01:14, 28 August 2017
The label_font_id setting sets the typeface (font family) for atom labels.
Syntax
# use "Serif Bold" font family
set label_font_id, 10
Available Font Families
Font IDs 0-4 were fixed size GLUT fonts, their support was dropped in PyMOL 1.6.
Name | label_font_id |
---|---|
Sans | 5 |
Sans Oblique | 6 |
Sans Bold | 7 |
Sans Bold Oblique | 8 |
Serif | 9 |
Serif Oblique | 17 |
Serif Bold | 10 |
Serif Bold Oblique | 18 |
Mono | 11 |
Mono Oblique | 12 |
Mono Bold | 13 |
Mono Bold Oblique | 14 |
Gentium Roman | 15 |
Gentium Italic | 16 |
Special Characters
Several Unicode characters are supported. They can be entered with unicode literals as 4-digit hexadecimal escape sequences.
Example characters (find the code for your character at Unicode Charts):
Code | Character | Name |
---|---|---|
u"\u03b1" |
α | Alpha |
u"\u03b2" |
β | Beta |
u"\u00c5" |
Å | Ångström |
u"\u00b1" |
± | plus/minus |
u"\u00b2" |
² | superscript 2 |
Example 1
# if Python is configured with utf-8 default encoding (all incentive builds)
label 5/CA, u"\u03b1-Helix"
label 10/CA, u"\u03b2-Sheet"
# if Python is configured differently, explicit utf-8 encoding is necessary
label 5/CA, u"\u03b1-Helix".encode("utf-8")
label 10/CA, u"\u03b2-Sheet".encode("utf-8")
# italic
set label_font_id, 16
# make bigger
set label_size, 50
# cast shadows in ray tracing
set label_shadow_mode, 3
Example 2
# label residue 30 with "4.1 Ang^2 +/- 0.65 Ang^2
label i. 30, "4.1" + u"\u00c5\u00b2 \u00b1 0.65 \u00c5\u00b2 "