diff --git a/fteng.h b/fteng.h index dfef68e..126b57d 100644 --- a/fteng.h +++ b/fteng.h @@ -302,6 +302,7 @@ private: bool m_italic; char m_hashinting; int m_ftWeight; + int m_os2Weight; int m_nMaxSizes; int m_nFontFamily; HFONT m_ggoFont; @@ -371,7 +372,7 @@ public: UINT getCacheHash(int px, int weight, bool italic, int width) {return ((px<<20)|(width<<8)|(weight<<1)|(int)italic); }; //计算一个hash值来定位cache FreeTypeFontInfo(int n, LPCTSTR name, int weight, bool italic, int mru, wstring fullname, wstring familyname) : m_id(n), m_weight(weight), m_italic(italic), m_OS2Table(NULL), IsPixel(false) - , FreeTypeMruCounter(mru), m_isSimSun(false), m_ggoFont(NULL), m_linkinited(false), m_linknum(0) + , FreeTypeMruCounter(mru), m_isSimSun(false), m_ggoFont(NULL), m_linkinited(false), m_linknum(0), m_os2Weight(0) , m_SimSunID(0), count(1), m_fullname(fullname), m_familyname(familyname), m_hashinting(3), m_nFontFamily(0) { //m_set = set; diff --git a/gdidll.rc b/gdidll.rc index 3726fdc..d7fcb49 100644 --- a/gdidll.rc +++ b/gdidll.rc @@ -24,8 +24,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2017,619,0 - PRODUCTVERSION 1,2017,619,0 + FILEVERSION 1,2017,1017,0 + PRODUCTVERSION 1,2017,1017,0 FILEFLAGSMASK 0x8L #ifdef _DEBUG FILEFLAGS 0xbL @@ -40,16 +40,16 @@ BEGIN BEGIN BLOCK "000004b0" BEGIN - VALUE "Comments", "Portions of this software are copyright (c) 2005-2012 The FreeType Project (www.freetype.org). All rights reserved." + VALUE "Comments", "Portions of this software are copyright (c) 2005-2017 The FreeType Project (www.freetype.org). All rights reserved." VALUE "CompanyName", "2ch & THEMEX" - VALUE "FileDescription", "The Ultimate Font Rasterizer" - VALUE "FileVersion", "1.2017.619.0" + VALUE "FileDescription", "The Ultimate Font Rasterizer with Infinality patch" + VALUE "FileVersion", "1.2017.1017.0" VALUE "InternalName", "MacType" VALUE "LegalCopyright", "(C) 460, 168, Higambana, 555 and sy567. All rights reserved. FlyingSnow republished" VALUE "OriginalFilename", "MacType.dll" VALUE "PrivateBuild", "True" VALUE "ProductName", "The Ultimate Font Rasterizer" - VALUE "ProductVersion", "1.2017.619.0" + VALUE "ProductVersion", "1.2017.1017.0" VALUE "URL", "http://mactype.themex.net http://drwatson.nobody.jp/gdi++/" END END diff --git a/gdipp.sln b/gdipp.sln index 5c9015b..76159f9 100644 --- a/gdipp.sln +++ b/gdipp.sln @@ -1,28 +1,28 @@ -锘 -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MacType", "gdipp.vcxproj", "{15C33FD9-0811-4981-B08F-E0BAD74A3028}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|Win32.ActiveCfg = Debug|Win32 - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|Win32.Build.0 = Debug|Win32 - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|x64.ActiveCfg = Debug|x64 - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|x64.Build.0 = Debug|x64 - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|Win32.ActiveCfg = Release|Win32 - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|Win32.Build.0 = Release|Win32 - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|x64.ActiveCfg = Release|x64 - {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +锘 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MacType", "gdipp.vcxproj", "{15C33FD9-0811-4981-B08F-E0BAD74A3028}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|Win32.ActiveCfg = Debug|Win32 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|Win32.Build.0 = Debug|Win32 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|x64.ActiveCfg = Debug|x64 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Debug|x64.Build.0 = Debug|x64 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|Win32.ActiveCfg = Release|Win32 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|Win32.Build.0 = Release|Win32 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|x64.ActiveCfg = Release|x64 + {15C33FD9-0811-4981-B08F-E0BAD74A3028}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/gdipp.vcxproj b/gdipp.vcxproj index de1fe5b..ff78109 100644 --- a/gdipp.vcxproj +++ b/gdipp.vcxproj @@ -1,6 +1,10 @@ 锘 + + Debug + ARM + Debug Win32 @@ -9,6 +13,10 @@ Debug x64 + + Release + ARM + Release Win32 @@ -42,11 +50,22 @@ Unicode true + + DynamicLibrary + v120_xp + Unicode + true + DynamicLibrary v120 Unicode + + DynamicLibrary + v120 + Unicode + @@ -59,9 +78,15 @@ + + + + + + <_ProjectFileVersion>12.0.21005.1 @@ -72,7 +97,7 @@ $(Configuration)\ true false - D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) + D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;$(WinSDK)\um;$(WinSDK)\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) $(ProjectName).Core @@ -81,7 +106,16 @@ $(Platform)\$(Configuration)\ true false - D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser;$(IncludePath) + D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;$(WinSDK)\um;$(WinSDK)\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) + $(ProjectName)64.Core + + + D:\Program Files\Microsoft Research\Detours Express 2.1\lib;$(ReferencePath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + false + D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;$(WinSDK)\um;$(WinSDK)\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) $(ProjectName)64.Core @@ -90,7 +124,7 @@ $(Configuration)\ false false - D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) + D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;$(WinSDK)\um;$(WinSDK)\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x86;$(LibraryPath) $(ProjectName).Core @@ -100,7 +134,17 @@ $(Platform)\$(Configuration)\ false false - D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser;$(IncludePath) + D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;$(WinSDK)\um;$(WinSDK)\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) + $(ProjectName)64.Core + $(VC_LibraryPath_x64);C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64 + + + D:\Program Files\Microsoft Research\Detours Express 2.1\lib;$(ReferencePath) + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + D:\Archives\Documents\Visual Studio 2008\Projects\freetype\include;$(WinSDK)\um;$(WinSDK)\shared;C:\Users\Peace\Documents\Visual Studio 2013\Projects\IniParser\;$(IncludePath) $(ProjectName)64.Core $(VC_LibraryPath_x64);C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64 @@ -159,6 +203,33 @@ Easyhk64.dll + + + + Disabled + Neither + false + false + WIN32;_DEBUG;_WINDOWS;_USRDLL;GDIPP_EXPORTS;_GDIPP_DLL;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + + Level3 + ProgramDatabase + + + freetype64.lib;usp10.lib;%(AdditionalDependencies) + LIBCMT;%(IgnoreSpecificDefaultLibraries) + expfunc.def + true + Windows + true + /DEBUG %(AdditionalOptions) + Easyhk64.dll + + MaxSpeed @@ -169,7 +240,7 @@ Sync MultiThreaded false - true + false StreamingSIMDExtensions2 Precise @@ -212,7 +283,7 @@ freetype64.lib;usp10.lib;%(AdditionalDependencies) false expfunc.def - false + true Windows true true @@ -222,6 +293,36 @@ Easyhk64.dll + + + + MaxSpeed + true + Speed + NDEBUG;_WINDOWS;_USRDLL;GDIPP_EXPORTS;_GDIPP_DLL;%(PreprocessorDefinitions) + Sync + MultiThreaded + false + true + StreamingSIMDExtensions2 + + + Level3 + ProgramDatabase + + + freetype64.lib;usp10.lib;%(AdditionalDependencies) + false + expfunc.def + true + Windows + true + true + true + true + Easyhk64.dll + + diff --git a/override.cpp b/override.cpp index 6f259c6..596d47f 100644 --- a/override.cpp +++ b/override.cpp @@ -454,9 +454,26 @@ DWORD WINAPI IMPL_GetGlyphOutlineW(__in HDC hdc, __in UINT uChar, __in UINT fuFo //lpgm->gmptGlyphOrigin.y += 1; //lpgm->gmBlackBoxX += 3; //lpgm->gmBlackBoxY += 2; - static int n = (int)ceil(2.0*pSettings->ScreenDpi() / 96); - lpgm->gmptGlyphOrigin.y += n; - lpgm->gmBlackBoxY += n*2; + + static int n = (int)floor(1.5*pSettings->ScreenDpi() / 96); + int nDeltaY = n, nDeltaBlackY = n; + TEXTMETRIC tm = { 0 }; + GetTextMetrics(hdc, &tm); + if (lpgm->gmptGlyphOrigin.y < tm.tmAscent) { // origin out of the top of the box + if (lpgm->gmptGlyphOrigin.y + nDeltaY>tm.tmAscent) { + nDeltaY = tm.tmAscent - lpgm->gmptGlyphOrigin.y; // limit the top position of the origin + } + } + lpgm->gmptGlyphOrigin.y += nDeltaY; + + lpgm->gmBlackBoxY += nDeltaY; + if (tm.tmAscent - lpgm->gmptGlyphOrigin.y + lpgm->gmBlackBoxY - 1 < tm.tmHeight) // still has some room to scale up + { + if (tm.tmAscent - lpgm->gmptGlyphOrigin.y + lpgm->gmBlackBoxY + 1 + nDeltaBlackY > tm.tmHeight) + lpgm->gmBlackBoxY = tm.tmHeight - tm.tmAscent + lpgm->gmptGlyphOrigin.y + 1; + else + lpgm->gmBlackBoxY += nDeltaBlackY; + } } } // TEXTMETRIC tm; @@ -477,13 +494,25 @@ DWORD WINAPI IMPL_GetGlyphOutlineA(__in HDC hdc, __in UINT uChar, __in UINT fuFo // } if (pSettings->EnableClipBoxFix() && (!cjBuffer || !pvBuffer)) { if (!(fuFormat & (GGO_BITMAP | GGO_GRAY2_BITMAP | GGO_GRAY4_BITMAP | GGO_GRAY8_BITMAP | GGO_NATIVE))) { - //lpgm->gmptGlyphOrigin.x -= 1; - //lpgm->gmptGlyphOrigin.y += 1; - //lpgm->gmBlackBoxX += 3; - //lpgm->gmBlackBoxY += 2; - static int n = (int)ceil(2.0*pSettings->ScreenDpi() / 96); - lpgm->gmptGlyphOrigin.y += n; - lpgm->gmBlackBoxY += n; + static int n = (int)floor(1.5*pSettings->ScreenDpi() / 96); + int nDeltaY = n, nDeltaBlackY = n; + TEXTMETRIC tm = { 0 }; + GetTextMetrics(hdc, &tm); + if (lpgm->gmptGlyphOrigin.y < tm.tmAscent) { // origin out of the top of the box + if (lpgm->gmptGlyphOrigin.y + nDeltaY>tm.tmAscent) { + nDeltaY = tm.tmAscent - lpgm->gmptGlyphOrigin.y; // limit the top position of the origin + } + } + lpgm->gmptGlyphOrigin.y += nDeltaY; + + lpgm->gmBlackBoxY += nDeltaY; + if (tm.tmAscent - lpgm->gmptGlyphOrigin.y + lpgm->gmBlackBoxY - 1 < tm.tmHeight) + { + if (tm.tmAscent - lpgm->gmptGlyphOrigin.y + lpgm->gmBlackBoxY + 1 + nDeltaBlackY > tm.tmHeight) + lpgm->gmBlackBoxY = tm.tmHeight - tm.tmAscent + lpgm->gmptGlyphOrigin.y + 1; + else + lpgm->gmBlackBoxY += nDeltaBlackY; + } } } return ret; diff --git a/settings.cpp b/settings.cpp index 0bdca39..8087967 100644 --- a/settings.cpp +++ b/settings.cpp @@ -459,7 +459,7 @@ SKIP: m_nCacheMaxBytes = _GetFreeTypeProfileInt(_T("CacheMaxBytes"), 10485760, lpszFile); //experimental settings: - m_bEnableClipBoxFix = !!_GetFreeTypeProfileIntFromSection(_T("Experimental"), _T("ClipBoxFix"), 0, lpszFile); + m_bEnableClipBoxFix = !!_GetFreeTypeProfileIntFromSection(_T("Experimental"), _T("ClipBoxFix"), 1, lpszFile); if (m_nFontLoader == SETTING_FONTLOADER_WIN32) { // API偑張棟偟偰偔傟傞偼偢側偺偱帺慜張棟偼柍岠壔 diff --git a/wow64ext.h b/wow64ext.h index eb095fc..d1eadc2 100644 --- a/wow64ext.h +++ b/wow64ext.h @@ -64,7 +64,7 @@ struct _NT_TIB_T }; template -struct _CLIENT_ID +struct _WOW64_CLIENT_ID { T UniqueProcess; T UniqueThread; @@ -75,7 +75,7 @@ struct _TEB_T_ { _NT_TIB_T NtTib; T EnvironmentPointer; - _CLIENT_ID ClientId; + _WOW64_CLIENT_ID ClientId; T ActiveRpcHandle; T ThreadLocalStoragePointer; T ProcessEnvironmentBlock;