winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2020
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
947 discussions
Start a n
N
ew thread
Zhiyi Zhang : winex11.drv: Support multiple adapter display settings in registry.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: 3db619d46e70a398a06001573fb42b0a32d81209 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=3db619d46e70a398a0600157…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Thu Jun 11 17:22:09 2020 +0800 winex11.drv: Support multiple adapter display settings in registry. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/winex11.drv/display.c | 4 +- dlls/winex11.drv/settings.c | 101 +++++++++++++++++++++++++++++--------------- dlls/winex11.drv/x11drv.h | 2 + 3 files changed, 70 insertions(+), 37 deletions(-) diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index 4acd729962..1dedf32a52 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -124,7 +124,7 @@ static CRITICAL_SECTION_DEBUG screen_critsect_debug = }; static CRITICAL_SECTION screen_section = {&screen_critsect_debug, -1, 0, 0, 0, 0}; -static HANDLE get_display_device_init_mutex(void) +HANDLE get_display_device_init_mutex(void) { static const WCHAR init_mutexW[] = {'d','i','s','p','l','a','y','_','d','e','v','i','c','e','_','i','n','i','t',0}; HANDLE mutex = CreateMutexW(NULL, FALSE, init_mutexW); @@ -133,7 +133,7 @@ static HANDLE get_display_device_init_mutex(void) return mutex; } -static void release_display_device_init_mutex(HANDLE mutex) +void release_display_device_init_mutex(HANDLE mutex) { ReleaseMutex(mutex); CloseHandle(mutex); diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c index bc9f7aa1dc..c3f31d0430 100644 --- a/dlls/winex11.drv/settings.c +++ b/dlls/winex11.drv/settings.c @@ -19,9 +19,6 @@ */ #include "config.h" -#include <string.h> -#include <stdio.h> -#include <assert.h> #define NONAMELESSUNION #define NONAMELESSSTRUCT @@ -32,6 +29,7 @@ #include "winreg.h" #include "wingdi.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(x11settings); @@ -154,43 +152,63 @@ void X11DRV_Settings_Init(void) X11DRV_Settings_AddOneMode( primary.right - primary.left, primary.bottom - primary.top, 0, 60); } -static BOOL get_display_device_reg_key(char *key, unsigned len) +static BOOL get_display_device_reg_key(const WCHAR *device_name, WCHAR *key, unsigned len) { - static const char display_device_guid_prop[] = "__wine_display_device_guid"; - static const char video_path[] = "System\\CurrentControlSet\\Control\\Video\\{"; - static const char display0[] = "}\\0000"; - ATOM guid_atom; - - assert(len >= sizeof(video_path) + sizeof(display0) + 40); - - guid_atom = HandleToULong(GetPropA(GetDesktopWindow(), display_device_guid_prop)); - if (!guid_atom) return FALSE; + static const WCHAR display[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y'}; + static const WCHAR video_value_fmt[] = {'\\','D','e','v','i','c','e','\\', + 'V','i','d','e','o','%','d',0}; + static const WCHAR video_key[] = {'H','A','R','D','W','A','R','E','\\', + 'D','E','V','I','C','E','M','A','P','\\', + 'V','I','D','E','O','\\',0}; + WCHAR value_name[MAX_PATH], buffer[MAX_PATH], *end_ptr; + DWORD adapter_index, size; + + /* Device name has to be \\.\DISPLAY%d */ + if (strncmpiW(device_name, display, ARRAY_SIZE(display))) + return FALSE; - memcpy(key, video_path, sizeof(video_path)); + /* Parse \\.\DISPLAY* */ + adapter_index = strtolW(device_name + ARRAY_SIZE(display), &end_ptr, 10) - 1; + if (*end_ptr) + return FALSE; - if (!GlobalGetAtomNameA(guid_atom, key + strlen(key), 40)) + /* Open \Device\Video* in HKLM\HARDWARE\DEVICEMAP\VIDEO\ */ + sprintfW(value_name, video_value_fmt, adapter_index); + size = sizeof(buffer); + if (RegGetValueW(HKEY_LOCAL_MACHINE, video_key, value_name, RRF_RT_REG_SZ, NULL, buffer, &size)) return FALSE; - strcat(key, display0); + if (len < lstrlenW(buffer + 18) + 1) + return FALSE; - TRACE("display device key %s\n", wine_dbgstr_a(key)); + /* Skip \Registry\Machine\ prefix */ + lstrcpyW(key, buffer + 18); + TRACE("display device %s registry settings key %s.\n", wine_dbgstr_w(device_name), wine_dbgstr_w(key)); return TRUE; } -static BOOL read_registry_settings(DEVMODEW *dm) +static BOOL read_registry_settings(const WCHAR *device_name, DEVMODEW *dm) { - char wine_x11_reg_key[128]; + WCHAR wine_x11_reg_key[MAX_PATH]; + HANDLE mutex; HKEY hkey; DWORD type, size; BOOL ret = TRUE; dm->dmFields = 0; - if (!get_display_device_reg_key(wine_x11_reg_key, sizeof(wine_x11_reg_key))) + mutex = get_display_device_init_mutex(); + if (!get_display_device_reg_key(device_name, wine_x11_reg_key, ARRAY_SIZE(wine_x11_reg_key))) + { + release_display_device_init_mutex(mutex); return FALSE; + } - if (RegOpenKeyExA(HKEY_CURRENT_CONFIG, wine_x11_reg_key, 0, KEY_READ, &hkey)) + if (RegOpenKeyExW(HKEY_CURRENT_CONFIG, wine_x11_reg_key, 0, KEY_READ, &hkey)) + { + release_display_device_init_mutex(mutex); return FALSE; + } #define query_value(name, data) \ size = sizeof(DWORD); \ @@ -218,21 +236,30 @@ static BOOL read_registry_settings(DEVMODEW *dm) #undef query_value RegCloseKey(hkey); + release_display_device_init_mutex(mutex); return ret; } -static BOOL write_registry_settings(const DEVMODEW *dm) +static BOOL write_registry_settings(const WCHAR *device_name, const DEVMODEW *dm) { - char wine_x11_reg_key[128]; + WCHAR wine_x11_reg_key[MAX_PATH]; + HANDLE mutex; HKEY hkey; BOOL ret = TRUE; - if (!get_display_device_reg_key(wine_x11_reg_key, sizeof(wine_x11_reg_key))) + mutex = get_display_device_init_mutex(); + if (!get_display_device_reg_key(device_name, wine_x11_reg_key, ARRAY_SIZE(wine_x11_reg_key))) + { + release_display_device_init_mutex(mutex); return FALSE; + } - if (RegCreateKeyExA(HKEY_CURRENT_CONFIG, wine_x11_reg_key, 0, NULL, + if (RegCreateKeyExW(HKEY_CURRENT_CONFIG, wine_x11_reg_key, 0, NULL, REG_OPTION_VOLATILE, KEY_WRITE, NULL, &hkey, NULL)) + { + release_display_device_init_mutex(mutex); return FALSE; + } #define set_value(name, data) \ if (RegSetValueExA(hkey, name, 0, REG_DWORD, (const BYTE*)(data), sizeof(DWORD))) \ @@ -251,6 +278,7 @@ static BOOL write_registry_settings(const DEVMODEW *dm) #undef set_value RegCloseKey(hkey); + release_display_device_init_mutex(mutex); return ret; } @@ -301,7 +329,7 @@ BOOL CDECL X11DRV_EnumDisplaySettingsEx( LPCWSTR name, DWORD n, LPDEVMODEW devmo if (n == ENUM_REGISTRY_SETTINGS) { TRACE("mode %d (registry) -- getting default mode (%s)\n", n, handler_name); - return read_registry_settings(devmode); + return read_registry_settings(name, devmode); } if (n < dd_mode_count) { @@ -368,13 +396,6 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, devmode = &default_mode; } - if (lstrcmpiW(primary_adapter, devname)) - { - FIXME("Changing non-primary adapter %s settings is currently unsupported.\n", - wine_dbgstr_w(devname)); - return DISP_CHANGE_SUCCESSFUL; - } - if (is_detached_mode(devmode)) { FIXME("Detaching adapters is currently unsupported.\n"); @@ -407,8 +428,18 @@ LONG CDECL X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode, /* we have a valid mode */ TRACE("Requested display settings match mode %d (%s)\n", i, handler_name); - if (flags & CDS_UPDATEREGISTRY) - write_registry_settings(devmode); + if (flags & CDS_UPDATEREGISTRY && !write_registry_settings(devname, devmode)) + { + ERR("Failed to write %s display settings to registry.\n", wine_dbgstr_w(devname)); + return DISP_CHANGE_NOTUPDATED; + } + + if (lstrcmpiW(primary_adapter, devname)) + { + FIXME("Changing non-primary adapter %s settings is currently unsupported.\n", + wine_dbgstr_w(devname)); + return DISP_CHANGE_SUCCESSFUL; + } if (!(flags & (CDS_TEST | CDS_NORESET))) return pSetCurrentMode(i); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 5021c71a41..a9eaed20ca 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -754,6 +754,8 @@ struct x11drv_display_device_handler void (*register_event_handlers)(void); }; +extern HANDLE get_display_device_init_mutex(void) DECLSPEC_HIDDEN; +extern void release_display_device_init_mutex(HANDLE) DECLSPEC_HIDDEN; extern void X11DRV_DisplayDevices_SetHandler(const struct x11drv_display_device_handler *handler) DECLSPEC_HIDDEN; extern void X11DRV_DisplayDevices_Init(BOOL force) DECLSPEC_HIDDEN; extern void X11DRV_DisplayDevices_RegisterEventHandlers(void) DECLSPEC_HIDDEN;
1
0
0
0
Zhiyi Zhang : explorer: Initialize registry display settings for all adapters.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: b5d58ff69c9b01d42b5dd12f5652d5cf2859d4b8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b5d58ff69c9b01d42b5dd12f…
Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Thu Jun 11 17:21:52 2020 +0800 explorer: Initialize registry display settings for all adapters. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/explorer/desktop.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 8a8e5bc071..e7acb2db77 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -22,6 +22,8 @@ #include <stdio.h> #define COBJMACROS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT #define OEMRESOURCE #include <windows.h> #include <rpc.h> @@ -881,16 +883,31 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid ) static void initialize_display_settings(void) { + DISPLAY_DEVICEW ddW; DEVMODEW dmW; + DWORD i = 0; /* Store current display mode in the registry */ - if (EnumDisplaySettingsExW( NULL, ENUM_CURRENT_SETTINGS, &dmW, 0 )) + ddW.cb = sizeof(ddW); + dmW.dmSize = sizeof(dmW); + while (EnumDisplayDevicesW( NULL, i++, &ddW, 0 )) { - WINE_TRACE( "Current display mode %ux%u %u bpp %u Hz\n", dmW.dmPelsWidth, - dmW.dmPelsHeight, dmW.dmBitsPerPel, dmW.dmDisplayFrequency ); - ChangeDisplaySettingsExW( NULL, &dmW, 0, - CDS_GLOBAL | CDS_NORESET | CDS_UPDATEREGISTRY, - NULL ); + if (!EnumDisplaySettingsExW( ddW.DeviceName, ENUM_CURRENT_SETTINGS, &dmW, 0)) + { + WINE_ERR( "Failed to query current display settings for %s.\n", + wine_dbgstr_w( ddW.DeviceName ) ); + continue; + } + + WINE_TRACE( "Device %s current display mode %ux%u %uBits %uHz at %d,%d.\n", + wine_dbgstr_w( ddW.DeviceName ), dmW.dmPelsWidth, dmW.dmPelsHeight, + dmW.dmBitsPerPel, dmW.dmDisplayFrequency, dmW.u1.s2.dmPosition.x, + dmW.u1.s2.dmPosition.y ); + + if (ChangeDisplaySettingsExW( ddW.DeviceName, &dmW, 0, + CDS_GLOBAL | CDS_NORESET | CDS_UPDATEREGISTRY, 0 )) + WINE_ERR( "Failed to initialize registry display settings for %s.\n", + wine_dbgstr_w( ddW.DeviceName ) ); } }
1
0
0
0
Jacek Caban : dwrite: Use BitScanReverse instead of dwrite_log2i.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: ce4083ecccf0bab6f5e20338f61aeac711fa3706 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ce4083ecccf0bab6f5e20338…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 10 14:21:50 2020 +0200 dwrite: Use BitScanReverse instead of dwrite_log2i. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/opentype.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index e30cc4abe1..cb79a68d59 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -3518,36 +3518,6 @@ static inline unsigned int dwrite_popcount(unsigned int x) #endif } -static inline unsigned int dwrite_log2i(unsigned int x) -{ -#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) - return __builtin_clz(x) ^ 0x1f; -#else - static const unsigned int l[] = - { - ~0u, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - }; - unsigned int i; - - return (i = x >> 16) ? (x = i >> 8) ? l[x] + 24 : l[i] + 16 : (i = x >> 8) ? l[i] + 8 : l[x]; -#endif -} - static float opentype_scale_gpos_be_value(WORD value, float emsize, UINT16 upem) { return (short)GET_BE_WORD(value) * emsize / upem; @@ -4650,7 +4620,7 @@ static void opentype_layout_collect_lookups(struct scriptshaping_context *contex if ((feature->flags & FEATURE_GLOBAL) && feature->max_value == 1) bits_needed = 0; else - bits_needed = min(8, dwrite_log2i(feature->max_value)); + BitScanReverse(&bits_needed, min(feature->max_value, 256)); if (!feature->max_value || next_bit + bits_needed > 8 * sizeof (feature->mask)) continue;
1
0
0
0
Jacek Caban : dwrite: Use BitScanForward instead of dwrite_ctz.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: f5e67202cca94fece9970711e1d28c0b95af9469 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f5e67202cca94fece9970711…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Jun 10 14:21:25 2020 +0200 dwrite: Use BitScanForward instead of dwrite_ctz. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/opentype.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index a6e2663ab1..e30cc4abe1 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -3518,23 +3518,6 @@ static inline unsigned int dwrite_popcount(unsigned int x) #endif } -static inline unsigned int dwrite_ctz(unsigned int x) -{ -#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) - return __builtin_ctz(x); -#else - unsigned int c = 32; - x &= - (int) x; - if (x) c--; - if (x & 0x0000ffff) c -= 16; - if (x & 0x00ff00ff) c -= 8; - if (x & 0x0f0f0f0f) c -= 4; - if (x & 0x33333333) c -= 2; - if (x & 0x55555555) c -= 1; - return c; -#endif -} - static inline unsigned int dwrite_log2i(unsigned int x) { #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) @@ -5084,7 +5067,7 @@ static BOOL opentype_layout_apply_gsub_alt_substitution(struct scriptshaping_con if (!count) return FALSE; - shift = dwrite_ctz(lookup->mask); + BitScanForward(&shift, lookup->mask); alt_index = (lookup->mask & context->glyph_infos[idx].mask) >> shift; if (alt_index > count || !alt_index)
1
0
0
0
Nikolay Sivov : dwrite: Implement another GetFontFamily() variant.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: c440d87464a2407c4201ba8119e68f5fe52ee52f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=c440d87464a2407c4201ba81…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jun 11 15:09:00 2020 +0300 dwrite: Implement another GetFontFamily() variant. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/font.c | 18 +++++++++++++++--- dlls/dwrite/tests/font.c | 25 ++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index baee8d1e49..19fe911420 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -3002,11 +3002,23 @@ static HRESULT WINAPI dwritefontcollection1_GetFontFamily(IDWriteFontCollection3 } static HRESULT WINAPI dwritefontcollection2_GetFontFamily(IDWriteFontCollection3 *iface, - UINT32 index, IDWriteFontFamily2 **family) + UINT32 index, IDWriteFontFamily2 **ret) { - FIXME("%p, %u, %p.\n", iface, index, family); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); + struct dwrite_fontfamily *family; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %u, %p.\n", iface, index, ret); + + *ret = NULL; + + if (index >= collection->count) + return E_FAIL; + + if (SUCCEEDED(hr = create_fontfamily(collection, index, &family))) + *ret = &family->IDWriteFontFamily2_iface; + + return hr; } static HRESULT WINAPI dwritefontcollection2_GetMatchingFonts(IDWriteFontCollection3 *iface, diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 07baf112ee..e1024d0263 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -1521,14 +1521,15 @@ static void test_GetFontFamily(void) { IDWriteFontCollection *collection, *collection2; IDWriteFontCollection *syscoll; + IDWriteFontCollection2 *coll2; IDWriteFontFamily *family, *family2; IDWriteFontFamily1 *family1; IDWriteGdiInterop *interop; IDWriteFont *font, *font2; IDWriteFactory *factory; LOGFONTW logfont; + ULONG ref, count; HRESULT hr; - ULONG ref; factory = create_factory(); @@ -1656,6 +1657,28 @@ if (0) /* crashes on native */ else win_skip("IDWriteFontFamily1 is not supported.\n"); + /* IDWriteFontCollection2::GetFontFamily() */ + if (SUCCEEDED(IDWriteFontCollection_QueryInterface(syscoll, &IID_IDWriteFontCollection2, (void **)&coll2))) + { + IDWriteFontFamily2 *family2; + + count = IDWriteFontCollection2_GetFontFamilyCount(coll2); + ok(!!count, "Unexpected family count.\n"); + + family2 = (void *)0xdeadbeef; + hr = IDWriteFontCollection2_GetFontFamily(coll2, count, &family2); + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(!family2, "Unexpected pointer.\n"); + + hr = IDWriteFontCollection2_GetFontFamily(coll2, 0, &family2); + ok(hr == S_OK, "Failed to get family, hr %#x.\n", hr); + IDWriteFontFamily2_Release(family2); + + IDWriteFontCollection2_Release(coll2); + } + else + win_skip("IDWriteFontCollection2 is not supported.\n"); + IDWriteFontCollection_Release(syscoll); IDWriteFontCollection_Release(collection2); IDWriteFontCollection_Release(collection);
1
0
0
0
Nikolay Sivov : dwrite: Implement ligature substitution.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: 292dff589ee26e69a028cb27feabe2a3ca8345d1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=292dff589ee26e69a028cb27…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jun 11 15:08:59 2020 +0300 dwrite: Implement ligature substitution. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/dwrite_private.h | 2 +- dlls/dwrite/opentype.c | 134 +++++++++++++++++++++++++++++++------------ 2 files changed, 97 insertions(+), 39 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 4cb35a44e4..661e01123c 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -529,7 +529,7 @@ struct shaping_glyph_properties UINT16 isZeroWidthSpace : 1; UINT16 reserved : 1; UINT16 components : 4; - UINT16 reserved2 : 4; + UINT16 lig_component : 4; }; struct scriptshaping_context; diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 63b35155b3..a6e2663ab1 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -5104,11 +5104,71 @@ static BOOL opentype_layout_apply_gsub_alt_substitution(struct scriptshaping_con return TRUE; } -static BOOL opentype_layout_apply_ligature(struct scriptshaping_context *context, unsigned int offset) +static BOOL opentype_layout_context_match_input(const struct match_context *mc, unsigned int count, const UINT16 *input, + unsigned int *end_offset, unsigned int *match_positions) +{ + struct match_data match_data = { .mc = mc, .subtable_offset = mc->input_offset }; + struct scriptshaping_context *context = mc->context; + struct glyph_iterator iter; + unsigned int i; + + if (count > GLYPH_CONTEXT_MAX_LENGTH) + return FALSE; + + match_positions[0] = context->cur; + + glyph_iterator_init(context, mc->lookup->flags, context->cur, count - 1, &iter); + iter.mask = mc->lookup->mask; + iter.match_func = mc->match_func; + iter.match_data = &match_data; + iter.glyph_data = input; + + for (i = 1; i < count; ++i) + { + if (!glyph_iterator_next(&iter)) + return FALSE; + + match_positions[i] = iter.pos; + } + + *end_offset = iter.pos - context->cur + 1; + + return TRUE; +} + +static void opentype_layout_unsafe_to_break(struct scriptshaping_context *context, unsigned int idx) +{ + if (context->u.buffer.glyph_props[idx].isClusterStart) + context->u.buffer.text_props[context->glyph_infos[idx].start_text_idx].canBreakShapingAfter = 0; +} + +static void opentype_layout_delete_glyph(struct scriptshaping_context *context, unsigned int idx) { + unsigned int shift_len; + + shift_len = context->glyph_count - context->cur - 1; + + if (shift_len) + { + memmove(&context->u.buffer.glyphs[idx], &context->u.buffer.glyphs[idx + 1], + shift_len * sizeof(*context->u.buffer.glyphs)); + memmove(&context->u.buffer.glyph_props[idx], &context->u.buffer.glyph_props[idx + 1], + shift_len * sizeof(*context->u.buffer.glyph_props)); + memmove(&context->glyph_infos[idx], &context->glyph_infos[idx + 1], shift_len * sizeof(*context->glyph_infos)); + } + + context->glyph_count--; +} + +static BOOL opentype_layout_apply_ligature(struct scriptshaping_context *context, unsigned int offset, + const struct lookup *lookup) +{ + struct match_context mc = { .context = context, .lookup = lookup, .match_func = opentype_match_glyph_func }; const struct dwrite_fonttable *gsub = &context->table->table; + unsigned int match_positions[GLYPH_CONTEXT_MAX_LENGTH]; + unsigned int i, j, comp_count, match_length = 0; const struct ot_gsub_lig *lig; - unsigned int comp_count; + UINT16 lig_glyph; comp_count = table_read_be_word(gsub, offset + FIELD_OFFSET(struct ot_gsub_lig, comp_count)); @@ -5119,16 +5179,46 @@ static BOOL opentype_layout_apply_ligature(struct scriptshaping_context *context if (!lig) return FALSE; + lig_glyph = GET_BE_WORD(lig->lig_glyph); + if (comp_count == 1) { - opentype_layout_replace_glyph(context, GET_BE_WORD(lig->lig_glyph)); + opentype_layout_replace_glyph(context, lig_glyph); context->cur++; return TRUE; } - /* TODO: actually apply ligature */ + if (!opentype_layout_context_match_input(&mc, comp_count, lig->components, &match_length, match_positions)) + return FALSE; - return FALSE; + opentype_layout_replace_glyph(context, lig_glyph); + context->u.buffer.glyph_props[context->cur].components = comp_count; + + /* Positioning against a ligature implies keeping track of ligature component + glyph should be attached to. Update per-glyph property for interleaving glyphs, + 0 means attaching to last component, n - attaching to n-th glyph before last. */ + for (i = 1; i < comp_count; ++i) + { + j = match_positions[i - 1] + 1; + while (j < match_positions[i]) + { + context->u.buffer.glyph_props[j++].lig_component = comp_count - i; + } + opentype_layout_unsafe_to_break(context, i); + context->u.buffer.glyph_props[i].isClusterStart = 0; + context->glyph_infos[i].start_text_idx = 0; + } + + /* Delete ligated glyphs, backwards to preserve index. */ + for (i = 1; i < comp_count; ++i) + { + opentype_layout_delete_glyph(context, match_positions[comp_count - i]); + } + + /* Skip whole matched sequence, accounting for deleted glyphs. */ + context->cur += match_length - (comp_count - 1); + + return TRUE; } static BOOL opentype_layout_apply_gsub_lig_substitution(struct scriptshaping_context *context, const struct lookup *lookup, @@ -5173,7 +5263,7 @@ static BOOL opentype_layout_apply_gsub_lig_substitution(struct scriptshaping_con /* First applicable ligature is used. */ for (i = 0; i < lig_count; ++i) { - if (opentype_layout_apply_ligature(context, offset + GET_BE_WORD(lig_set->offsets[i]))) + if (opentype_layout_apply_ligature(context, offset + GET_BE_WORD(lig_set->offsets[i]), lookup)) return TRUE; } } @@ -5183,38 +5273,6 @@ static BOOL opentype_layout_apply_gsub_lig_substitution(struct scriptshaping_con return FALSE; } -static BOOL opentype_layout_context_match_input(const struct match_context *mc, unsigned int count, const UINT16 *input, - unsigned int *end_offset, unsigned int *match_positions) -{ - struct match_data match_data = { .mc = mc, .subtable_offset = mc->input_offset }; - struct scriptshaping_context *context = mc->context; - struct glyph_iterator iter; - unsigned int i; - - if (count > GLYPH_CONTEXT_MAX_LENGTH) - return FALSE; - - match_positions[0] = context->cur; - - glyph_iterator_init(context, mc->lookup->flags, context->cur, count - 1, &iter); - iter.mask = mc->lookup->mask; - iter.match_func = mc->match_func; - iter.match_data = &match_data; - iter.glyph_data = input; - - for (i = 1; i < count; ++i) - { - if (!glyph_iterator_next(&iter)) - return FALSE; - - match_positions[i] = iter.pos; - } - - *end_offset = iter.pos - context->cur + 1; - - return TRUE; -} - static BOOL opentype_layout_context_match_backtrack(const struct match_context *mc, unsigned int count, const UINT16 *backtrack, unsigned int *match_start) {
1
0
0
0
Nikolay Sivov : dwrite: Normalize glyph data before passing it to matching function.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: cd9f3748793fcf22ed93fccf9c049f83a16fbd31 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=cd9f3748793fcf22ed93fccf…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jun 11 15:08:58 2020 +0300 dwrite: Normalize glyph data before passing it to matching function. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/opentype.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 5def6042be..63b35155b3 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -3746,7 +3746,7 @@ static BOOL opentype_match_class_func(UINT16 glyph, UINT16 glyph_data, const str static BOOL opentype_match_coverage_func(UINT16 glyph, UINT16 glyph_data, const struct match_data *data) { const struct match_context *mc = data->mc; - return opentype_layout_is_glyph_covered(&mc->context->table->table, data->subtable_offset + GET_BE_WORD(glyph_data), glyph) + return opentype_layout_is_glyph_covered(&mc->context->table->table, data->subtable_offset + glyph_data, glyph) != GLYPH_NOT_COVERED; } @@ -3808,8 +3808,10 @@ static enum iterator_match glyph_iterator_may_match(const struct glyph_iterator if (!(iter->mask & iter->context->glyph_infos[iter->pos].mask)) return ITER_NO; + /* Glyph data is used for input, backtrack, and lookahead arrays, swap it here instead of doing that + in all matching functions. */ if (iter->match_func) - return !!iter->match_func(iter->context->u.buffer.glyphs[iter->pos], *iter->glyph_data, iter->match_data); + return !!iter->match_func(iter->context->u.buffer.glyphs[iter->pos], GET_BE_WORD(*iter->glyph_data), iter->match_data); return ITER_MAYBE; }
1
0
0
0
Nikolay Sivov : dwrite: Set initial canBreakShapingAfter flags.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: a6c0eab6de2fc3e654325d4759bb671fcdea948f URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a6c0eab6de2fc3e654325d47…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jun 11 15:08:57 2020 +0300 dwrite: Set initial canBreakShapingAfter flags. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/analyzer.c | 22 +++++++++++----------- dlls/dwrite/dwrite_private.h | 3 +++ dlls/dwrite/opentype.c | 6 +++++- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index af4325248a..f3eca12f96 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -1167,9 +1167,6 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface, get_number_substitutes(substitution, is_rtl, digits); - /* FIXME: have the shaping engine set this */ - memset(text_props, 0, length * sizeof(*text_props)); - font_obj = unsafe_impl_from_IDWriteFontFace(fontface); context.cache = fontface_get_shaping_cache(font_obj); @@ -1179,6 +1176,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface, context.is_sideways = is_sideways; context.u.subst.glyphs = heap_calloc(max_glyph_count, sizeof(*glyphs)); context.u.subst.glyph_props = heap_calloc(max_glyph_count, sizeof(*glyph_props)); + context.u.subst.text_props = text_props; context.u.subst.clustermap = clustermap; context.u.subst.max_glyph_count = max_glyph_count; context.u.subst.capacity = max_glyph_count; @@ -1208,7 +1206,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface, } static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2 *iface, - WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES* props, + WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES *text_props, UINT32 text_len, UINT16 const* glyphs, DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props, UINT32 glyph_count, IDWriteFontFace *fontface, float emSize, BOOL is_sideways, BOOL is_rtl, DWRITE_SCRIPT_ANALYSIS const* analysis, WCHAR const* locale, DWRITE_TYPOGRAPHIC_FEATURES const** features, @@ -1220,8 +1218,8 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2 unsigned int i, script; HRESULT hr; - TRACE("(%s %p %p %u %p %p %u %p %.2f %d %d %s %s %p %p %u %p %p)\n", debugstr_wn(text, text_len), - clustermap, props, text_len, glyphs, glyph_props, glyph_count, fontface, emSize, is_sideways, + TRACE("%s, %p, %p, %u, %p, %p, %u, %p, %.2f, %d, %d, %s, %s, %p, %p, %u, %p, %p.\n", debugstr_wn(text, text_len), + clustermap, text_props, text_len, glyphs, glyph_props, glyph_count, fontface, emSize, is_sideways, is_rtl, debugstr_sa_script(analysis->script), debugstr_w(locale), features, feature_range_lengths, feature_ranges, advances, offsets); @@ -1253,6 +1251,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2 context.is_sideways = is_sideways; context.u.pos.glyphs = glyphs; context.u.pos.glyph_props = glyph_props; + context.u.pos.text_props = text_props; context.u.pos.clustermap = clustermap; context.glyph_count = glyph_count; context.emsize = emSize; @@ -1274,7 +1273,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2 } static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWriteTextAnalyzer2 *iface, - WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES* props, + WCHAR const* text, UINT16 const* clustermap, DWRITE_SHAPING_TEXT_PROPERTIES *text_props, UINT32 text_len, UINT16 const* glyphs, DWRITE_SHAPING_GLYPH_PROPERTIES const* glyph_props, UINT32 glyph_count, IDWriteFontFace *fontface, float emSize, float ppdip, DWRITE_MATRIX const* transform, BOOL use_gdi_natural, BOOL is_sideways, BOOL is_rtl, @@ -1288,10 +1287,10 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite unsigned int i, script; HRESULT hr; - TRACE("(%s %p %p %u %p %p %u %p %.2f %.2f %p %d %d %d %s %s %p %p %u %p %p)\n", debugstr_wn(text, text_len), - clustermap, props, text_len, glyphs, glyph_props, glyph_count, fontface, emSize, ppdip, - transform, use_gdi_natural, is_sideways, is_rtl, debugstr_sa_script(analysis->script), debugstr_w(locale), - features, feature_range_lengths, feature_ranges, advances, offsets); + TRACE("%s, %p, %p, %u, %p, %p, %u, %p, %.2f, %.2f, %p, %d, %d, %d, %s, %s, %p, %p, %u, %p, %p.\n", + debugstr_wn(text, text_len), clustermap, text_props, text_len, glyphs, glyph_props, glyph_count, fontface, + emSize, ppdip, transform, use_gdi_natural, is_sideways, is_rtl, debugstr_sa_script(analysis->script), + debugstr_w(locale), features, feature_range_lengths, feature_ranges, advances, offsets); analyzer_dump_user_features(features, feature_range_lengths, feature_ranges); @@ -1323,6 +1322,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite context.is_sideways = is_sideways; context.u.pos.glyphs = glyphs; context.u.pos.glyph_props = glyph_props; + context.u.pos.text_props = text_props; context.u.pos.clustermap = clustermap; context.glyph_count = glyph_count; context.emsize = emSize * ppdip; diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 7c8a5c9d89..4cb35a44e4 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -552,6 +552,7 @@ struct scriptshaping_context { const UINT16 *glyphs; const DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props; + DWRITE_SHAPING_TEXT_PROPERTIES *text_props; const UINT16 *clustermap; p_apply_context_lookup apply_context_lookup; } pos; @@ -559,6 +560,7 @@ struct scriptshaping_context { UINT16 *glyphs; DWRITE_SHAPING_GLYPH_PROPERTIES *glyph_props; + DWRITE_SHAPING_TEXT_PROPERTIES *text_props; UINT16 *clustermap; p_apply_context_lookup apply_context_lookup; unsigned int max_glyph_count; @@ -569,6 +571,7 @@ struct scriptshaping_context { UINT16 *glyphs; struct shaping_glyph_properties *glyph_props; + DWRITE_SHAPING_TEXT_PROPERTIES *text_props; UINT16 *clustermap; p_apply_context_lookup apply_context_lookup; } buffer; diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index e58ff34cb3..5def6042be 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -5823,6 +5823,7 @@ static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, c BOOL bmp; memset(context->u.subst.glyph_props, 0, context->u.subst.max_glyph_count * sizeof(*context->u.subst.glyph_props)); + memset(context->u.buffer.text_props, 0, context->length * sizeof(*context->u.buffer.text_props)); for (i = 0; i < context->length; ++i) { @@ -5869,9 +5870,12 @@ static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, c /* Set initial cluster map here, it's used for setting user features masks. */ clustermap[i] = cluster_start_idx; - if (!bmp) + if (bmp) + context->u.buffer.text_props[i].canBreakShapingAfter = 1; + else { clustermap[i + 1] = cluster_start_idx; + context->u.buffer.text_props[i + 1].canBreakShapingAfter = 1; ++i; } }
1
0
0
0
Nikolay Sivov : dwrite: Update clustermap once after all features have been applied.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: f7fc249e8f5decaf5f193d5708064065ad0e297d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f7fc249e8f5decaf5f193d57…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Jun 11 15:08:56 2020 +0300 dwrite: Update clustermap once after all features have been applied. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/dwrite_private.h | 4 +++ dlls/dwrite/opentype.c | 59 +++++++++++++++++++------------------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 38863b85bd..7c8a5c9d89 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -513,8 +513,12 @@ struct scriptshaping_cache struct shaping_glyph_info { + /* Combined features mask. */ unsigned int mask; + /* Derived from glyph class, supplied by GDEF. */ unsigned int props; + /* Only relevant for isClusterStart glyphs. Indicates text position for this cluster. */ + unsigned int start_text_idx; }; struct shaping_glyph_properties diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 72cc6f4c93..e58ff34cb3 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -4949,30 +4949,6 @@ static BOOL opentype_layout_gsub_ensure_buffer(struct scriptshaping_context *con return ret; } -static unsigned int opentype_layout_get_next_char_index(const struct scriptshaping_context *context, unsigned int idx) -{ - unsigned int start = 0, end = context->length - 1, mid, ret = ~0u; - - for (;;) - { - mid = (start + end) / 2; - - if (context->u.buffer.clustermap[mid] <= idx) - { - if (mid == end) break; - start = mid + 1; - } - else - { - ret = mid; - if (mid == start) break; - end = mid - 1; - } - } - - return ret; -} - static BOOL opentype_layout_apply_gsub_mult_substitution(struct scriptshaping_context *context, const struct lookup *lookup, unsigned int subtable_offset) { @@ -5053,20 +5029,13 @@ static BOOL opentype_layout_apply_gsub_mult_substitution(struct scriptshaping_co { context->u.subst.glyph_props[idx + i].isClusterStart = 0; context->u.buffer.glyph_props[idx + i].components = 0; + context->glyph_infos[idx + i].start_text_idx = 0; } opentype_set_subst_glyph_props(context, idx + i); /* Inherit feature mask from original matched glyph. */ context->glyph_infos[idx + i].mask = mask; } - /* Update following clusters. */ - idx = opentype_layout_get_next_char_index(context, context->cur); - if (idx != ~0u) - { - for (i = idx; i < context->length; ++i) - context->u.subst.clustermap[i] += glyph_count; - } - context->cur += glyph_count + 1; context->glyph_count += glyph_count; } @@ -5889,6 +5858,7 @@ static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, c if (!g || !opentype_is_diacritic(codepoint)) { context->u.buffer.glyph_props[g].isClusterStart = 1; + context->glyph_infos[g].start_text_idx = i; cluster_start_idx = g; } @@ -5932,7 +5902,7 @@ void opentype_layout_apply_gsub_features(struct scriptshaping_context *context, unsigned int language_index, const struct shaping_features *features) { struct lookups lookups = { 0 }; - unsigned int i; + unsigned int i, j, start_idx; BOOL ret; context->nesting_level_left = SHAPE_MAX_NESTING_LEVEL; @@ -5981,6 +5951,29 @@ void opentype_layout_apply_gsub_features(struct scriptshaping_context *context, } } + /* For every glyph range of [<last>.isClusterStart, <next>.isClusterStart) set corresponding + text span to start_idx. */ + start_idx = 0; + for (i = 1; i < context->glyph_count; ++i) + { + if (context->u.buffer.glyph_props[i].isClusterStart) + { + unsigned int start_text, end_text; + + start_text = context->glyph_infos[start_idx].start_text_idx; + end_text = context->glyph_infos[i].start_text_idx; + + for (j = start_text; j < end_text; ++j) + context->u.buffer.clustermap[j] = start_idx; + + start_idx = i; + } + } + + /* Fill the tail. */ + for (j = context->glyph_infos[start_idx].start_text_idx; j < context->length; ++j) + context->u.buffer.clustermap[j] = start_idx; + heap_free(lookups.lookups); }
1
0
0
0
Dmitry Timoshkov : prntvpt: Add support for custom scaling to ticket XML reader.
by Alexandre Julliard
11 Jun '20
11 Jun '20
Module: wine Branch: master Commit: a7a977efd9cd7d5bf88625d863d8c376ddaffa77 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a7a977efd9cd7d5bf88625d8…
Author: Dmitry Timoshkov <dmitry(a)baikal.ru> Date: Thu Jun 11 14:00:11 2020 +0800 prntvpt: Add support for custom scaling to ticket XML reader. Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/prntvpt/ticket.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/dlls/prntvpt/ticket.c b/dlls/prntvpt/ticket.c index 7f65d60352..36e343bbf2 100644 --- a/dlls/prntvpt/ticket.c +++ b/dlls/prntvpt/ticket.c @@ -297,6 +297,7 @@ static void read_PageOutputColor(IXMLDOMDocument2 *doc, struct ticket *ticket) static void read_PageScaling(IXMLDOMDocument2 *doc, struct ticket *ticket) { IXMLDOMNode *node, *option; + int scaling = 0; HRESULT hr; hr = IXMLDOMDocument2_selectSingleNode(doc, (BSTR)L"psf:PrintTicket/psf:Feature[@name='psk:PageScaling']", &node); @@ -317,13 +318,11 @@ static void read_PageScaling(IXMLDOMDocument2 *doc, struct ticket *ticket) if (hr == S_OK && V_VT(&var) == VT_BSTR) { if (!wcscmp(V_BSTR(&var), L"psk:None")) - ticket->page.scaling = 100; + scaling = 100; + else if (!wcscmp(V_BSTR(&var), L"psk:CustomSquare")) + scaling = 0; /* psk:PageScalingScale */ else - { FIXME("%s\n", wine_dbgstr_w(V_BSTR(&var))); - ticket->page.scaling = 100; - } - TRACE("scaling: %s => %d\n", wine_dbgstr_w(V_BSTR(&var)), ticket->page.scaling); } VariantClear(&var); @@ -332,6 +331,23 @@ static void read_PageScaling(IXMLDOMDocument2 *doc, struct ticket *ticket) } IXMLDOMNode_Release(node); + + if (!scaling) + { + hr = IXMLDOMDocument2_selectSingleNode(doc, (BSTR)L"psf:PrintTicket/psf:ParameterInit[@name='psk:PageScalingScale']", &node); + if (hr == S_OK) + { + read_int_value(node, &scaling); + IXMLDOMNode_Release(node); + } + } + + if (scaling) + ticket->page.scaling = scaling; + else + ticket->page.scaling = 100; + + TRACE("page.scaling: %d\n", ticket->page.scaling); } static void read_PageResolution(IXMLDOMDocument2 *doc, struct ticket *ticket)
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
95
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Results per page:
10
25
50
100
200