| 383 | // text |
| 384 | struct TestText : public TestBase { |
| 385 | virtual void run( fli::cairo::Context &ctx ) { |
| 386 | ctx.selectFontFace( "Batang", fli::cairo::FONT_SLANT_NORMAL, fli::cairo::FONT_WEIGHT_BOLD ); |
| 387 | ctx.setFontSize( 90.0 ); |
| 388 | |
| 389 | ctx.moveTo( 10.0, 135.0 ); |
| 390 | ctx.showText( "Hello" ); |
| 391 | |
| 392 | ctx.moveTo( 70.0, 165.0 ); |
| 393 | |
| 394 | // This code crashes PDF on the Mac |
| 395 | // fli::cairo::FontFace *otherFont = new fli::cairo::FontFace( "Baskerville" ); |
| 396 | // cairo_set_font_face( ctx.getCairo(), cf ); |
| 397 | |
| 398 | ctx.textPath( "World" ); |
| 399 | ctx.setSourceRgb( 0.5, 0.5, 1 ); |
| 400 | ctx.fillPreserve(); |
| 401 | ctx.setSourceRgb( 0, 0, 0 ); |
| 402 | ctx.setLineWidth( 2.56 ); |
| 403 | ctx.stroke(); |
| 404 | |
| 405 | // draw helping lines |
| 406 | ctx.setSourceRgba( 1, 0.2, 0.2, 0.6 ); |
| 407 | ctx.arc( 10.0, 135.0, 5.12, 0, 2 * M_PI ); |
| 408 | ctx.closePath(); |
| 409 | ctx.arc( 70.0, 165.0, 5.12, 0, 2 * M_PI ); |
| 410 | ctx.fill(); |
| 411 | } |
| 412 | }; |
| 413 | |
| 414 | // text align center |
nothing calls this directly
no test coverage detected