Commit Graph

43 Commits

Author SHA1 Message Date
Peter Nelson
6d276698b6
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.
2024-01-27 20:13:42 +00:00
Peter Nelson
ae575a7a5b Codechange: Store text run positions in vector of points.
This simplifies the interlaced vector of x/y positions.
2024-01-19 00:08:31 +00:00
Peter Nelson
f7cc88f370 Codechange: Return vector references instead of pointer to first item. 2024-01-19 00:08:31 +00:00
Niels Martin Hansen
4765d0f8c2 Change: Text Layouter support querying all lines for character at pixel 2023-09-13 16:11:08 +02:00
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
2023-07-19 19:30:14 +02:00
Peter Nelson
bf8f24f9a8 Codechange: Use unique_ptr for text layout font mapping.
This must stay a pointer as the value passed to other structures.
2023-05-18 12:18:30 +01:00
Peter Nelson
c38df2d589 Codechange: Use std::map instead of custom SmallMap. 2023-05-18 12:18:30 +01:00
Peter Nelson
56085be9bd Codechange: Move includes for common STL headers to stdafx. 2023-05-17 10:14:41 +01:00
Patric Stout
199e41c762
Codechange: use default dtor instead of empty (#10826) 2023-05-14 23:31:03 +02:00
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.
2023-05-08 19:21:42 +02:00
Rubidium
68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +02:00
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
2023-05-01 22:17:56 +02:00
Peter Nelson
23c46e1abf Fix: #10735: {POP_COLOUR} fails if string is drawn with extra flags. 2023-04-28 23:12:07 +01:00
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.
2021-08-16 11:18:47 +02:00
glx
42144ecd56 Add: a TextColour flag to ignore colour changes from strings 2019-12-23 17:30:13 +00:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Henry Wilson
7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz
baf9229931 Codechange: Replace AutoDeleteSmallVector with direct std::vector use in text layout code. 2019-04-09 22:45:15 +02:00
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.
2019-04-09 22:45:15 +02:00
Henry Wilson
cc62f4163f Cleanup: Remove unused size template parameters from SmallMap and Auto[Free|Delete]SmallVector 2019-03-26 20:15:57 +00:00
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.
2019-03-11 10:16:00 +01:00
PeterN
63fe6c6598
Codechange: Make std::stack use std::vector container in string formatting/drawing. (#7305)
This is a very minor performance increase which can add up during operations such
as sorting. Performance impact my be platform/compiler dependent.
2019-03-02 08:06:02 +00:00
Stefan Strogin
fec44b0d09 Fix #6854: Compilation with ICU 62 (#6912) 2018-09-20 22:36:45 +02:00
PeterN
3b32075e8a
Add: {PUSH_COLOUR} and {POP_COLOUR} control codes to handle switching colours. (#6737)
This replaces the internal SCC_PREVIOUS_COLOUR swap.
2018-04-19 19:33:21 +01:00
rubidium
69fac508c3 (svn r27367) -Codechange: make a distinction between the layouting part of ICU (lx) or the sorting/collation part of ICU (i18n) 2015-08-09 12:33:27 +00:00
michi_cc
b0b20192a9 (svn r26029) -Fix (r26017): The internal index of a character in the layout line depends on the used layouter. 2013-11-17 17:08:20 +00:00
rubidium
4c5ccc8b94 (svn r26018) -Codechange: since there's a wrapper for ICU functions now, we can use proper coding style for names again 2013-11-16 21:05:26 +00:00
rubidium
ddc0026712 (svn r26017) -Change: allow the fallback and ICU layouter to exist in unison
-Fix [FS#5711]: crash when the ICU layouter thinks a font is corrupted
2013-11-16 20:57:54 +00:00
rubidium
6449e96f1a (svn r26016) -Codechange: prepare for some class renames 2013-11-16 20:32:55 +00:00
rubidium
b9e4697d8a (svn r26015) -Codechange: some constificaton 2013-11-16 19:59:06 +00:00
michi_cc
bd02761b55 (svn r25696) -Fix (r25651): Missing function in the non-ICU paragraph layouter. 2013-08-06 17:35:11 +00:00
michi_cc
30867c487f (svn r25691) -Add: [OSX] Support for mouse selection in the IME composition string. 2013-08-05 20:37:53 +00:00
michi_cc
33f3cf3a5d (svn r25651) -Fix: Textbuf caret rendering for complex scripts (e.g. Tamil). 2013-08-05 20:35:23 +00:00
frosch
0c0db5c4c7 (svn r25574) -Fix (r25570): Trouble with initialisation order of static members of Layouter and FontCache. 2013-07-07 12:07:06 +00:00
frosch
d0eff986be (svn r25570) -Add: cache for ParagraphLayouts. 2013-07-06 19:00:33 +00:00
frosch
4824cb7886 (svn r25569) -Codechange: Cache all Font instances in a static container. 2013-07-06 18:56:23 +00:00
frosch
3fa1b4e8c3 (svn r25567) -Codechange: Revive dead DrawStringParams as FontState. 2013-07-06 18:54:26 +00:00
rubidium
0c14a586bd (svn r25493) -Codechange: support for the safer variant of ICU's getFontTable 2013-06-27 21:21:47 +00:00
rubidium
6ab0545022 (svn r25483) -Fix: don't commit too much... 2013-06-27 16:25:30 +00:00
rubidium
569eaf0e11 (svn r25482) -Fix [FS#5620]: forced newlines were not properly handled 2013-06-27 16:24:19 +00:00
rubidium
48c1e4f87e (svn r25470) -Feature-ish: use ICU's layout engine when that's available 2013-06-25 20:40:58 +00:00
rubidium
4f0ef61d4e (svn r25466) -Add: drawing routine for the layout engine 2013-06-25 20:38:12 +00:00
rubidium
2446b8ea60 (svn r25465) -Codechange: add the concept of a layouting engine for text 2013-06-25 20:29:31 +00:00