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
October 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
796 discussions
Start a n
N
ew thread
Alexandre Julliard : gdi32: Allocate the backend font data in the load_font() helper.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 5772b064ac0194f784640f79701e384a1ffbeb3a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5772b064ac0194f784640f79…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 27 14:25:32 2020 +0100 gdi32: Allocate the backend font data in the load_font() helper. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 5 ----- dlls/gdi32/freetype.c | 20 ++++++-------------- dlls/gdi32/gdi_private.h | 1 - 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 4e1c69d886e..02cd618f956 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -487,11 +487,6 @@ struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_ HeapFree( GetProcessHeap(), 0, font ); return NULL; } - if (font_funcs && !font_funcs->alloc_font( font )) - { - free_gdi_font( font ); - return NULL; - } return font; } diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index b4764d1e8c9..d941fb18bf6 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -3666,18 +3666,6 @@ static UINT get_nearest_charset(const WCHAR *family_name, Face *face, UINT *cp) return DEFAULT_CHARSET; } -/************************************************************* - * freetype_alloc_font - */ -static BOOL CDECL freetype_alloc_font( struct gdi_font *font ) -{ - GdiFont *ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret)); - list_init(&ret->child_fonts); - ret->gdi_font = font; - font->private = ret; - return TRUE; -} - /************************************************************* * freetype_destroy_font */ @@ -4325,12 +4313,17 @@ static DWORD get_ttc_offset( FT_Face ft_face, UINT face_index ) static BOOL load_font( struct gdi_font *gdi_font ) { - GdiFont *font = get_font_ptr( gdi_font ); + GdiFont *font; INT width = 0, height; FT_Face ft_face; void *data_ptr; SIZE_T data_size; + if (!(font = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*font) ))) return FALSE; + gdi_font->private = font; + font->gdi_font = gdi_font; + list_init( &font->child_fonts ); + if (gdi_font->file[0]) { char *filename = wine_get_unix_file_name( gdi_font->file ); @@ -7294,7 +7287,6 @@ static const struct font_backend_funcs font_funcs = freetype_add_font, freetype_add_mem_font, freetype_remove_font, - freetype_alloc_font, freetype_get_font_data, freetype_get_glyph_index, freetype_get_default_glyph, diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index aa6e6ddcaa9..32d50935308 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -376,7 +376,6 @@ struct font_backend_funcs INT (CDECL *add_mem_font)( void *ptr, SIZE_T size, DWORD flags ); BOOL (CDECL *remove_font)( const WCHAR *file, DWORD flags ); - BOOL (CDECL *alloc_font)( struct gdi_font *font ); DWORD (CDECL *get_font_data)( struct gdi_font *gdi_font, DWORD table, DWORD offset, void *buf, DWORD count ); BOOL (CDECL *get_glyph_index)( struct gdi_font *gdi_font, UINT *glyph );
1
0
0
0
Alexandre Julliard : gdi32: Add a helper to load a font without using a face.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 0bf2c11d43cbd36ed258c868491422083f3c7f64 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0bf2c11d43cbd36ed258c868…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 27 14:10:41 2020 +0100 gdi32: Add a helper to load a font without using a face. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 259 ++++++++++++++++++++++++-------------------------- 1 file changed, 122 insertions(+), 137 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=0bf2c11d43cbd36ed258…
1
0
0
0
Alexandre Julliard : gdi32: Move the loading of filesystem fonts out of freetype.c.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 7b291a094d20e315d44ae88a09529581556fd9d6 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7b291a094d20e315d44ae88a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 27 10:27:32 2020 +0100 gdi32: Move the loading of filesystem fonts out of freetype.c. The fonts Path value now expects DOS paths. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 68 ++++++++++++++++++++++++++++++++++---------- dlls/gdi32/freetype.c | 73 ++---------------------------------------------- dlls/gdi32/gdi_private.h | 2 +- 3 files changed, 58 insertions(+), 85 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 3718d73f871..4e1c69d886e 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -359,36 +359,26 @@ CRITICAL_SECTION font_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; #define WINE_FONT_DIR "fonts" #endif -void get_font_dir( WCHAR *path ) +static void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path ) { - static const WCHAR slashW[] = {'\\',0}; - static const WCHAR fontsW[] = {'\\','f','o','n','t','s',0}; + static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0}; static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R',0}; static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0}; if (GetEnvironmentVariableW( winedatadirW, path, MAX_PATH )) { - const char fontdir[] = WINE_FONT_DIR; - strcatW( path, slashW ); + const char fontdir[] = "\\" WINE_FONT_DIR "\\"; MultiByteToWideChar( CP_ACP, 0, fontdir, -1, path + strlenW(path), MAX_PATH - strlenW(path) ); } else if (GetEnvironmentVariableW( winebuilddirW, path, MAX_PATH )) { strcatW( path, fontsW ); } + strcatW( path, file ); if (path[5] == ':') memmove( path, path + 4, (strlenW(path) - 3) * sizeof(WCHAR) ); else path[1] = '\\'; /* change \??\ to \\?\ */ } -static void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path ) -{ - static const WCHAR slashW[] = {'\\',0}; - - get_font_dir( path ); - strcatW( path, slashW ); - strcatW( path, file ); -} - static void get_fonts_win_dir_path( const WCHAR *file, WCHAR *path ) { static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0}; @@ -5402,6 +5392,56 @@ void load_system_bitmap_fonts(void) RegCloseKey( hkey ); } +static void load_directory_fonts( WCHAR *path, UINT flags ) +{ + HANDLE handle; + WIN32_FIND_DATAW data; + WCHAR *p; + + p = path + strlenW(path) - 1; + TRACE( "loading fonts from %s\n", debugstr_w(path) ); + handle = FindFirstFileW( path, &data ); + if (handle == INVALID_HANDLE_VALUE) return; + do + { + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; + strcpyW( p, data.cFileName ); + font_funcs->add_font( path, flags ); + } while (FindNextFileW( handle, &data )); + FindClose( handle ); +} + +void load_file_system_fonts(void) +{ + static const WCHAR pathW[] = {'P','a','t','h',0}; + static const WCHAR slashstarW[] = {'\\','*',0}; + static const WCHAR starW[] = {'*',0}; + WCHAR *ptr, *next, path[MAX_PATH], value[1024]; + DWORD len = ARRAY_SIZE(value); + + /* Windows directory */ + get_fonts_win_dir_path( starW, path ); + load_directory_fonts( path, ADDFONT_ADD_TO_CACHE ); + + /* Wine data directory */ + get_fonts_data_dir_path( starW, path ); + load_directory_fonts( path, ADDFONT_ADD_TO_CACHE | ADDFONT_EXTERNAL_FONT ); + + /* custom paths */ + /* @@ Wine registry key: HKCU\Software\Wine\Fonts */ + if (!RegQueryValueExW( wine_fonts_key, pathW, NULL, NULL, (BYTE *)value, &len )) + { + for (ptr = value; ptr; ptr = next) + { + if ((next = strchrW( ptr, ';' ))) *next++ = 0; + if (next && next - ptr < 2) continue; + lstrcpynW( path, ptr, MAX_PATH - 2 ); + strcatW( path, slashstarW ); + load_directory_fonts( path, ADDFONT_ADD_TO_CACHE | ADDFONT_EXTERNAL_FONT ); + } + } +} + void load_registry_fonts(void) { static const WCHAR dot_fonW[] = {'.','f','o','n',0}; diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index ee628a08304..0a5f5af491b 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -329,7 +329,6 @@ static struct list font_list = LIST_INIT(font_list); static const struct font_backend_funcs font_funcs; -static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\0'}; static const WCHAR win9x_font_reg_key[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', 'W','i','n','d','o','w','s','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', @@ -2545,6 +2544,7 @@ skip_internal: list_add_tail(&system_links, &system_font_link->entry); } +#ifdef __ANDROID__ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts) { DIR *dir; @@ -2585,16 +2585,7 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts) closedir(dir); return TRUE; } - -static void read_font_dir( const WCHAR *dirname, BOOL external_fonts ) -{ - char *unixname = wine_get_unix_file_name( dirname ); - if (unixname) - { - ReadFontDir( unixname, external_fonts ); - HeapFree( GetProcessHeap(), 0, unixname ); - } -} +#endif #ifdef SONAME_LIBFONTCONFIG @@ -3407,24 +3398,9 @@ sym_not_found: static void init_font_list(void) { - static const WCHAR pathW[] = {'P','a','t','h',0}; - HKEY hkey; - WCHAR path[MAX_PATH]; - char *unixname; - delete_external_font_keys(); - load_system_bitmap_fonts(); - - /* load in the fonts from %WINDOWSDIR%\\Fonts first of all */ - GetWindowsDirectoryW(path, ARRAY_SIZE(path)); - strcatW(path, fontsW); - read_font_dir( path, FALSE ); - - /* load the wine fonts */ - get_font_dir( path ); - read_font_dir( path, TRUE ); - + load_file_system_fonts(); load_registry_fonts(); #ifdef SONAME_LIBFONTCONFIG @@ -3434,49 +3410,6 @@ static void init_font_list(void) #elif defined(__ANDROID__) ReadFontDir("/system/fonts", TRUE); #endif - - /* then look in any directories that we've specified in the config file */ - /* @@ Wine registry key: HKCU\Software\Wine\Fonts */ - if(RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts", &hkey) == ERROR_SUCCESS) - { - DWORD len; - LPWSTR valueW; - LPSTR valueA, ptr; - - if (RegQueryValueExW( hkey, pathW, NULL, NULL, NULL, &len ) == ERROR_SUCCESS) - { - len += sizeof(WCHAR); - valueW = HeapAlloc( GetProcessHeap(), 0, len ); - if (RegQueryValueExW( hkey, pathW, NULL, NULL, (LPBYTE)valueW, &len ) == ERROR_SUCCESS) - { - len = WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, NULL, 0, NULL, NULL ); - valueA = HeapAlloc( GetProcessHeap(), 0, len ); - WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, valueA, len, NULL, NULL ); - TRACE( "got font path %s\n", debugstr_a(valueA) ); - ptr = valueA; - while (ptr) - { - const char* home; - LPSTR next = strchr( ptr, ':' ); - if (next) *next++ = 0; - if (ptr[0] == '~' && ptr[1] == '/' && (home = getenv( "HOME" )) && - (unixname = HeapAlloc( GetProcessHeap(), 0, strlen(ptr) + strlen(home) ))) - { - strcpy( unixname, home ); - strcat( unixname, ptr + 1 ); - ReadFontDir( unixname, TRUE ); - HeapFree( GetProcessHeap(), 0, unixname ); - } - else - ReadFontDir( ptr, TRUE ); - ptr = next; - } - HeapFree( GetProcessHeap(), 0, valueA ); - } - HeapFree( GetProcessHeap(), 0, valueW ); - } - RegCloseKey(hkey); - } } static BOOL move_to_front(const WCHAR *name) diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 080f53c1b61..aa6e6ddcaa9 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -389,8 +389,8 @@ struct font_backend_funcs void (CDECL *destroy_font)( struct gdi_font *font ); }; -extern void get_font_dir( WCHAR *path ) DECLSPEC_HIDDEN; extern void load_system_bitmap_fonts(void) DECLSPEC_HIDDEN; +extern void load_file_system_fonts(void) DECLSPEC_HIDDEN; extern void load_registry_fonts(void) DECLSPEC_HIDDEN; extern struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_size ) DECLSPEC_HIDDEN;
1
0
0
0
Alexandre Julliard : gdi32: Move the loading of registry fonts out of freetype.c.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 2c1a42bc675425f9820f05752a9904268a8a610c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2c1a42bc675425f9820f0575…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 27 10:27:20 2020 +0100 gdi32: Move the loading of registry fonts out of freetype.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 49 ++++++++++++++++++++++++++++++++++++++++++-- dlls/gdi32/freetype.c | 53 +----------------------------------------------- dlls/gdi32/gdi_private.h | 3 +-- 3 files changed, 49 insertions(+), 56 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index d4ed29d7fd9..3718d73f871 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -109,6 +109,11 @@ static inline INT INTERNAL_YWSTODS(DC *dc, INT height) return pt[1].y - pt[0].y; } +static inline BOOL is_win9x(void) +{ + return GetVersion() & 0x80000000; +} + static inline WCHAR *strdupW( const WCHAR *p ) { WCHAR *ret; @@ -375,7 +380,7 @@ void get_font_dir( WCHAR *path ) else path[1] = '\\'; /* change \??\ to \\?\ */ } -void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path ) +static void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path ) { static const WCHAR slashW[] = {'\\',0}; @@ -384,7 +389,7 @@ void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path ) strcatW( path, file ); } -void get_fonts_win_dir_path( const WCHAR *file, WCHAR *path ) +static void get_fonts_win_dir_path( const WCHAR *file, WCHAR *path ) { static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0}; @@ -5397,6 +5402,46 @@ void load_system_bitmap_fonts(void) RegCloseKey( hkey ); } +void load_registry_fonts(void) +{ + static const WCHAR dot_fonW[] = {'.','f','o','n',0}; + static const WCHAR win9x_key[] = {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'F','o','n','t','s',0}; + static const WCHAR winnt_key[] = {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'W','i','n','d','o','w','s',' ','N','T','\\', + 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', + 'F','o','n','t','s',0}; + WCHAR value[MAX_PATH], data[MAX_PATH]; + DWORD i = 0, type, dlen, vlen; + HKEY hkey; + + /* Look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts + for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their + full path as the entry. Also look for any .fon fonts, since ReadFontDir + will skip these. */ + if (RegOpenKeyW( HKEY_LOCAL_MACHINE, is_win9x() ? win9x_key : winnt_key, &hkey )) + return; + + vlen = ARRAY_SIZE(value); + dlen = sizeof(data); + while (!RegEnumValueW( hkey, i++, value, &vlen, NULL, &type, (LPBYTE)data, &dlen )) + { + dlen /= sizeof(WCHAR); + if (data[0] && data[1] == ':') + add_font_resource( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ); + else if (dlen >= 6 && !strcmpiW( data + dlen - 5, dot_fonW )) + add_system_font_resource( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ); + + vlen = ARRAY_SIZE(value); + dlen = sizeof(data); + } + RegCloseKey( hkey ); +} + /*********************************************************************** * AddFontResourceExW (GDI32.@) */ diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 0a05f6a701c..ee628a08304 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -768,10 +768,6 @@ static char **expand_mac_font(const char *path) #endif /* HAVE_CARBON_CARBON_H */ -static inline BOOL is_win9x(void) -{ - return GetVersion() & 0x80000000; -} /* This function builds an FT_Fixed from a double. It fails if the absolute value of the float number is greater than 32768. @@ -3411,10 +3407,8 @@ sym_not_found: static void init_font_list(void) { - static const WCHAR dot_fonW[] = {'.','f','o','n','\0'}; static const WCHAR pathW[] = {'P','a','t','h',0}; HKEY hkey; - DWORD valuelen, datalen, i = 0, type, dlen, vlen; WCHAR path[MAX_PATH]; char *unixname; @@ -3431,52 +3425,7 @@ static void init_font_list(void) get_font_dir( path ); read_font_dir( path, TRUE ); - /* now look under HKLM\Software\Microsoft\Windows[ NT]\CurrentVersion\Fonts - for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their - full path as the entry. Also look for any .fon fonts, since ReadFontDir - will skip these. */ - if(RegOpenKeyW(HKEY_LOCAL_MACHINE, - is_win9x() ? win9x_font_reg_key : winnt_font_reg_key, - &hkey) == ERROR_SUCCESS) - { - LPWSTR data, valueW; - RegQueryInfoKeyW(hkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &valuelen, &datalen, NULL, NULL); - - valuelen++; /* returned value doesn't include room for '\0' */ - valueW = HeapAlloc(GetProcessHeap(), 0, valuelen * sizeof(WCHAR)); - data = HeapAlloc(GetProcessHeap(), 0, datalen * sizeof(WCHAR)); - if (valueW && data) - { - dlen = datalen * sizeof(WCHAR); - vlen = valuelen; - while(RegEnumValueW(hkey, i++, valueW, &vlen, NULL, &type, (LPBYTE)data, - &dlen) == ERROR_SUCCESS) - { - if(data[0] && (data[1] == ':')) - { - freetype_add_font( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE); - } - else if(dlen / 2 >= 6 && !strcmpiW(data + dlen / 2 - 5, dot_fonW)) - { - WCHAR pathW[MAX_PATH]; - - get_fonts_win_dir_path( data, pathW ); - if (!freetype_add_font( pathW, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE )) - { - get_fonts_data_dir_path( data, pathW ); - freetype_add_font( pathW, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ); - } - } - /* reset dlen and vlen */ - dlen = datalen; - vlen = valuelen; - } - } - HeapFree(GetProcessHeap(), 0, data); - HeapFree(GetProcessHeap(), 0, valueW); - RegCloseKey(hkey); - } + load_registry_fonts(); #ifdef SONAME_LIBFONTCONFIG load_fontconfig_fonts(); diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 5c4da5d629d..080f53c1b61 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -390,9 +390,8 @@ struct font_backend_funcs }; extern void get_font_dir( WCHAR *path ) DECLSPEC_HIDDEN; -extern void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path ) DECLSPEC_HIDDEN; -extern void get_fonts_win_dir_path( const WCHAR *file, WCHAR *path ) DECLSPEC_HIDDEN; extern void load_system_bitmap_fonts(void) DECLSPEC_HIDDEN; +extern void load_registry_fonts(void) DECLSPEC_HIDDEN; extern struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_size ) DECLSPEC_HIDDEN; extern void free_gdi_font( struct gdi_font *font ) DECLSPEC_HIDDEN;
1
0
0
0
Alexandre Julliard : gdi32: Move the loading of system fonts out of freetype.c.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 131d3b1f5d371257af90593f79d1753d6d53e533 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=131d3b1f5d371257af90593f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Tue Oct 27 10:27:06 2020 +0100 gdi32: Move the loading of system fonts out of freetype.c. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/font.c | 22 ++++++++++++++++++++++ dlls/gdi32/freetype.c | 39 +-------------------------------------- dlls/gdi32/gdi_private.h | 1 + 3 files changed, 24 insertions(+), 38 deletions(-) diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index af87c66498f..d4ed29d7fd9 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -5375,6 +5375,28 @@ static BOOL remove_font_resource( LPCWSTR file, DWORD flags ) return ret; } +void load_system_bitmap_fonts(void) +{ + static const WCHAR keyW[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s',0}; + static const WCHAR fontsW[] = {'F','O','N','T','S','.','F','O','N',0}; + static const WCHAR oemfontW[] = {'O','E','M','F','O','N','T','.','F','O','N',0}; + static const WCHAR fixedfonW[] = {'F','I','X','E','D','F','O','N','.','F','O','N',0}; + static const WCHAR * const fonts[] = { fontsW, oemfontW, fixedfonW }; + + HKEY hkey; + WCHAR data[MAX_PATH]; + DWORD i, dlen, type; + + if (RegOpenKeyW( HKEY_CURRENT_CONFIG, keyW, &hkey )) return; + for (i = 0; i < ARRAY_SIZE(fonts); i++) + { + dlen = sizeof(data); + if (!RegQueryValueExW( hkey, fonts[i], 0, &type, (BYTE *)data, &dlen ) && type == REG_SZ) + add_system_font_resource( data, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ); + } + RegCloseKey( hkey ); +} + /*********************************************************************** * AddFontResourceExW (GDI32.@) */ diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 9ed6077443f..0a05f6a701c 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -340,18 +340,6 @@ static const WCHAR winnt_font_reg_key[] = {'S','o','f','t','w','a','r','e','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', 'F','o','n','t','s','\0'}; -static const WCHAR system_fonts_reg_key[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'}; -static const WCHAR FixedSys_Value[] = {'F','I','X','E','D','F','O','N','.','F','O','N','\0'}; -static const WCHAR System_Value[] = {'F','O','N','T','S','.','F','O','N','\0'}; -static const WCHAR OEMFont_Value[] = {'O','E','M','F','O','N','T','.','F','O','N','\0'}; - -static const WCHAR * const SystemFontValues[] = { - System_Value, - OEMFont_Value, - FixedSys_Value, - NULL -}; - static const WCHAR external_fonts_reg_key[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\', 'F','o','n','t','s','\\','E','x','t','e','r','n','a','l',' ','F','o','n','t','s','\0'}; @@ -2861,30 +2849,6 @@ static void load_mac_fonts(void) #endif -static void load_system_fonts(void) -{ - HKEY hkey; - WCHAR data[MAX_PATH], pathW[MAX_PATH]; - const WCHAR * const *value; - DWORD dlen, type; - - if(RegOpenKeyW(HKEY_CURRENT_CONFIG, system_fonts_reg_key, &hkey) == ERROR_SUCCESS) { - for(value = SystemFontValues; *value; value++) { - dlen = sizeof(data); - if(RegQueryValueExW(hkey, *value, 0, &type, (void*)data, &dlen) == ERROR_SUCCESS && - type == REG_SZ) { - get_fonts_win_dir_path( data, pathW ); - if (!freetype_add_font( pathW, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE )) - { - get_fonts_data_dir_path( data, pathW ); - freetype_add_font( pathW, ADDFONT_ALLOW_BITMAP | ADDFONT_ADD_TO_CACHE ); - } - } - } - RegCloseKey(hkey); - } -} - static WCHAR *get_full_path_name(const WCHAR *name) { WCHAR *full_path; @@ -3456,8 +3420,7 @@ static void init_font_list(void) delete_external_font_keys(); - /* load the system bitmap fonts */ - load_system_fonts(); + load_system_bitmap_fonts(); /* load in the fonts from %WINDOWSDIR%\\Fonts first of all */ GetWindowsDirectoryW(path, ARRAY_SIZE(path)); diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 32cdace5c7d..5c4da5d629d 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -392,6 +392,7 @@ struct font_backend_funcs extern void get_font_dir( WCHAR *path ) DECLSPEC_HIDDEN; extern void get_fonts_data_dir_path( const WCHAR *file, WCHAR *path ) DECLSPEC_HIDDEN; extern void get_fonts_win_dir_path( const WCHAR *file, WCHAR *path ) DECLSPEC_HIDDEN; +extern void load_system_bitmap_fonts(void) DECLSPEC_HIDDEN; extern struct gdi_font *alloc_gdi_font( const WCHAR *file, void *data_ptr, SIZE_T data_size ) DECLSPEC_HIDDEN; extern void free_gdi_font( struct gdi_font *font ) DECLSPEC_HIDDEN;
1
0
0
0
Huw Davies : riched20: Fix the struct size check in the para fmt retrieval function.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 9908c5d3c44b80552947096c97146609e98430e9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9908c5d3c44b80552947096c…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 27 08:23:30 2020 +0000 riched20: Fix the struct size check in the para fmt retrieval function. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/para.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c index e1b848cf8f9..c7a0e271510 100644 --- a/dlls/riched20/para.c +++ b/dlls/riched20/para.c @@ -928,7 +928,8 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) ME_DisplayItem *para, *para_end; PARAFORMAT2 *curFmt; - if (pFmt->cbSize < sizeof(PARAFORMAT)) { + if (pFmt->cbSize < sizeof(PARAFORMAT)) + { pFmt->dwMask = 0; return; } @@ -951,13 +952,14 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) CHECK_FIELD(PFM_RIGHTINDENT, dxRightIndent); CHECK_FIELD(PFM_OFFSET, dxOffset); CHECK_FIELD(PFM_ALIGNMENT, wAlignment); - if (pFmt->dwMask & PFM_TABSTOPS) { + if (pFmt->dwMask & PFM_TABSTOPS) + { if (pFmt->cTabCount != para->member.para.fmt.cTabCount || memcmp(pFmt->rgxTabs, curFmt->rgxTabs, curFmt->cTabCount*sizeof(int))) pFmt->dwMask &= ~PFM_TABSTOPS; } - if (pFmt->dwMask >= sizeof(PARAFORMAT2)) + if (pFmt->cbSize >= sizeof(PARAFORMAT2)) { pFmt->dwMask &= ~((pFmt->wEffects ^ curFmt->wEffects) << 16); CHECK_FIELD(PFM_SPACEBEFORE, dySpaceBefore);
1
0
0
0
Huw Davies : riched20: Use row and para ptrs in the ensure visible function.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 1abbb78a0949f238cca4b8e09aa0c7ee085d1389 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1abbb78a0949f238cca4b8e0…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 27 08:23:29 2020 +0000 riched20: Use row and para ptrs in the ensure visible function. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/caret.c | 10 ++++------ dlls/riched20/editor.c | 2 +- dlls/riched20/editor.h | 2 +- dlls/riched20/paint.c | 25 ++++++++++++------------- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 6a8f1e1cd71..47fe77df922 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1176,13 +1176,11 @@ void ME_MouseMove(ME_TextEditor *editor, int x, int y) if (editor->nSelectionType != stPosition && memcmp(&editor->pCursors[1], &editor->pCursors[3], sizeof(ME_Cursor))) - { /* The scroll the cursor towards the other end, since it was the one * extended by ME_ExtendAnchorSelection */ - ME_EnsureVisible(editor, &editor->pCursors[1]); - } else { - ME_EnsureVisible(editor, &editor->pCursors[0]); - } + editor_ensure_visible( editor, &editor->pCursors[1] ); + else + editor_ensure_visible( editor, &editor->pCursors[0] ); ME_InvalidateSelection(editor); update_caret(editor); @@ -1520,7 +1518,7 @@ ME_ArrowKey(ME_TextEditor *editor, int nVKey, BOOL extend, BOOL ctrl) ME_InvalidateSelection(editor); ME_Repaint(editor); hide_caret(editor); - ME_EnsureVisible(editor, &tmp_curs); + editor_ensure_visible( editor, &tmp_curs ); update_caret(editor); ME_SendSelChange(editor); return success; diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 6a2e96a3c7c..462245db233 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -4095,7 +4095,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, return len; } case EM_SCROLLCARET: - ME_EnsureVisible(editor, &editor->pCursors[0]); + editor_ensure_visible( editor, &editor->pCursors[0] ); return 0; case WM_SETFONT: { diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index ba1e5c169ff..1a2346854e7 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -242,7 +242,7 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLS void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN; -void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor) DECLSPEC_HIDDEN; +void editor_ensure_visible( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN; void ME_InvalidateSelection(ME_TextEditor *editor) DECLSPEC_HIDDEN; BOOL ME_SetZoom(ME_TextEditor *editor, int numerator, int denominator) DECLSPEC_HIDDEN; int ME_twips2pointsX(const ME_Context *c, int x) DECLSPEC_HIDDEN; diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 0c37fc7c707..180307ae01b 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -117,7 +117,7 @@ void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) ME_UpdateScrollBar(editor); /* Ensure that the cursor is visible */ - ME_EnsureVisible(editor, &editor->pCursors[0]); + editor_ensure_visible( editor, &editor->pCursors[0] ); ITextHost_TxViewChange(editor->texthost, update_now); @@ -1269,19 +1269,17 @@ void ME_UpdateScrollBar(ME_TextEditor *editor) } } -void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor) +void editor_ensure_visible( ME_TextEditor *editor, ME_Cursor *cursor ) { - ME_Run *pRun = &pCursor->pRun->member.run; - ME_DisplayItem *pRow = ME_FindItemBack(pCursor->pRun, diStartRow); - ME_DisplayItem *pPara = pCursor->pPara; + ME_Run *run = &cursor->pRun->member.run; + ME_Row *row = row_from_cursor( cursor ); + ME_Paragraph *para = &cursor->pPara->member.para; int x, y, yheight; - assert(pRow); - assert(pPara); if (editor->styleFlags & ES_AUTOHSCROLL) { - x = pRun->pt.x + ME_PointFromChar(editor, pRun, pCursor->nOffset, TRUE); + x = run->pt.x + ME_PointFromChar( editor, run, cursor->nOffset, TRUE ); if (x > editor->horz_si.nPos + editor->sizeWindow.cx) x = x + 1 - editor->sizeWindow.cx; else if (x > editor->horz_si.nPos) @@ -1292,14 +1290,15 @@ void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor) ME_HScrollAbs(editor, x); return; } - } else { - if (~editor->styleFlags & ES_AUTOVSCROLL) - return; + } + else + { + if (~editor->styleFlags & ES_AUTOVSCROLL) return; x = editor->horz_si.nPos; } - y = pPara->member.para.pt.y + pRow->member.row.pt.y; - yheight = pRow->member.row.nHeight; + y = para->pt.y + row->pt.y; + yheight = row->nHeight; if (y < editor->vert_si.nPos) ME_ScrollAbs(editor, x, y);
1
0
0
0
Huw Davies : riched20: Use a row ptr in the run drawing function.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 30ad0b936a96c403db6476ba45f2f455b613df3c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=30ad0b936a96c403db6476ba…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 27 08:23:28 2020 +0000 riched20: Use a row ptr in the run drawing function. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/editor.h | 2 +- dlls/riched20/paint.c | 41 +++++++++++++++++++++-------------------- dlls/riched20/richole.c | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index f4484f57d39..ba1e5c169ff 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -264,7 +264,7 @@ int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN; /* richole.c */ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj) DECLSPEC_HIDDEN; -void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, BOOL selected) DECLSPEC_HIDDEN; +void draw_ole( ME_Context *c, int x, int y, ME_Run* run, BOOL selected ) DECLSPEC_HIDDEN; void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN; void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN; void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN; diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 42f370c857c..0c37fc7c707 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -359,8 +359,8 @@ static void draw_text( ME_Context *c, ME_Run *run, int x, int y, BOOL selected, } -static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, - int nSelFrom, int nSelTo, int ymin, int cy) +static void draw_text_with_style( ME_Context *c, ME_Run *run, int x, int y, + int nSelFrom, int nSelTo, int ymin, int cy ) { HDC hDC = c->hDC; int yOffset = 0; @@ -434,16 +434,16 @@ static void ME_DebugWrite(HDC hDC, const POINT *pt, LPCWSTR szText) { SetTextColor(hDC, color); } -static void ME_DrawRun( ME_Context *c, int x, int y, ME_Run *run, ME_Paragraph *para ) +static void draw_run( ME_Context *c, int x, int y, ME_Cursor *cursor ) { - ME_DisplayItem *start; - int runofs = run->nCharOfs+para->nCharOfs; + ME_Row *row; + ME_Run *run = &cursor->pRun->member.run; + int runofs = run_char_ofs( run, cursor->nOffset ); int nSelFrom, nSelTo; - if (run->nFlags & MERF_HIDDEN) - return; + if (run->nFlags & MERF_HIDDEN) return; - start = ME_FindItemBack( run_get_di( run ), diStartRow ); + row = row_from_cursor( cursor ); ME_GetSelectionOfs(c->editor, &nSelFrom, &nSelTo); /* Draw selected end-of-paragraph mark */ @@ -452,8 +452,7 @@ static void ME_DrawRun( ME_Context *c, int x, int y, ME_Run *run, ME_Paragraph * if (runofs >= nSelFrom && runofs < nSelTo) { draw_space( c, run, x, y, TRUE, FALSE, - c->pt.y + para->pt.y + start->member.row.pt.y, - start->member.row.nHeight ); + c->pt.y + run->para->pt.y + row->pt.y, row->nHeight ); } return; } @@ -463,19 +462,15 @@ static void ME_DrawRun( ME_Context *c, int x, int y, ME_Run *run, ME_Paragraph * BOOL selected = runofs >= nSelFrom && runofs < nSelTo; draw_space( c, run, x, y, selected, TRUE, - c->pt.y + para->pt.y + start->member.row.pt.y, - start->member.row.nHeight ); + c->pt.y + run->para->pt.y + row->pt.y, row->nHeight ); return; } if (run->nFlags & MERF_GRAPHICS) - ME_DrawOLE(c, x, y, run, (runofs >= nSelFrom) && (runofs < nSelTo)); + draw_ole( c, x, y, run, (runofs >= nSelFrom) && (runofs < nSelTo) ); else - { - ME_DrawTextWithStyle(c, run, x, y, nSelFrom - runofs, nSelTo - runofs, - c->pt.y + para->pt.y + start->member.row.pt.y, - start->member.row.nHeight); - } + draw_text_with_style( c, run, x, y, nSelFrom - runofs, nSelTo - runofs, + c->pt.y + run->para->pt.y + row->pt.y, row->nHeight ); } /* The documented widths are in points (72 dpi), but converting them to @@ -1001,8 +996,14 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para ) FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT)); } if (visible) - ME_DrawRun( c, c->pt.x + run->pt.x, - c->pt.y + para->pt.y + run->pt.y + baseline, run, para ); + { + ME_Cursor cursor; + + cursor.pRun = run_get_di( run ); + cursor.pPara = para_get_di( para ); + cursor.nOffset = 0; + draw_run( c, c->pt.x + run->pt.x, c->pt.y + para->pt.y + run->pt.y + baseline, &cursor ); + } if (me_debug) { static const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0}; diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index 21b63911954..015326c5abc 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -5846,7 +5846,7 @@ void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) } } -void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run, BOOL selected) +void draw_ole( ME_Context *c, int x, int y, ME_Run *run, BOOL selected ) { IDataObject* ido; FORMATETC fmt;
1
0
0
0
Huw Davies : riched20: Use a run helper in the delete text function.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 0d50e0182d6c8331cc468a8b25807c33e033531a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0d50e0182d6c8331cc468a8b…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 27 08:23:27 2020 +0000 riched20: Use a run helper in the delete text function. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/caret.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index d92b93ac2f0..6a8f1e1cd71 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -405,8 +405,8 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start, } if (pThisCur->nOffset == run->len) { - pThisCur->pRun = ME_FindItemFwd(pThisCur->pRun, diRunOrParagraphOrEnd); - assert(pThisCur->pRun->type == diRun); + pThisCur->pRun = run_get_di( run_next( &pThisCur->pRun->member.run ) ); + assert( pThisCur->pRun ); pThisCur->nOffset = 0; } }
1
0
0
0
Huw Davies : riched20: Use row and para helpers in the extend selection function.
by Alexandre Julliard
27 Oct '20
27 Oct '20
Module: wine Branch: master Commit: 245b9231c555a989138b3c97c6bef68f68973320 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=245b9231c555a989138b3c97…
Author: Huw Davies <huw(a)codeweavers.com> Date: Tue Oct 27 08:23:26 2020 +0000 riched20: Use row and para helpers in the extend selection function. Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/riched20/caret.c | 58 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 834f9fd3afe..d92b93ac2f0 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1044,37 +1044,53 @@ static void ME_ExtendAnchorSelection(ME_TextEditor *editor) { /* Extend the left side of selection */ editor->pCursors[1] = tmp_cursor; - if (editor->nSelectionType == stWord) + switch (editor->nSelectionType) + { + case stWord: ME_MoveCursorWords(editor, &editor->pCursors[1], -1); - else + break; + + case stLine: { - ME_DisplayItem *pItem; - ME_DIType searchType = ((editor->nSelectionType == stLine) ? - diStartRowOrParagraph:diParagraph); - pItem = ME_FindItemBack(editor->pCursors[1].pRun, searchType); - editor->pCursors[1].pRun = ME_FindItemFwd(pItem, diRun); - editor->pCursors[1].pPara = ME_GetParagraph(editor->pCursors[1].pRun); + ME_Row *row = row_from_cursor( editor->pCursors + 1 ); + row_first_cursor( row, editor->pCursors + 1 ); + break; + } + + case stParagraph: + editor->pCursors[1].pRun = run_get_di( para_first_run( &editor->pCursors[1].pPara->member.para ) ); editor->pCursors[1].nOffset = 0; + break; + + default: + break; } } else if (curOfs >= anchorEndOfs) { /* Extend the right side of selection */ editor->pCursors[0] = tmp_cursor; - if (editor->nSelectionType == stWord) - ME_MoveCursorWords(editor, &editor->pCursors[0], +1); - else + switch (editor->nSelectionType) { - ME_DisplayItem *pItem; - ME_DIType searchType = ((editor->nSelectionType == stLine) ? - diStartRowOrParagraphOrEnd:diParagraphOrEnd); - pItem = ME_FindItemFwd(editor->pCursors[0].pRun, searchType); - if (pItem->type == diTextEnd) - editor->pCursors[0].pRun = ME_FindItemBack(pItem, diRun); - else - editor->pCursors[0].pRun = ME_FindItemFwd(pItem, diRun); - editor->pCursors[0].pPara = ME_GetParagraph(editor->pCursors[0].pRun); - editor->pCursors[0].nOffset = 0; + case stWord: + ME_MoveCursorWords( editor, &editor->pCursors[0], +1 ); + break; + + case stLine: + { + ME_Row *row = row_from_cursor( editor->pCursors ); + row_end_cursor( row, editor->pCursors, TRUE ); + break; + } + + case stParagraph: + editor->pCursors[0].pRun = run_get_di( para_end_run( &editor->pCursors[0].pPara->member.para ) ); + editor->pCursors[0].pPara = para_get_di( editor->pCursors[0].pRun->member.run.para ); + editor->pCursors[0].nOffset = editor->pCursors[0].pRun->member.run.len; + break; + + default: + break; } } }
1
0
0
0
← Newer
1
...
7
8
9
10
11
12
13
...
80
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
Results per page:
10
25
50
100
200