Created
January 11, 2013 14:43
-
-
Save k-takata/4511170 to your computer and use it in GitHub Desktop.
additional patch for vim-kaoriya-vim-mq-ex / patch-direct_write.diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/gui_dwrite.cpp b/src/gui_dwrite.cpp | |
| --- a/src/gui_dwrite.cpp | |
| +++ b/src/gui_dwrite.cpp | |
| @@ -2,11 +2,8 @@ | |
| #define WIN32_LEAN_AND_MEAN | |
| -#ifdef __MINGW32__ | |
| -# undef WINVER | |
| -# define WINVER 0x0600 | |
| -# undef _WIN32_WINNT | |
| -# define _WIN32_WINNT 0x0600 | |
| +#if WINVER < 0x0600 | |
| +# error WINVER must be set to 0x0600 or above. | |
| #endif | |
| #include <windows.h> | |
| @@ -443,7 +440,10 @@ | |
| if (SUCCEEDED(hr)) | |
| hr = mTextFormat->SetParagraphAlignment( | |
| - DWRITE_PARAGRAPH_ALIGNMENT_NEAR); | |
| + DWRITE_PARAGRAPH_ALIGNMENT_CENTER); | |
| + | |
| + if (SUCCEEDED(hr)) | |
| + hr = mTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); | |
| } | |
| void | |
| @@ -471,7 +471,7 @@ | |
| dst.lfQuality = src.lfQuality; | |
| dst.lfPitchAndFamily = src.lfPitchAndFamily; | |
| MultiByteToWideChar(GetACP(), MB_PRECOMPOSED, | |
| - src.lfFaceName, lstrlenA(src.lfFaceName), | |
| + src.lfFaceName, -1, | |
| dst.lfFaceName, LF_FACESIZE); | |
| } | |
| @@ -492,9 +492,9 @@ | |
| HDC memdc = bmpRT->GetMemoryDC(); | |
| BitBlt(memdc, 0, 0, w, h, hdc, x, y, SRCCOPY); | |
| - hr = mDWriteFactory->CreateTextLayout( | |
| + hr = mDWriteFactory->CreateGdiCompatibleTextLayout( | |
| text, len, mTextFormat, static_cast<FLOAT>(w), | |
| - static_cast<FLOAT>(h), &textLayout); | |
| + static_cast<FLOAT>(h), mDpiScaleX, NULL, TRUE, &textLayout); | |
| if (SUCCEEDED(hr)) | |
| { | |
| @@ -525,6 +525,7 @@ | |
| DWriteContext * | |
| DWriteContext_Open(void) | |
| { | |
| + CoInitialize(NULL); | |
| return new DWriteContext(); | |
| } | |
| @@ -605,4 +606,5 @@ | |
| DWriteContext_Close(DWriteContext *ctx) | |
| { | |
| delete ctx; | |
| + CoUninitialize(); | |
| } | |
| diff --git a/src/gui_w32.c b/src/gui_w32.c | |
| --- a/src/gui_w32.c | |
| +++ b/src/gui_w32.c | |
| @@ -2463,8 +2463,9 @@ | |
| * output to speed up output. */ | |
| if (enc_utf8) | |
| { | |
| +#if defined(USE_DIRECT_X) | |
| n = len - 1; /* always output the text as WCHAR */ | |
| -#if 0 | |
| +#else | |
| for (n = 0; n < len; ++n) | |
| if (text[n] >= 0x80) | |
| break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment