GetDrawFormatStringWidthを使用して文字列を右揃えをしようと思ったのですが上手く揃いません。
例
DrawFormatStringToHandle( 400 - GetDrawFormatStringWidth( "%d", 1 ), 0, GetColor( 0, 0, 0 ), font_handle, "%d", 1 );
DrawFormatStringToHandle( 400 - GetDrawFormatStringWidth( "%d", 12 ), 20, GetColor( 0, 0, 0 ), font_handle, "%d", 12 );
DrawFormatStringToHandle( 400 - GetDrawFormatStringWidth( "%d", 123 ), 40, GetColor( 0, 0, 0 ), font_handle, "%d", 123 );
DrawFormatStringToHandle( 400 - GetDrawFormatStringWidth( "%d", 123456789 ), 0, GetColor( 0, 0, 0 ), font_handle, "%d", 123456789 );
DrawFormatStringToHandle( 400 - GetDrawFormatStringWidth( "%s", "テスト" ), 60, GetColor( 0, 0, 0 ), font_handle, "%d", "%s", "テスト" );
※フォントサイズ:16、フォント名:メイリオ
上記のコードだと各行の右端がX:400に揃うと思っていたのですが、
実際には文字列のサイズが長くなるほど右側に微妙にずれていってます。
もし右揃えのやり方が良くないのであれば、上手く行く方法を教えて頂けたらありがたいです。
よろしくお願いします。