|
We are
excited to introduce new TrueType
fonts into CDAT.
The font
number is now
not limited to 9, but it is unlimited.
By default the fonts are loaded from your PCMDI_GRAPHICS
directory. But you can also add you own fonts dynamically when running
the application.
Here are
the default fonts distributed with CDAT and their
correspondent
numbers:
nt
#
|
Name
|
Comments |
| 1 |
Default
|
|
| 2 |
Clarendon |
|
| 3 |
Courier |
|
| 4 |
Helvetica |
|
| 5 |
Adelon |
|
| 6 |
Times |
|
| 7 |
Arabic |
|
| 8 |
Chinese |
|
| 9 |
Greek |
|
| 10 |
Hebrew |
|
| 11
|
Russian |
|
| 12 |
Maths1 |
Equivalence
Symbols |
| 13 |
Maths2 |
Brackets,
Square roots, Sum, Products, ...
|
| 14 |
Maths3 |
Integrals, astro
symbols
|
| 15 |
Maths4 |
Misc, causality
symbols |
| 16 |
AvantGarde |
|
Here are the functions you can
use to modify fonts:
>>>
x.addfont(path,name)
Load a font file specified via path and associates it with the name
"name"
*) If name is empty then the font name stored in the font file is used
*) If path pints to a
directory then all font files (.ttf) in this directory are loaded and
associated with their name in the file
*) additionally for directory loading you can specifiy "r" as secand
arguments (instead of name) to browse recursively
>>>
x.listelements("font")
returns a list of all fonts loaded into CDAT and available to the user
>>> x.setdefaultfont("myfont")
# or number
switches your font with font number 1, useful to simply change the font
w/o editing all templates
>>> x.switchfont(font1,font2)
# switch font numbers
these allows you for example to make sure that your font named "myfont"
always has number 4 (since template refer to font number and not name)
>>>
x.switchfonts("myfont",4)
>>> x.getfontnumber("myfont")
# returns number associated with font name
>>> x.getfontname(4)
# returns name associated with font number
>>>
x.getfont(arg)
# returns either the font name or number associated with a number/name
>>> x.gettextextent(tx)
# where tx is a text object, returns the surrounding box for each
string drawn by the object
Usefull to
place string with different fonts next to each other, or for equations
building
Example
creating a text in vcs
to=x.createtextorientation('my')
to.height=50
tmpl=x.createtemplate()
tmpl.legend.textorientation=to
x.plot(s,tmpl)
to.list()
you
can control, path and angle as well
----------Text
Orientation (To) member (attribute) listings ----------
Canvas
Mode = 1
secondary
method = To
name
= my
height
= 50
angle
= 0
path
= right
halign
= left
valign
= half
same
with texttable to control the font value and color
tt=x.createtexttable('my')
tt.list()
----------Text
Table (Tt) member (attribute) listings ----------
Canvas
Mode = 1
secondary
method = Tt
name
= my
font
= 1
spacing
= 2
expansion
= 100
color
= 241
fillincolor
= 240
s=f('clt',slice(0,12),latitude=(0,0,'cob'),squeeze=1,order='xt')
iso=x.createisofill()
dict
= {}
a
= cdtime.comptime(1979,4)
dict[a.torel('months
since 1979').value] = 'April 1974'
iso.xticlabels1=dict
x.plot(s,iso)
|