diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index ba873ec1a96..3155fc32188 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -1085,6 +1085,11 @@ static HRESULT WINAPI OLEFontImpl_SetRatio( if(cyLogical == 0 || cyHimetric == 0) return E_INVALIDARG; + /* cyLogical and cyHimetric both set to 1 is a special case that + does not change the scaling but also does not fail */ + if(cyLogical == 1 && cyHimetric == 1) + return S_OK; + this->cyLogical = cyLogical; this->cyHimetric = cyHimetric; this->dirty = TRUE; diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c index 1af1b6d5ee8..5249b54c487 100644 --- a/dlls/oleaut32/tests/olefont.c +++ b/dlls/oleaut32/tests/olefont.c @@ -151,6 +151,41 @@ static void test_ifont_sizes(void) test_ifont_size(180000, 0, 144, 2540, -36, "ratio2"); /* another ratio */ test_ifont_size(180000, 0, 72, 1270, -36, "ratio3"); /* yet another ratio */ test_ifont_size(186000, 0, 72, 2540, -19, "rounding+ratio"); /* test rounding with ratio */ + + /* test various combinations of logical == himetric */ + test_ifont_size(180000, 0, 10, 10, -635, "identical ratio 1"); + test_ifont_size(240000, 0, 10, 10, -848, "identical ratio 2"); + test_ifont_size(300000, 0, 10, 10, -1058, "identical ratio 3"); + + /* test various combinations of logical and himetric both set to 1 */ + test_ifont_size(180000, 0, 1, 1, -24, "1:1 ratio 1"); + test_ifont_size(240000, 0, 1, 1, -32, "1:1 ratio 2"); + test_ifont_size(300000, 0, 1, 1, -40, "1:1 ratio 3"); + + /* test various combinations of logical set to 1 */ + test_ifont_size(180000, 0, 1, 0, -24, "1:0 ratio 1"); + test_ifont_size(240000, 0, 1, 0, -32, "1:0 ratio 2"); + test_ifont_size(300000, 0, 1, 0, -40, "1:0 ratio 3"); + + /* test various combinations of himetric set to 1 */ + test_ifont_size(180000, 0, 0, 1, -24, "0:1 ratio 1"); + test_ifont_size(240000, 0, 0, 1, -32, "0:1 ratio 2"); + test_ifont_size(300000, 0, 0, 1, -40, "0:1 ratio 3"); + + /* test various combinations of 2:1 logical:himetric */ + test_ifont_size(180000, 0, 2, 1, -1270, "2:1 ratio 1"); + test_ifont_size(240000, 0, 2, 1, -1694, "2:1 ratio 2"); + test_ifont_size(300000, 0, 2, 1, -2117, "2:1 ratio 3"); + + /* test various combinations of 1:2 logical:himetric */ + test_ifont_size(180000, 0, 1, 2, -318, "1:2 ratio 1"); + test_ifont_size(240000, 0, 1, 2, -424, "1:2 ratio 2"); + test_ifont_size(300000, 0, 1, 2, -529, "1:2 ratio 3"); + + /* test various combinations of logical and himetric both set to 2 */ + test_ifont_size(180000, 0, 2, 2, -635, "2:2 ratio 1"); + test_ifont_size(240000, 0, 2, 2, -848, "2:2 ratio 2"); + test_ifont_size(300000, 0, 2, 2, -1058, "2:2 ratio 3"); } static void test_QueryInterface(void)