PDA

View Full Version : Fonts


epopov
02-13-2004, 12:00 PM
Hi,
I want all text of my app to use custom fonts and only 1 text field to use default lps-2.0 fonts.
How to perform this?

antun
02-13-2004, 02:09 PM
As far as I know, the font attribute of view cascades, and canvas extends view, so you should be able to set the global font in the canvas, and override it where needed.

-Antun

epopov
02-14-2004, 01:41 AM
I understand it. But how to override the font. What is the name of default font?

antun
02-16-2004, 10:40 AM
The default font is Verity, but that's not its name in the runtime. You can use "default" (and set the fontsize to 8):


<canvas debug="true" font="myfont" fontsize="18">
<font name="myfont" src="timmonsr.ttf" />

<text>Hello, world!</text>

<view x="20" y="65" font="default" fontsize="8">
<text>Hello, world - in the default font!</text>
</view>
</canvas>


... or you can declare Vera (which scales to larger sizes quite well), and give it a name:


<font src="bitstream-vera-1.10/vera.ttf" name="mydefaultfont"/>


-Antun

sodanabe
07-21-2006, 09:32 AM
how can I change at runtime the fontsize of my whole application?
I tried canvas.setAttribute ("Fontsize", 14) for example, but it did not work. It works on text for example, but I would like the attribute to be recursively applied from the root.