MCPcopy Create free account
hub / github.com/a-e-k/canvas_ity / text_align

Function text_align

test/test.cpp:1604–1623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1602}
1603
1604void text_align( canvas &that, float width, float height )
1605{
1606 that.set_font( &font_a[ 0 ], static_cast< int >( font_a.size() ), 0.2f * height );
1607 that.rotate( 0.2f );
1608 that.set_color( fill_style, 0.0f, 0.0f, 0.0f, 1.0f );
1609 align_style const alignments[] = { leftward, center, rightward, start, ending };
1610 for ( int index = 0; index < 5; ++index )
1611 {
1612 float base = ( 0.1f + 0.2f * static_cast< float >( index ) ) * height;
1613 that.text_align = alignments[ index ];
1614 that.fill_text( "HIty", 0.5f * width, base );
1615 }
1616 that.set_color( stroke_style, 1.0f, 0.0f, 0.0f, 0.5f );
1617 that.set_line_width( 1.0f );
1618 that.move_to( 0.0f, 0.5f * height );
1619 that.line_to( width, 0.5f * height );
1620 that.move_to( 0.5f * width, 0.0f );
1621 that.line_to( 0.5f * width, height );
1622 that.stroke();
1623}
1624
1625void text_baseline( canvas &that, float width, float height )
1626{

Callers

nothing calls this directly

Calls 8

set_fontMethod · 0.80
rotateMethod · 0.80
set_colorMethod · 0.80
fill_textMethod · 0.80
set_line_widthMethod · 0.80
move_toMethod · 0.80
line_toMethod · 0.80
strokeMethod · 0.80

Tested by

no test coverage detected