Typo ;)
[phpCairo.git] / testcases / phpCairo / bitmap-font.php
blob266a157c0e90542b9b4918045b2dfa3819c9e2e8
1 <?
2 $width = 247;
3 $height = 26;
4 $sur = new CairoImageSurface(FORMAT_ARGB32, $width, $height);
5 $con = new CairoContext($sur);
6 $con->select_font_face("6x13.pcf");
7 $con->set_font_size(11.5);
8 $fo = new CairoFontOptions();
9 $fo->set_hint_metrics(HINT_METRICS_ON);
10 $con->set_font_options($fo);
11 $fe = $con->font_extents();
12 $con->move_to(1,$fe["ascent"] - 1);
13 $con->set_source_rgb(0,0,1);
14 $fo->set_hint_style(HINT_STYLE_NONE);
15 $con->set_font_options($fo);
16 $con->show_text("the ");
17 $fo->set_hint_style(HINT_STYLE_SLIGHT);
18 $con->set_font_options($fo);
19 $con->show_text("quick ");
20 $fo->set_hint_style(HINT_STYLE_MEDIUM);
21 $con->set_font_options($fo);
22 $con->show_text("brown");
23 $fo->set_hint_style(HINT_STYLE_FULL);
24 $con->set_font_options($fo);
25 $con->show_text(" fox");
27 $con->text_path(" jumps over a lazy dog");
28 $con->fill();
30 $con->translate($width, $height);
31 $con->rotate(M_PI);
33 $con->move_to(1, $fe["height"]-$fe["descent"]-1);
34 $fo->set_hint_metrics(HINT_METRICS_OFF);
35 $fo->set_hint_style(HINT_STYLE_NONE);
36 $con->set_font_options($fo);
37 $con->show_text("the ");
38 $fo->set_hint_style(HINT_STYLE_SLIGHT);
39 $con->set_font_options($fo);
40 $con->show_text("quick");
41 $fo->set_hint_style(HINT_STYLE_MEDIUM);
42 $con->set_font_options($fo);
43 $con->show_text(" brown");
44 $fo->set_hint_style(HINT_STYLE_FULL);
45 $con->set_font_options($fo);
46 $con->show_text(" fox");
48 $con->text_path(" jumps over");
49 $con->text_path(" a lazy dog");
50 $con->fill();
51 $sur->write_to_png("bitmap-font-php.png");