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

1369 commits

Author SHA1 Message Date
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
reuk
2f1c74981f
FreeType: Make font fallback slightly more robust
On Ubuntu 25.10, which includes Noto Color Emoji, I was seeing that the
FontsDemo would assert when attempting to render non-emoji text using
this font. It appears that FontConfig will tend to return Noto Color
Emoji when this family name is passed, even though the font may not
cover the required character set.

The new strategy is to use FontConfig as before, but then to check the
resolved font for coverage of the string. If the resolved font still
can't render the string, we relax the font matching constraints by
removing the family name from the pattern, then try matching again.
2025-10-20 17:34:48 +01:00
reuk
37cc73ad9f
FreeType: Avoid scanning pfb/pcf fonts
Harfbuzz doesn't support these font formats, so attempting to shape text
using these kinds of fonts will fail.

I noticed this on Ubuntu 25.10 for Arm, which seems to include pfb and
otf versions of some fonts. The FontsDemo would assert in cases where
the pfb font was selected instead of the otf font.
2025-10-20 17:34:48 +01:00
reuk
46f812034e
SheenBidi: Update internal include paths 2025-10-20 17:34:47 +01:00
reuk
e8beaa4a1f
SheenBidi: Update bundled sources to v2.9.0 2025-10-20 17:34:47 +01:00
reuk
7f22db449a
AffineTransform: Add horizontalFlip() 2025-10-20 17:34:47 +01:00
Anthony Nicholls
68f7ed4ecc Colour: Prevent an integer alpha value being processed as a float 2025-10-16 16:55:44 +01:00
reuk
e0faa5c255
PNGImageFormat: Avoid crashing when attempting to write an invalid image
The default error handler could cause crashes, so we now set up a custom
error handler both when reading and writing PNGs.

The HeapBlock and BitmapData automatic variables have moved, so that
their destructors will still run as expected in the failure case. Note
that it's UB to call longjmp to unwind the stack to the previous setjmp,
if said unwinding would normally cause non-trivial destructors to run.
2025-09-25 18:38:32 +01:00
Anthony Nicholls
a5dedd36d5 Android: Address some clang-tidy warnings in Android Studio 2025-09-25 14:56:34 +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
Anthony Nicholls
667b3fae86 LruCache: Make the LRU cache implementation thread safe 2025-09-25 14:56:34 +01:00
Anthony Nicholls
c1affc0a0e Unicode: Make it clearer that a lambda is being immediately invoked 2025-09-25 14:56:34 +01:00
Anthony Nicholls
e68627c9ed Smart Pointers: Add a new enum for indicating if a smart point should increment a reference count or not 2025-09-25 14:56:34 +01:00
reuk
50b51f512a
juce_audio_processors_headless: Remove juce_graphics dependency 2025-09-17 12:50:08 +01:00
reuk
1c9947b80e
Android: Use AFontMatcher to locate generic system fonts on supported platforms 2025-09-17 12:50:06 +01:00
Tom Poole
360dfe5f3d Bump version number to 8.0.10 2025-09-15 09:30:11 +01:00
reuk
81e4d59da2
Direct2D: Avoid unnecessarily transforming solid colour brush
The changes were not cleared between frames, so they could end up
accumulating and causing floating-point exceptions.
2025-09-11 14:28:23 +01:00
reuk
641497918c
Direct2D: Always call SetTransform for gradient/image brushes
This partly reverts commit ad28684b10.
Prior to that change, getBrush() would always end up calling
SetTransform on gradient/image brushes. This is important because, when
drawing text, we combine the current brush transform with the text
transform. If we don't reset the brush transform each time, these
transforms end up accumulating across frames.
2025-09-09 11:32:00 +01:00
reuk
5a02f5231d
SimpleShapedText: Silence conversion warning 2025-09-08 11:54:30 +01:00
Tom Poole
cb9ec7e38f Bump version number to 8.0.9 2025-09-01 14:44:25 +01:00
Oli
4263efb96a Jpeg: Disable "extern C" in jpeglib.h 2025-08-20 09:51:28 +01:00
attila
ad28684b10 Tidying: Remove unused code 2025-08-19 16:51:15 +01:00
attila
35fe3ac714 Direct2D: Fix gradient fill when the brush is transformed with not just translation
The code contains a performance optimisation for cases where the world
transform is translation only. In this case instead of applying the
brush transformation first and then the world translation, the order is
reversed. The translation is applied first and then the brush
transformation.

Flipping the transformations however is only correct in the special case
when both transformations are translation only.
2025-08-19 16:51:15 +01:00
attila
bb5a9cbac9 Direct2D: Fix wrong brush transform calculation
This change is practically a no-op, because if the affected branch is
taken, then the world transform was not applied, so transform is a
unity matrix. But if transform was non-unity, then the wrong ordering
would cause an observable error.

Logically the brush transformation is nested inside the world
transformation so the right order is applying the brush transform first
followed by the world transform.
2025-08-19 16:51:15 +01:00
reuk
2712f63628
Graphics: Use unique_ptr instead of raw pointers in RenderingHelpers 2025-08-14 14:13:09 +01:00
attila
fa0ed2801d Fix J8 vertical text placement regression in the software renderer 2025-08-13 17:28:30 +01:00
Oli
8dc4dcd56b TextLayout: Implement better line balancing algorithm
The previous implementation was unstable when 'by character' line
breaking was used on long lines of text.

Co-authored-by: Tom Poole <tom@juce.com>
2025-08-13 14:20:20 +01:00
Oliver James
7a30354ce9 TextLayout: Enforce character wrapping attribute 2025-08-13 14:20:20 +01:00
attila
f97355b9f6 Direct2D: Fix seams between tiles for large bitmaps 2025-07-25 20:45:17 +02:00
attila
19906c9d2f Direct2DGraphicsContextTests: Ignore the image edges to allow for differences in anti-aliasing 2025-07-25 20:45:17 +02:00
attila
3f898f6fee Direct2D: Fix jitter when drawing bitmaps with non-unity scaling
Reverts ca3abbb96d.

Prior to this fix gradually changing the Component scale would lead to
the jittery movement of drawn bitmaps, as their position would be
snapped to an arbitrary integral representation.
2025-07-25 20:45:17 +02:00
attila
5bc44c301f Make Direct2DGraphicsContextTests acceptance criteria stricter 2025-07-25 20:45:17 +02:00
Anthony Nicholls
36d07a6ce3 Docs: Replace doxygen preprocessor conditionals with @cond and @endconds 2025-07-21 18:11:43 +02:00
Oliver James
fc80bb29ca GlyphArrangement: Extend glyph bounds to encapsulate ligature characters
Previously, bounds for text with ligatures were miscalculated, leading to
incorrect positioning and getStringWidth values.
2025-07-15 14:01:58 +01:00
reuk
22d5d7a598
SimpleShapedText: Fix potential heap buffer overflow 2025-07-03 16:15:03 +01:00
reuk
5bb20e8e04
Direct2DImage: Flush CPU-only changes if necessary when copying images 2025-06-30 20:04:56 +01:00
Oli
8fd73d33a8 Graphics: Modify imported libjpeg sources for unity build compatibility 2025-06-19 13:18:43 +01:00
Oli
34c8704a25 Graphics: Import JPEG library code 2025-06-19 13:18:42 +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
reuk
a3d64c7784
Typeface: Enable advanced colour glyph rendering on Android
Android 15+ removed the 'legacy' png-based emoji font. Modern Android
versions may include only a COLR-v1-based font, which JUCE cannot
render itself.

As a workaround, on Android, we use a Canvas object to render each emoji
glyph into a bitmap, and then render that bitmap in the same way as a
legacy png-based glyph. This won't look as crisp as rendering COLRv1
glyphs directly, especially at larger sizes, but this is a sufficient
stop-gap for the time being.
2025-06-16 16:59:55 +01:00
Anthony Nicholls
b6d6ec573d GlyphArrangement: Add documentation tag 2025-06-10 16:13:33 +01:00
reuk
15f05443d0
Graphics: Add missing JUCE_API annotation to ScopedSaveState 2025-06-03 16:12:00 +01:00
reuk
5208b3ffc0
GlyphArrangement: Use portable string trimming 2025-06-03 16:12:00 +01:00
Tom Poole
b0d569c74b Bump version number to 8.0.8 2025-06-02 09:24:54 +01:00
reuk
72e345cdd7
Direct2DImage: Add missing data change notification when creating writable BitmapData
The OpenGL renderer listens for imageDataChanged() to invalidated cached
textures.

Before this change, the SimpleFFTDemo would display a static (outdated)
image on Windows when using the OpenGLRenderer.
2025-05-27 18:01:53 +01:00
reuk
415aed4bea
Direct2DImage: Sync CPU storage when creating a BitmapData view over a subsection of the image
When syncing from CPU->GPU storage, we currently copy the entire image
contents. The contents of the CPU backup completely replace the old GPU
image. Therefore, if any pixels need to retain their existing values, we
need to read those pixels before overwriting them. This in turn implies
that, when a BitmapData refers to a subsection of the image, we should
always flush GPU->CPU storage first, so that the subsequent CPU->GPU
sync doesn't clobber pixels outside of the BitmapData region with
outdated values.

It's clear that copying the entire image back and forth could be
suboptimal when writing to image subsections, but to optimise this
process we'd have to keep track of dirty image regions or similar, which
may in turn pessimise more common cases.
2025-05-27 18:01:53 +01:00