Commit Graph

89 Commits (jgrpp)

Author SHA1 Message Date
Peter Nelson 009fea0e14 Fix: Memory leak in ICUParagraphLayout::NextLine() (#11895)
This function calls icu::BreakIterator::createLineInstance() but does not clean up after it.

Instead use a static instance that is cloned (for thread-safety) and deleted as necessary.

(cherry picked from commit 6d276698b6)
4 months ago
Peter Nelson 17934bcc90 Fix #11827: Make Layouter::GetCharPosition() aware of ligatures. (#11831)
When ligatures happen the precise individual character position is not known, so instead return the previous position (which is that of the ligature.)

(cherry picked from commit d6ccfdbbd9)
4 months ago
Jonathan G Rennison 5404be172c Merge branch 'master' into jgrpp
# Conflicts:
#	src/core/bitmath_func.cpp
#	src/core/bitmath_func.hpp
#	src/core/geometry_type.hpp
#	src/game/game_text.hpp
#	src/graph_gui.cpp
#	src/pathfinder/npf/npf.cpp
#	src/script/api/script_text.cpp
#	src/spritecache.cpp
#	src/track_func.h
4 months ago
Peter Nelson ae575a7a5b Codechange: Store text run positions in vector of points.
This simplifies the interlaced vector of x/y positions.
4 months ago
Jonathan G Rennison d7b75614bb Merge branch 'master' into jgrpp
# Conflicts:
#	media/baseset/CMakeLists.txt
#	src/build_vehicle_gui.cpp
#	src/console.cpp
#	src/debug.cpp
#	src/fontcache/freetypefontcache.cpp
#	src/network/network.cpp
#	src/openttd.cpp
#	src/os/macosx/font_osx.cpp
#	src/os/windows/font_win32.cpp
#	src/settings_gui.cpp
#	src/video/sdl2_v.cpp
#	src/widgets/settings_widget.h
#	src/window_gui.h
4 months ago
Peter Nelson a6873ef7dd
Codechange: Avoid repeatedly calling virtual methods in text drawing loop. (#11774) 4 months ago
Jonathan G Rennison 97e6f3062e Adding of _t to (u)int types, and WChar to char32_t
See: eaae0bb5e
4 months ago
Jonathan G Rennison c929f7075e Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/SourceList.cmake
#	src/build_vehicle_gui.cpp
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/depot_base.h
#	src/elrail.cpp
#	src/network/core/udp.cpp
#	src/network/network_admin.cpp
#	src/network/network_chat_gui.cpp
#	src/network/network_gui.cpp
#	src/network/network_server.cpp
#	src/newgrf.cpp
#	src/newgrf_engine.cpp
#	src/newgrf_railtype.cpp
#	src/newgrf_railtype.h
#	src/newgrf_storage.h
#	src/os/unix/crashlog_unix.cpp
#	src/rail.h
#	src/rail_cmd.cpp
#	src/rail_gui.cpp
#	src/road_cmd.cpp
#	src/road_map.h
#	src/saveload/labelmaps_sl.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/sl/oldloader_sl.cpp
#	src/station_cmd.cpp
#	src/station_gui.cpp
#	src/table/settings/world_settings.ini
#	src/tests/test_script_admin.cpp
#	src/textfile_gui.cpp
#	src/toolbar_gui.cpp
#	src/train_cmd.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle_gui.cpp
#	src/widget.cpp
#	src/window.cpp
#	src/window_gui.h
#	src/window_type.h
6 months ago
Jonathan G Rennison aa4aee1d23 Remove NOT_REACHED from Layouter::GetCharPosition
Return begin/end value for unknown code point index or out of range input

See: #596, #598, https://github.com/OpenTTD/OpenTTD/issues/11291
8 months ago
Niels Martin Hansen 4765d0f8c2 Change: Text Layouter support querying all lines for character at pixel 8 months ago
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
10 months ago
Niels Martin Hansen f55027a8f4 Fix: Layouter not taking stripped formatting codes into account when mapping visual coordinates to/from original string
(cherry picked from commit 103d88ee33)
11 months ago
Niels Martin Hansen 1793a5881d Fix: Layouter::GetCharAtPosition counting wrong
Bug introduced in commit 60399e

(cherry picked from commit ed3f14686d)
11 months ago
Rubidium 78d28d432b Codechange: allocate enough memory to layout the strings
(cherry picked from commit 96fef9f643)
11 months ago
Niels Martin Hansen 103d88ee33 Fix: Layouter not taking stripped formatting codes into account when mapping visual coordinates to/from original string 11 months ago
Niels Martin Hansen ed3f14686d Fix: Layouter::GetCharAtPosition counting wrong
Bug introduced in commit 60399e
11 months ago
Rubidium 96fef9f643 Codechange: allocate enough memory to layout the strings 12 months ago
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 1 year ago
Peter Nelson bf8f24f9a8 Codechange: Use unique_ptr for text layout font mapping.
This must stay a pointer as the value passed to other structures.
1 year ago
Peter Nelson c38df2d589 Codechange: Use std::map instead of custom SmallMap. 1 year ago
Patric Stout a05ae2497f Codechange: simplify how GetCharPosition() works 1 year ago
Patric Stout 60399e17bd Codechange: C++-ify the Layouter and related functions
They all now access a std::string_view, instead of a "const char *"
or std::string (in some cases).

Additionally, GetCharAtPosition and friends now return an index
instead of a "const char *", as it makes for a more clear interface.
1 year ago
Patric Stout 81d4fa6999 Feature: drop ICU-lx in favour of directly interfacing with harfbuzz
This means we have RTL support again with ICU 58+. It makes use of:
- ICU for bidi-itemization
- ICU for script-itemization
- OpenTTD for style-itemization
- harfbuzz for shaping
1 year ago
Patric Stout 9cb60768fe Codechange: split implementations of ParagraphLayouterFactory into their own file 1 year ago
Rubidium c578917783 Fix #10057: FallbackParagraphLayout fails to properly wrap
... during the first word after a new run has been started.
1 year ago
Peter Nelson daaa058493 Change: Vertically centre sprite font relative to TrueType font. 1 year ago
PeterN cea62ef73d
Fix #10161: Ignore ascender in FallbackLayouter for non-built-in fonts. (#10169) 2 years ago
Peter Nelson 9666e46739 Feature: Variable GUI scale.
GUI scale is now variable from 100% to 500%, and no longer restricted to
powers-of-2.
2 years ago
Frédéric Simonis ac4a7d02c7
Codechange: Improve LineCache queries (#9417)
Adds the support to query the linecache without copying the string.
This uses a custom transparent comparator in conjunction with
a query type using a std::string_view.
3 years ago
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 3 years ago
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 3 years ago
Lars Wendler cf29d23ba4 Fix: build with icu-68.1
icu-68.1 removed public macro definitions for TRUE and FALSE

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
4 years ago
glx 0c80ae5288 Fix: Ignore not printable characters when layouting a string 4 years ago
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 5 years ago
Charles Pigott 150884a93f Fix: Remove workaround for clang-3.8, now that GCC9 warns about it 5 years ago
pnda a35b43ce93 Fix #6666: Mismatched parentheses in RTL languages 5 years ago
Henry Wilson 7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 5 years ago
Michael Lutz baf9229931 Codechange: Replace AutoDeleteSmallVector with direct std::vector use in text layout code. 5 years ago
Michael Lutz 329bb52613 Codechange: Store text layout runs directly as values in a std::vector instead of heap allocated.
This reduces memory allocations and heap fragmentation.
5 years ago
Michael Lutz fbc4cef180 Codechange: Use override specifier for text layout classes. 5 years ago
glx22 66dd7c3879
Fix: MSVC warnings (#7423) 5 years ago
Henry Wilson cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 5 years ago
Henry Wilson ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 5 years ago
Henry Wilson a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 5 years ago
Henry Wilson 097328c3d7 Codechange: Replaced SmallVector::Get() const with std alternatives 5 years ago
Henry Wilson a690936ed7 Codechange: Replace SmallVector::Length() with std::vector::size() 5 years ago
Henry Wilson bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 5 years ago
Patric Stout 52d7e7d45e Codechange: ICU_LAYOUT is in reality ICU_LX (according to their CMake files)
By naming it in a different way, things get a bit confusing.
Especially if we are switching to CMake, which autodetects these
things, we need to use the name the authors of ICU gave it; not
our interpertation of that name.
5 years ago
Michael Lutz 32ce1ce347 Add: [OSX] Text layout using the native CoreText API.
By default, the native API will be used instead of ICU, but if ICU is
forced in using configure, it will take precedence.
6 years ago
Charles Pigott e0c0394e37 Fix: Remove various dead or unnecessary assignments 6 years ago