The class TextLayout::Run has a public data member Array glyphs;. The TextLayout::Glyph class does not have a default constructor. This leads to a compile failure in Juce if I try to access the array ‘glyphs’ using the Array class’s operator [ as the method ArrayBase::getValueWithDefault() tries to use the default constructor of Glyph to create the return value in the event of an out of range index being supplied. This problem can be circumvented by using one of the Array class access methods that does not check the supplied index but it’s a bug that ought to be fixed nevertheless so that the user doesn’t have to spend time understanding the problem.
The simplest fix would be to give the Glyph class a default constructor that initialises the Glyph to a harmless value. There is still however a bit of a problem with the Array class’s documentation in that it lists the requirements that it places on its element’s type and the requirement to have a default constructor is not listed.
I saw a discussion in which a guy was advocating that the Array operator [ should return a reference not a value. I would second that proposal since the present situation allows the user to write code that looks for all the world like it is setting a value in the array (eg array[0] = 42) which compiles but does nothing at all. Changing to a reference would, I think, lead to few backward compatibility issues. With a reference return value, the dummy element whose address would be returned in the event of an out of range index would have to be a data member not a temporary.
I don’t wish this to sound critical at all. Juce is much easier than any of the other GUI class libraries (Qt, Copperspice, U++, wxWidgets) to get started with and unlike those other systems doesn’t have any big flaw you can point to but it does have a few things like this round the edges that could be usefully tidied up.
What I was actually trying to do is to write text on the screen vertically (the X graticule on a graph). It’s a pity the Graphics class does not have a method for doing this (and maybe other angles too).
If anybody wants a class that draws graphs they can have mine.
Best regards
