1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00
Commit graph

47 commits

Author SHA1 Message Date
attila
b72343cf8c Fix font sizing with the software and OpenGL renderers when ascent override is used 2025-10-24 11:22:15 +02:00
reuk
e525e12061
JustifiedText: Fix caret positioning when clicking on a trailing whitespace
When clicking in a TextEditor to position the caret, the caret would be
placed at the penultimate position when clicking at the end of a line
with trailing non-newline whitespaces.

Co-authored-by: Aga Janowicz <aga@roli.com>
2025-10-20 17:34:48 +01:00
reuk
3a0135ffb7
SimpleShapedText: Fix detection of control characters
Newlines get removed in the sanitised string, so we need to take extra
steps to keep track of their positions.

Co-authored-by: Aga Janowicz <aga@roli.com>
2025-10-20 17:34:48 +01:00
reuk
de4696d891
SimpleShapedText: Reorganise function declarations 2025-10-20 17:34:48 +01:00
Anthony Nicholls
5b0a2b9b80 Font: Cache HarfBuzz fonts and font details 2025-09-25 14:56:34 +01:00
Anthony Nicholls
c0f164ee28 Text: Cache the display language 2025-09-25 14:56:34 +01:00
reuk
5a02f5231d
SimpleShapedText: Silence conversion warning 2025-09-08 11:54:30 +01:00
reuk
22d5d7a598
SimpleShapedText: Fix potential heap buffer overflow 2025-07-03 16:15:03 +01:00
Oliver James
d651f6740c Fonts: Add OpenType feature support 2025-06-17 12:38:20 +01:00
reuk
fa701a1bd9
SimpleShapedText: Use string with replaced whitspace during fallback font substitution
This is intended to address an assertion that sometimes fired during
shaping text on Android, for example when using the font "Noto Sans
Symbols" and shaping ASCII text including a line break in a multiline
text editor.

The cause of the issue seems to be that the shaper would search for
substitute fonts using the original string content, but would then
replace some characters in the string during shaping. Shaping could then
fail if the font did not contain glyphs for the replaced characters.

We now create a UTF32 string with replaced characters at the beginning
of the shaping process, and use that new string for all queries other
than unicode analysis.
2025-06-16 16:59:55 +01:00
reuk
e5049ad6e9
SimpleShapedText: Avoid UTF8-lookup allocations 2025-06-16 16:59:55 +01:00
attila
a272b35261 TextEditor: Fix lines being invisible beyond the word wrap width 2025-05-21 17:47:20 +02:00
attila
0e4287df52 ShapedTextOptions: Rename maxWidth to wordWrapWidth
The old name didn't communicate it clearly enough what the parameter was
used for. This started to show when alignmentWidth was added.
2025-05-21 17:47:20 +02:00
attila
69b2b3ff5d Remove unused internal bidi features
This commit removes the possibility to construct BidiParagraph and
BidiLine objects with non-zero offsets. We don't use these features,
and the assumption that these offsets are always zero simplifies our
visual ordering algorithm.
2025-05-12 16:49:05 +02:00
attila
10b6289295 SimpleShapedText: Fix overallocating s32 buffer
Prior to this commit we overallocated the s32 buffer. The buffer was
unnecessarily padded by zeros, and the line stating this, wasn't
actually dropping the null terminator.
2025-05-12 16:49:05 +02:00
attila
d2d5e9bdd2 TextEditor: Fix setLineSpacing
Applies the previously missed line spacing value of the TextEditor.

The changes in JustifiedText fix calculating the vertical position of
the first line for the case where ShapedTextOptions has the following
settings:

isBaselineAtZero() == false,
getHeight().has_value() == false
getLeading() > 1.0f

This case however is only triggered by the TextEditor, as with all
functions in GlyphArrangement at least one setting is different.
2025-04-23 18:11:26 +02:00
attila
9083cd9135 Fix TextEditor crash when Font resolution fails 2025-04-02 15:33:27 +02:00
attila
9c0aeb9e00 ShapedText: Fix potential crash caused by invalid Unicode strings
This change also fixes bad access that could happen with \r\n
line terminators. An incorrectly sized buffer meant that \n was
clobbered by the null terminator.
2025-04-02 15:33:27 +02:00
attila
bdc515e424 ShapedText: Fix crash caused by failing to find a fallback font for all codepoints 2025-04-02 15:33:27 +02:00
attila
5f5a247f82 TextEditor: Fix centred and right alignment when word wrap is disabled 2025-03-20 21:12:32 +01:00
attila
432a7e1c9a Fix C++20 compilation 2025-03-14 10:03:11 +01:00
attila
427852836c ShapedText: Break ligatures into multiple iterable placeholder glyphs 2025-03-13 12:16:16 +01:00
attila
bc093fa64c Ranges: ShapedText: Use out params for improving TextEditor performance 2025-03-13 12:16:16 +01:00
attila
a4f73a37af ShapedText: Fix input text range calculation logic during wrapping 2025-03-13 12:16:16 +01:00
attila
bfbdc4844d ShapedTextOptions: Fix uninitialised member variable 2025-03-13 12:16:16 +01:00
attila
50863c144e ShapedTextOptions: Add equality operators 2025-03-13 12:16:16 +01:00
attila
d72df5faa3 ShapedText: Add bidirectional lookup functions relating positions, input indices and glyph indices 2025-03-13 12:16:16 +01:00
attila
6cf697bd6d Ranges: Add equality operators 2025-03-13 12:16:16 +01:00
attila
2842c8ef8e Add detail::Ranges::getRanges() 2025-03-13 12:16:16 +01:00
attila
6c3043f082 Add detail::UnicodeHelpers::getLineBreaks 2025-03-13 12:16:16 +01:00
attila
a07098d479 Add ShapedText::getHeight() 2025-03-13 12:16:16 +01:00
attila
213d3fb56a Add RangedValues::getIntersectionsStartingAtZeroWith 2025-03-13 12:16:16 +01:00
attila
2d24504cd1 Change the return type of RangedValues::getIntersectionsWith
This is to avoid converting the returned value to RangedValues at the
call site.
2025-03-13 12:16:16 +01:00
attila
8dccb38081 Make IntersectingRangedValues independent from the RangedValues type
With this change you can use makeIntersectingRangedValues() not just for
RangedValues objects, but any object that has a begin() and end()
function returning a RangedValuesIterator.
2025-03-13 12:16:16 +01:00
attila
5b04493fb8 Ranges: Make RangedValuesIterator independent from the RangedValues type
This commit also relaxes the requirements imposed on the types for which
RangedValuesIterators can be created.
2025-03-13 12:16:16 +01:00
attila
43608a5208 Ranges: Store more information in Split and Change operations
This allows implementing more sophisticated logic in types wrapping
Ranges and RangedValue objects.
2025-03-13 12:16:16 +01:00
attila
ef840b7472 Use detail::RangedValues<Font> on ShapedText related interfaces
Previously using the FontForRange type was motivated by hiding the
RangedValues type in case we wanted to expose the ShapedText API. This
introduced unnecessary conversions between FontForRange and
RangedValues<Font>.
2025-03-13 12:16:16 +01:00
attila
ad43702e88 Add detail::RangedValues::shift 2025-03-13 12:16:16 +01:00
attila
fab1de34ab Add ShapedText::accessTogetherWith and remove ShapedText::access
Since the original function template has been exposed, we can now use it
directly. Also ShapedText::Detail has been removed, because it wouldn't
work across module boundaries.
2025-03-13 12:16:16 +01:00
attila
1b595311d0 Move ShapedText to the detail namespace and expose it in the headers
This makes it accessible for the new TextEditor implementation in
juce_gui_basics.
2025-03-13 12:16:16 +01:00
attila
0474dacd31 Add Ranges::covers 2024-12-04 16:50:36 +01:00
attila
c69119a7b7 Add Ranges::find and RangedValues::find 2024-12-04 16:50:36 +01:00
attila
0dc97de993 Add Ranges::eraseUpTo 2024-12-04 16:48:12 +01:00
Anthony Nicholls
1dd2b3c90e Formatting: Whitespace 2024-09-06 15:40:39 +00:00
attila
adbb0850ed Fix compilation error with C++20 2024-06-24 15:07:16 +00:00
attila
453e57bade Add erase() and drop() to Ranges and RangedValues 2024-06-18 15:29:42 +02:00
attila
a2c7f1ea37
Add new Range related types that help working with attributed text 2024-04-18 14:16:01 +01:00