332{
334 static const char long_text[] = "Example text to test clipping and other related things";
335 static const WCHAR long_textW[] =
L"Example text to test clipping and other related things";
336 static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
337 static const struct
338 {
339 int font_height;
340 unsigned int expected_size;
341 unsigned int expected_levels;
342 }
344 {
345 { 2, 32, 2 },
346 { 6, 128, 4 },
347 { 10, 256, 5 },
348 { 12, 256, 5 },
349 { 72, 256, 8 },
350 { 250, 256, 9 },
351 { 258, 512, 10 },
352 { 512, 512, 10 },
353 };
373
374
376 hr =
D3DXCreateFontA(
device, 12, 0,
FW_DONTCARE, 0,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
"Tahoma", &
font);
381
382 hr =
D3DXCreateFontA(
device, 0, 0,
FW_DONTCARE, 0,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
"Tahoma", &
font);
385
386 hr =
D3DXCreateFontA(
device, 12, 0,
FW_DONTCARE, 0,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
NULL, &
font);
389
390 hr =
D3DXCreateFontA(
device, 12, 0,
FW_DONTCARE, 0,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
"", &
font);
393
394 hr =
D3DXCreateFontA(
NULL, 12, 0,
FW_DONTCARE, 0,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
"Tahoma", &
font);
396
397 hr =
D3DXCreateFontA(
device, 12, 0,
FW_DONTCARE, 0,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
"Tahoma",
NULL);
399
400 hr =
D3DXCreateFontA(
NULL, 12, 0,
FW_DONTCARE, 0,
FALSE,
DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH,
"Tahoma",
NULL);
402
403
404
416 ok(
hr ==
D3D_OK,
"D3DXCreateFontIndirect returned %#lx, expected %#lx\n",
hr,
D3D_OK);
418
421
424
427
428
429
433
436
441
443
444
445
449
452
455
456 ok(
desc.Height == 12,
"Got unexpected height %d.\n",
desc.Height);
457 ok(
desc.Width == 8,
"Got unexpected width %u.\n",
desc.Width);
459 ok(
desc.MipLevels == 2,
"Got unexpected miplevels %u.\n",
desc.MipLevels);
460 ok(
desc.Italic ==
TRUE,
"Got unexpected italic %#x.\n",
desc.Italic);
466
468
469
470
474
476 ok(!!
hdc,
"Got unexpected hdc %p.\n",
hdc);
477
479 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
481 ok(
ret,
"Got unexpected ret %#x.\n",
ret);
482
483 ok(
metrics.tmHeight == expmetrics.
tmHeight,
"Got unexpected height %ld, expected %ld.\n",
485 ok(
metrics.tmAscent == expmetrics.
tmAscent,
"Got unexpected ascent %ld, expected %ld.\n",
487 ok(
metrics.tmDescent == expmetrics.
tmDescent,
"Got unexpected descent %ld, expected %ld.\n",
493 ok(
metrics.tmAveCharWidth == expmetrics.
tmAveCharWidth,
"Got unexpected average char width %ld, expected %ld.\n",
495 ok(
metrics.tmMaxCharWidth == expmetrics.
tmMaxCharWidth,
"Got unexpected maximum char width %ld, expected %ld.\n",
497 ok(
metrics.tmWeight == expmetrics.
tmWeight,
"Got unexpected weight %ld, expected %ld.\n",
499 ok(
metrics.tmOverhang == expmetrics.
tmOverhang,
"Got unexpected overhang %ld, expected %ld.\n",
505 ok(
metrics.tmFirstChar == expmetrics.
tmFirstChar,
"Got unexpected first char %u, expected %u.\n",
507 ok(
metrics.tmLastChar == expmetrics.
tmLastChar,
"Got unexpected last char %u, expected %u.\n",
511 ok(
metrics.tmBreakChar == expmetrics.
tmBreakChar,
"Got unexpected break char %u, expected %u.\n",
513 ok(
metrics.tmItalic == expmetrics.
tmItalic,
"Got unexpected italic %u, expected %u.\n",
517 ok(
metrics.tmStruckOut == expmetrics.
tmStruckOut,
"Got unexpected struck out %u, expected %u.\n",
521 ok(
metrics.tmCharSet == expmetrics.
tmCharSet,
"Got unexpected charset %u, expected %u.\n",
523
525
526
527
531
544
557
559
560
561
565
567 ok(!!
hdc,
"Got unexpected hdc %p.\n",
hdc);
568
577
582
585
586 for (
c =
'b';
c <=
'z'; ++
c)
587 {
591
594
600 ok(surf_desc.
Usage == 0,
"Unexpected usage %#lx.\n", surf_desc.
Usage);
601 ok(surf_desc.
Width == 256,
"Unexpected width %u.\n", surf_desc.
Width);
602 ok(surf_desc.
Height == 256,
"Unexpected height %u.\n", surf_desc.
Height);
604
607
609 ok(
ret,
"Unexpected ret %#x.\n",
ret);
610
619
622 }
623
626
627
630
631
632 for (glyph = 1; glyph < 4; ++glyph)
633 {
634 texture = (IDirect3DTexture9 *)0xdeadbeef;
638 }
639
641
644 {
649
651 ok(!!
hdc,
"Unexpected hdc %p.\n",
hdc);
652
655
658
662
665 ok(surf_desc.Format == D3DFMT_A8R8G8B8, "Unexpected format %#x.\n", surf_desc.Format);
666 ok(surf_desc.Usage == 0, "Unexpected usage %#lx.\n", surf_desc.Usage);
667 ok(surf_desc.Width == tests[i].expected_size, "Unexpected width %u.\n", surf_desc.Width);
668 ok(surf_desc.Height == tests[i].expected_size, "Unexpected height %u.\n", surf_desc.Height);
669 ok(surf_desc.Pool == D3DPOOL_MANAGED, "Unexpected pool %u.\n", surf_desc.Pool);
670
671 IDirect3DTexture9_Release(texture);
672
673 /* ID3DXFontImpl_DrawText */
674 D3DXCreateSprite(device, &sprite);
675 SetRect(&rect, 0, 0, 640, 480);
676
677 IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
678
679 IDirect3DDevice9_BeginScene(device);
680 hr = ID3DXSprite_Begin(sprite, D3DXSPRITE_ALPHABLEND);
681 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
682
683 height = ID3DXFont_DrawTextW(font, sprite, testW, -1, &rect, DT_TOP, 0xffffffff);
684 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
685 height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect, DT_TOP, 0xffffffff);
686 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
687 height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect, DT_RIGHT, 0xffffffff);
688 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
689 height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect, DT_LEFT | DT_NOCLIP, 0xffffffff);
690 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
691
692 SetRectEmpty(&rect);
693 height = ID3DXFont_DrawTextW(font, sprite, testW, size, &rect,
694 DT_LEFT | DT_CALCRECT, 0xffffffff);
695 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
696 ok(!rect.left, "Unexpected rect left %ld.\n", rect.left);
697 ok(!rect.top, "Unexpected rect top %ld.\n", rect.top);
698 ok(rect.right, "Unexpected rect right %ld.\n", rect.right);
699 ok(rect.bottom == tests[i].font_height, "Unexpected rect bottom %ld.\n", rect.bottom);
700
701 hr = ID3DXSprite_End(sprite);
702 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
703 IDirect3DDevice9_EndScene(device);
704 ID3DXSprite_Release(sprite);
705
706 ID3DXFont_Release(font);
707 winetest_pop_context();
708 }
709
710
711 /* ID3DXFont_DrawTextA, ID3DXFont_DrawTextW */
712 hr = D3DXCreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
713 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
714 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
715
716 SetRect(&rect, 10, 10, 200, 200);
717
718 height = ID3DXFont_DrawTextA(font, NULL, "test", -2, &rect, 0, 0xFF00FF);
719 ok(height == 12, "Got unexpected height %d.\n", height);
720
721 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, &rect, 0, 0xFF00FF);
722 ok(height == 12, "Got unexpected height %d.\n", height);
723
724 height = ID3DXFont_DrawTextA(font, NULL, "test", 0, &rect, 0, 0xFF00FF);
725 ok(height == 0, "Got unexpected height %d.\n", height);
726
727 height = ID3DXFont_DrawTextA(font, NULL, "test", 1, &rect, 0, 0xFF00FF);
728 ok(height == 12, "Got unexpected height %d.\n", height);
729
730 height = ID3DXFont_DrawTextA(font, NULL, "test", 2, &rect, 0, 0xFF00FF);
731 ok(height == 12, "Got unexpected height %d.\n", height);
732
733 height = ID3DXFont_DrawTextA(font, NULL, "", 0, &rect, 0, 0xff00ff);
734 ok(height == 0, "Got unexpected height %d.\n", height);
735
736 height = ID3DXFont_DrawTextA(font, NULL, "", -1, &rect, 0, 0xff00ff);
737 ok(height == 0, "Got unexpected height %d.\n", height);
738
739 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, 0, 0xFF00FF);
740 ok(height == 12, "Got unexpected height %d.\n", height);
741
742 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, DT_CALCRECT, 0xFF00FF);
743 ok(height == 12, "Got unexpected height %d.\n", height);
744
745 height = ID3DXFont_DrawTextA(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
746 ok(height == 0, "Got unexpected height %d.\n", height);
747
748 SetRect(&rect, 10, 10, 50, 50);
749
750 height = ID3DXFont_DrawTextA(font, NULL, long_text, -1, &rect, DT_WORDBREAK, 0xff00ff);
751 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
752
753 height = ID3DXFont_DrawTextA(font, NULL, long_text, -1, &rect, DT_WORDBREAK | DT_NOCLIP, 0xff00ff);
754 ok(height == 96, "Got unexpected height %d.\n", height);
755
756 SetRect(&rect, 10, 10, 200, 200);
757
758 height = ID3DXFont_DrawTextW(font, NULL, testW, -1, &rect, 0, 0xFF00FF);
759 ok(height == 12, "Got unexpected height %d.\n", height);
760
761 height = ID3DXFont_DrawTextW(font, NULL, testW, 0, &rect, 0, 0xFF00FF);
762 ok(height == 0, "Got unexpected height %d.\n", height);
763
764 height = ID3DXFont_DrawTextW(font, NULL, testW, 1, &rect, 0, 0xFF00FF);
765 ok(height == 12, "Got unexpected height %d.\n", height);
766
767 height = ID3DXFont_DrawTextW(font, NULL, testW, 2, &rect, 0, 0xFF00FF);
768 ok(height == 12, "Got unexpected height %d.\n", height);
769
770 height = ID3DXFont_DrawTextW(font, NULL, L"", 0, &rect, 0, 0xff00ff);
771 ok(height == 0, "Got unexpected height %d.\n", height);
772
773 height = ID3DXFont_DrawTextW(font, NULL, L"", -1, &rect, 0, 0xff00ff);
774 ok(height == 0, "Got unexpected height %d.\n", height);
775
776 height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, 0, 0xFF00FF);
777 ok(height == 12, "Got unexpected height %d.\n", height);
778
779 height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, DT_CALCRECT, 0xFF00FF);
780 ok(height == 12, "Got unexpected height %d.\n", height);
781
782 height = ID3DXFont_DrawTextW(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
783 ok(height == 0, "Got unexpected height %d.\n", height);
784
785 SetRect(&rect, 10, 10, 50, 50);
786
787 height = ID3DXFont_DrawTextW(font, NULL, long_textW, -1, &rect, DT_WORDBREAK, 0xff00ff);
788 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
789
790 height = ID3DXFont_DrawTextW(font, NULL, long_textW, -1, &rect, DT_WORDBREAK | DT_NOCLIP, 0xff00ff);
791 ok(height == 96, "Got unexpected height %d.\n", height);
792
793 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, NULL, 0, 0xff00ff);
794 ok(height == 24, "Got unexpected height %d.\n", height);
795
796 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, 0, 0xff00ff);
797 ok(height == 24, "Got unexpected height %d.\n", height);
798
799 height = ID3DXFont_DrawTextW(font, NULL, L"a\r\na", -1, &rect, 0, 0xff00ff);
800 ok(height == 24, "Got unexpected height %d.\n", height);
801
802 height = ID3DXFont_DrawTextW(font, NULL, L"a\ra", -1, &rect, 0, 0xff00ff);
803 ok(height == 12, "Got unexpected height %d.\n", height);
804
805 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, DT_SINGLELINE, 0xff00ff);
806 ok(height == 12, "Got unexpected height %d.\n", height);
807
808 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_SINGLELINE, 0xff00ff);
809 ok(height == 12, "Got unexpected height %d.\n", height);
810
811 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, 0, 0xff00ff);
812 ok(height == 24, "Got unexpected height %d.\n", height);
813
814 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
815 ok(height == 36, "Got unexpected height %d.\n", height);
816
817 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK | DT_SINGLELINE, 0xff00ff);
818 ok(height == 12, "Got unexpected height %d.\n", height);
819
820 height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, 0, 0xff00ff);
821 ok(height == 48, "Got unexpected height %d.\n", height);
822
823 height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, DT_NOCLIP, 0xff00ff);
824 ok(height == 72, "Got unexpected height %d.\n", height);
825
826 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\t", -1, &rect, DT_WORDBREAK, 0xff00ff);
827 todo_wine ok(height == 0, "Got unexpected height %d.\n", height);
828
829 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\ta", -1, &rect, DT_WORDBREAK, 0xff00ff);
830 todo_wine ok(height == 12, "Got unexpected height %d.\n", height);
831
832 height = ID3DXFont_DrawTextW(font, NULL, L"\taaaaaaaaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
833 todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
834
835 height = ID3DXFont_DrawTextW(font, NULL, L"\taaaaaaaaaa", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
836 ok(height == 36, "Got unexpected height %d.\n", height);
837
838 height = ID3DXFont_DrawTextW(font, NULL, L"\taaa\taaa\taaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
839 ok(height == 24, "Got unexpected height %d.\n", height);
840
841 height = ID3DXFont_DrawTextW(font, NULL, L"\taaa\taaa\taaa", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
842 todo_wine ok(height == 48, "Got unexpected height %d.\n", height);
843
844 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\t", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
845 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
846
847 height = ID3DXFont_DrawTextW(font, NULL, L"a\ta", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
848 ok(height == 12, "Got unexpected height %d.\n", height);
849
850 height = ID3DXFont_DrawTextW(font, NULL, L"a\ta\ta", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
851 todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
852
853 height = ID3DXFont_DrawTextW(font, NULL, L"aaaaaaaaaaaaaaaaaaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
854 ok(height == 36, "Got unexpected height %d.\n", height);
855
856 height = ID3DXFont_DrawTextW(font, NULL, L"a a", -1, &rect, DT_WORDBREAK, 0xff00ff);
857 ok(height == 36, "Got unexpected height %d.\n", height);
858
859 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
860 ok(height == 36, "Got unexpected height %d.\n", height);
861
862 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_RIGHT, 0xff00ff);
863 ok(height == 36, "Got unexpected height %d.\n", height);
864
865 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CENTER, 0xff00ff);
866 ok(height == 36, "Got unexpected height %d.\n", height);
867
868 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM, 0xff00ff);
869 ok(height == 40, "Got unexpected height %d.\n", height);
870
871 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER, 0xff00ff);
872 ok(height == 32, "Got unexpected height %d.\n", height);
873
874 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT, 0xff00ff);
875 ok(height == 24, "Got unexpected height %d.\n", height);
876
877 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER, 0xff00ff);
878 ok(height == 24, "Got unexpected height %d.\n", height);
879
880 SetRect(&rect, 10, 10, 50, 50);
881 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
882 ok(height == 24, "Got unexpected height %d.\n", height);
883 check_rect(&rect, 10, 10, 30, 34);
884
885 SetRect(&rect, -10, 10, 30, 50);
886 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
887 ok(height == 24, "Got unexpected height %d.\n", height);
888 check_rect(&rect, -10, 10, 10, 34);
889
890 SetRect(&rect, 10, -10, 50, 30);
891 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
892 ok(height == 24, "Got unexpected height %d.\n", height);
893 check_rect(&rect, 10, -10, 30, 14);
894
895 SetRect(&rect, 10, 10, -30, 50);
896 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
897 ok(height == 24, "Got unexpected height %d.\n", height);
898 check_rect(&rect, 10, 10, 30, 34);
899
900 SetRect(&rect, 10, 10, 50, -30);
901 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
902 ok(height == 24, "Got unexpected height %d.\n", height);
903 check_rect(&rect, 10, 10, 30, 34);
904
905 SetRect(&rect, 10, 10, 50, 50);
906 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
907 ok(height == 24, "Got unexpected height %d.\n", height);
908 check_rect(&rect, 10, 10, 30, 34);
909
910 SetRect(&rect, -10, 10, 30, 50);
911 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
912 ok(height == 24, "Got unexpected height %d.\n", height);
913 check_rect(&rect, -10, 10, 10, 34);
914
915 SetRect(&rect, 10, -10, 50, 30);
916 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
917 ok(height == 24, "Got unexpected height %d.\n", height);
918 check_rect(&rect, 10, -10, 30, 14);
919
920 SetRect(&rect, 10, 10, -30, 50);
921 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
922 ok(height == 12, "Got unexpected height %d.\n", height);
923 check_rect(&rect, 10, 10, 53, 22);
924
925 SetRect(&rect, 10, 10, 50, -30);
926 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
927 ok(height == 24, "Got unexpected height %d.\n", height);
928 check_rect(&rect, 10, 10, 30, 34);
929
930 SetRect(&rect, 10, 10, 50, 50);
931 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
932 ok(height == 40, "Got unexpected height %d.\n", height);
933 check_rect(&rect, 10, 26, 30, 50);
934
935 SetRect(&rect, -10, 10, 30, 50);
936 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
937 ok(height == 40, "Got unexpected height %d.\n", height);
938 check_rect(&rect, -10, 26, 10, 50);
939
940 SetRect(&rect, 10, -10, 50, 30);
941 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
942 ok(height == 40, "Got unexpected height %d.\n", height);
943 check_rect(&rect, 10, 6, 30, 30);
944
945 SetRect(&rect, 10, 10, -30, 50);
946 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
947 ok(height == 40, "Got unexpected height %d.\n", height);
948 check_rect(&rect, 10, 26, 30, 50);
949
950 SetRect(&rect, 10, 10, 50, -30);
951 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
952 ok(height == -40, "Got unexpected height %d.\n", height);
953 check_rect(&rect, 10, -54, 30, -30);
954
955 SetRect(&rect, 10, 10, 50, 50);
956 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
957 ok(height == 40, "Got unexpected height %d.\n", height);
958 check_rect(&rect, 10, 26, 30, 50);
959
960 SetRect(&rect, -10, 10, 30, 50);
961 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
962 ok(height == 40, "Got unexpected height %d.\n", height);
963 check_rect(&rect, -10, 26, 10, 50);
964
965 SetRect(&rect, 10, -10, 50, 30);
966 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
967 ok(height == 40, "Got unexpected height %d.\n", height);
968 check_rect(&rect, 10, 6, 30, 30);
969
970 SetRect(&rect, 10, 10, -30, 50);
971 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
972 ok(height == 40, "Got unexpected height %d.\n", height);
973 check_rect(&rect, 10, 38, 53, 50);
974
975 SetRect(&rect, 10, 10, 50, -30);
976 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
977 ok(height == -40, "Got unexpected height %d.\n", height);
978 check_rect(&rect, 10, -54, 30, -30);
979
980 SetRect(&rect, 10, 10, 50, 50);
981 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
982 ok(height == 32, "Got unexpected height %d.\n", height);
983 check_rect(&rect, 10, 18, 30, 42);
984
985 SetRect(&rect, -10, 10, 30, 50);
986 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
987 ok(height == 32, "Got unexpected height %d.\n", height);
988 check_rect(&rect, -10, 18, 10, 42);
989
990 SetRect(&rect, 10, -10, 50, 30);
991 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
992 ok(height == 32, "Got unexpected height %d.\n", height);
993 check_rect(&rect, 10, -2, 30, 22);
994
995 SetRect(&rect, 10, 10, -30, 50);
996 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
997 ok(height == 32, "Got unexpected height %d.\n", height);
998 check_rect(&rect, 10, 18, 30, 42);
999
1000 SetRect(&rect, 10, 10, 50, -30);
1001 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
1002 ok(height == -8, "Got unexpected height %d.\n", height);
1003 check_rect(&rect, 10, -22, 30, 2);
1004
1005 SetRect(&rect, 10, 10, 50, 50);
1006 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1007 ok(height == 32, "Got unexpected height %d.\n", height);
1008 check_rect(&rect, 10, 18, 30, 42);
1009
1010 SetRect(&rect, -10, 10, 30, 50);
1011 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1012 ok(height == 32, "Got unexpected height %d.\n", height);
1013 check_rect(&rect, -10, 18, 10, 42);
1014
1015 SetRect(&rect, 10, -10, 50, 30);
1016 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1017 ok(height == 32, "Got unexpected height %d.\n", height);
1018 check_rect(&rect, 10, -2, 30, 22);
1019
1020 SetRect(&rect, 10, 10, -30, 50);
1021 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1022 ok(height == 26, "Got unexpected height %d.\n", height);
1023 check_rect(&rect, 10, 24, 53, 36);
1024
1025 SetRect(&rect, 10, 10, 50, -30);
1026 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1027 ok(height == -8, "Got unexpected height %d.\n", height);
1028 check_rect(&rect, 10, -22, 30, 2);
1029
1030 SetRect(&rect, 10, 10, 50, 50);
1031 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1032 ok(height == 24, "Got unexpected height %d.\n", height);
1033 check_rect(&rect, 30, 10, 50, 34);
1034
1035 SetRect(&rect, -10, 10, 30, 50);
1036 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1037 ok(height == 24, "Got unexpected height %d.\n", height);
1038 check_rect(&rect, 10, 10, 30, 34);
1039
1040 SetRect(&rect, 10, -10, 50, 30);
1041 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1042 ok(height == 24, "Got unexpected height %d.\n", height);
1043 check_rect(&rect, 30, -10, 50, 14);
1044
1045 SetRect(&rect, 10, 10, -30, 50);
1046 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1047 ok(height == 24, "Got unexpected height %d.\n", height);
1048 check_rect(&rect, -50, 10, -30, 34);
1049
1050 SetRect(&rect, 10, 10, 50, -30);
1051 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1052 ok(height == 24, "Got unexpected height %d.\n", height);
1053 check_rect(&rect, 30, 10, 50, 34);
1054
1055 SetRect(&rect, 10, 10, 50, 50);
1056 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1057 ok(height == 24, "Got unexpected height %d.\n", height);
1058 check_rect(&rect, 30, 10, 50, 34);
1059
1060 SetRect(&rect, -10, 10, 30, 50);
1061 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1062 ok(height == 24, "Got unexpected height %d.\n", height);
1063 check_rect(&rect, 10, 10, 30, 34);
1064
1065 SetRect(&rect, 10, -10, 50, 30);
1066 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1067 ok(height == 24, "Got unexpected height %d.\n", height);
1068 check_rect(&rect, 30, -10, 50, 14);
1069
1070 SetRect(&rect, 10, 10, -30, 50);
1071 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1072 ok(height == 12, "Got unexpected height %d.\n", height);
1073 check_rect(&rect, -73, 10, -30, 22);
1074
1075 SetRect(&rect, 10, 10, 50, -30);
1076 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1077 ok(height == 24, "Got unexpected height %d.\n", height);
1078 check_rect(&rect, 30, 10, 50, 34);
1079
1080 SetRect(&rect, 10, 10, 50, 50);
1081 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1082 ok(height == 24, "Got unexpected height %d.\n", height);
1083 check_rect(&rect, 20, 10, 40, 34);
1084
1085 SetRect(&rect, -10, 10, 30, 50);
1086 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1087 ok(height == 24, "Got unexpected height %d.\n", height);
1088 check_rect(&rect, 0, 10, 20, 34);
1089
1090 SetRect(&rect, 10, -10, 50, 30);
1091 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1092 ok(height == 24, "Got unexpected height %d.\n", height);
1093 check_rect(&rect, 20, -10, 40, 14);
1094
1095 SetRect(&rect, 10, 10, -30, 50);
1096 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1097 ok(height == 24, "Got unexpected height %d.\n", height);
1098 check_rect(&rect, -20, 10, 0, 34);
1099
1100 SetRect(&rect, 10, 10, 50, -30);
1101 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1102 ok(height == 24, "Got unexpected height %d.\n", height);
1103 check_rect(&rect, 20, 10, 40, 34);
1104
1105 SetRect(&rect, 10, 10, 50, 50);
1106 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1107 ok(height == 24, "Got unexpected height %d.\n", height);
1108 check_rect(&rect, 20, 10, 40, 34);
1109
1110 SetRect(&rect, -10, 10, 30, 50);
1111 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1112 ok(height == 24, "Got unexpected height %d.\n", height);
1113 check_rect(&rect, 0, 10, 20, 34);
1114
1115 SetRect(&rect, 10, -10, 50, 30);
1116 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1117 ok(height == 24, "Got unexpected height %d.\n", height);
1118 check_rect(&rect, 20, -10, 40, 14);
1119
1120 SetRect(&rect, 10, 10, -30, 50);
1121 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1122 ok(height == 12, "Got unexpected height %d.\n", height);
1123 check_rect(&rect, -31, 10, 12, 22);
1124
1125 SetRect(&rect, 10, 10, 50, -30);
1126 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1127 ok(height == 24, "Got unexpected height %d.\n", height);
1128 check_rect(&rect, 20, 10, 40, 34);
1129
1130 SetRect(&rect, 10, 10, 50, 50);
1131 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1132 ok(height == 32, "Got unexpected height %d.\n", height);
1133 check_rect(&rect, 20, 18, 40, 42);
1134
1135 SetRect(&rect, 10, 10, 50, 50);
1136 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1137 ok(height == 32, "Got unexpected height %d.\n", height);
1138 check_rect(&rect, 20, 18, 40, 42);
1139
1140 SetRect(&rect, -10, 10, 30, 50);
1141 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1142 ok(height == 32, "Got unexpected height %d.\n", height);
1143 check_rect(&rect, 0, 18, 20, 42);
1144
1145 SetRect(&rect, 10, -10, 50, 30);
1146 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1147 ok(height == 32, "Got unexpected height %d.\n", height);
1148 check_rect(&rect, 20, -2, 40, 22);
1149
1150 SetRect(&rect, 10, 10, -30, 50);
1151 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1152 ok(height == 32, "Got unexpected height %d.\n", height);
1153 check_rect(&rect, -20, 18, 0, 42);
1154
1155 SetRect(&rect, 10, 10, 50, -30);
1156 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1157 ok(height == -8, "Got unexpected height %d.\n", height);
1158 check_rect(&rect, 20, -22, 40, 2);
1159
1160 SetRect(&rect, 10, 10, 50, 50);
1161 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1162 ok(height == 32, "Got unexpected height %d.\n", height);
1163 check_rect(&rect, 20, 18, 40, 42);
1164
1165 SetRect(&rect, 10, 10, 50, 50);
1166 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1167 ok(height == 32, "Got unexpected height %d.\n", height);
1168 check_rect(&rect, 20, 18, 40, 42);
1169
1170 SetRect(&rect, -10, 10, 30, 50);
1171 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1172 ok(height == 32, "Got unexpected height %d.\n", height);
1173 check_rect(&rect, 0, 18, 20, 42);
1174
1175 SetRect(&rect, 10, -10, 50, 30);
1176 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1177 ok(height == 32, "Got unexpected height %d.\n", height);
1178 check_rect(&rect, 20, -2, 40, 22);
1179
1180 SetRect(&rect, 10, 10, -30, 50);
1181 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1182 ok(height == 26, "Got unexpected height %d.\n", height);
1183 check_rect(&rect, -31, 24, 12, 36);
1184
1185 SetRect(&rect, 10, 10, 50, -30);
1186 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1187 ok(height == -8, "Got unexpected height %d.\n", height);
1188 check_rect(&rect, 20, -22, 40, 2);
1189
1190 ID3DXFont_Release(font);
1191}
#define IDirect3DTexture9_GetLevelDesc(p, a, b)
#define IDirect3DTexture9_GetLevelCount(p)
struct ID3DXFont ID3DXFont
HRESULT WINAPI D3DXCreateFontA(struct IDirect3DDevice9 *device, INT height, UINT width, UINT weight, UINT miplevels, BOOL italic, DWORD charset, DWORD precision, DWORD quality, DWORD pitchandfamily, const char *facename, struct ID3DXFont **font)
HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
#define ID3DXFont_PreloadCharacters(p, a, b)
#define ID3DXFont_PreloadTextW(p, a, b)
#define ID3DXFont_GetDescA(p, a)
#define ID3DXFont_GetTextMetricsW(p, a)
#define ID3DXFont_GetDC(p)
#define ID3DXFont_Release(p)
#define ID3DXFont_GetGlyphData(p, a, b, c, d)
#define ID3DXFont_GetTextMetricsA(p, a)
#define ID3DXFont_PreloadGlyphs(p, a, b)
#define ID3DXFont_GetDevice(p, a)
#define ID3DXFont_PreloadTextA(p, a, b)
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
#define todo_wine_if(is_todo)
static const WCHAR testW[]
#define ANTIALIASED_QUALITY
#define OUT_RASTER_PRECIS
#define OUT_DEFAULT_PRECIS
DWORD WINAPI GetGlyphIndicesA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
DWORD WINAPI GetGlyphOutlineW(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)