MCPcopy Create free account
hub / github.com/cinder/Cinder / run

Method run

test/cairoTest/cairoTest.cpp:445–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443// text extents
444struct TestTextExtents : public TestBase {
445 virtual void run( fli::cairo::Context &ctx ) {
446 const std::string text = "cairo";
447 double x,y;
448
449 ctx.selectFontFace( "Sans", fli::cairo::FONT_SLANT_NORMAL, fli::cairo::FONT_WEIGHT_NORMAL );
450
451 ctx.setFontSize( 100.0 );
452 fli::cairo::TextExtents extents = ctx.textExtents( text );
453 x = 25.0;
454 y = 150.0;
455
456 ctx.moveTo( x, y );
457 ctx.showText( text );
458
459 // draw helping lines
460 ctx.setSourceRgba( 1, 0.2, 0.2, 0.6 );
461 ctx.setLineWidth( 6.0 );
462 ctx.arc( x, y, 10.0, 0, 2 * M_PI );
463 ctx.fill();
464 ctx.moveTo( x, y );
465 ctx.relLineTo( 0, -extents.height() );
466 ctx.relLineTo( extents.width(), 0 );
467 ctx.relLineTo( extents.xBearing(), -extents.yBearing() );
468 ctx.stroke();
469 }
470};
471
472int main( int argc, char **argv )

Callers

nothing calls this directly

Calls 13

selectFontFaceMethod · 0.80
setFontSizeMethod · 0.80
textExtentsMethod · 0.80
showTextMethod · 0.80
setSourceRgbaMethod · 0.80
setLineWidthMethod · 0.80
relLineToMethod · 0.80
heightMethod · 0.80
strokeMethod · 0.80
moveToMethod · 0.45
arcMethod · 0.45
fillMethod · 0.45

Tested by

no test coverage detected