Browse Source

CustomTypeface unicode fix. Misc nullptr additions.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
46c3a6bbe5
27 changed files with 219 additions and 186 deletions
  1. +105
    -89
      juce_amalgamated.cpp
  2. +4
    -4
      juce_amalgamated.h
  3. +0
    -16
      src/audio/processors/juce_AudioProcessorGraph.cpp
  4. +2
    -2
      src/audio/synthesisers/juce_Sampler.cpp
  5. +2
    -2
      src/containers/juce_HashMap.h
  6. +3
    -3
      src/events/juce_MessageManager.cpp
  7. +2
    -2
      src/gui/components/controls/juce_TableListBox.cpp
  8. +1
    -1
      src/gui/components/controls/juce_Toolbar.cpp
  9. +6
    -6
      src/gui/components/filebrowser/juce_FileChooser.cpp
  10. +2
    -2
      src/gui/components/filebrowser/juce_FileListComponent.cpp
  11. +1
    -1
      src/gui/components/juce_Component.cpp
  12. +1
    -1
      src/gui/components/layout/juce_ComponentBuilder.cpp
  13. +2
    -2
      src/gui/components/lookandfeel/juce_LookAndFeel.cpp
  14. +1
    -1
      src/gui/components/mouse/juce_ComponentDragger.h
  15. +2
    -2
      src/gui/components/positioning/juce_MarkerList.cpp
  16. +7
    -7
      src/gui/components/positioning/juce_RelativePointPath.cpp
  17. +2
    -2
      src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp
  18. +1
    -1
      src/gui/components/windows/juce_CallOutBox.h
  19. +2
    -2
      src/gui/graphics/drawables/juce_Drawable.cpp
  20. +6
    -6
      src/gui/graphics/drawables/juce_DrawableComposite.cpp
  21. +4
    -4
      src/gui/graphics/drawables/juce_DrawableImage.cpp
  22. +11
    -11
      src/gui/graphics/drawables/juce_DrawablePath.cpp
  23. +3
    -3
      src/gui/graphics/drawables/juce_DrawableRectangle.cpp
  24. +1
    -1
      src/gui/graphics/drawables/juce_DrawableShape.cpp
  25. +6
    -6
      src/gui/graphics/drawables/juce_DrawableText.cpp
  26. +41
    -8
      src/gui/graphics/fonts/juce_Typeface.cpp
  27. +1
    -1
      src/maths/juce_Expression.cpp

+ 105
- 89
juce_amalgamated.cpp View File

@@ -5105,7 +5105,7 @@ public:
}
else
{
result = scope.evaluateFunction (functionName, 0, 0);
result = scope.evaluateFunction (functionName, nullptr, 0);
}

return new Constant (result, false);
@@ -36189,8 +36189,6 @@ public:
: channelNum (channelNum_)
{}

~ClearChannelOp() {}

void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>&, const int numSamples)
{
sharedBufferChans.clear (channelNum, 0, numSamples);
@@ -36210,8 +36208,6 @@ public:
dstChannelNum (dstChannelNum_)
{}

~CopyChannelOp() {}

void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>&, const int numSamples)
{
sharedBufferChans.copyFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples);
@@ -36231,8 +36227,6 @@ public:
dstChannelNum (dstChannelNum_)
{}

~AddChannelOp() {}

void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>&, const int numSamples)
{
sharedBufferChans.addFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples);
@@ -36251,8 +36245,6 @@ public:
: bufferNum (bufferNum_)
{}

~ClearMidiBufferOp() {}

void perform (AudioSampleBuffer&, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int)
{
sharedMidiBuffers.getUnchecked (bufferNum)->clear();
@@ -36272,8 +36264,6 @@ public:
dstBufferNum (dstBufferNum_)
{}

~CopyMidiBufferOp() {}

void perform (AudioSampleBuffer&, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int)
{
*sharedMidiBuffers.getUnchecked (dstBufferNum) = *sharedMidiBuffers.getUnchecked (srcBufferNum);
@@ -36293,8 +36283,6 @@ public:
dstBufferNum (dstBufferNum_)
{}

~AddMidiBufferOp() {}

void perform (AudioSampleBuffer&, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int numSamples)
{
sharedMidiBuffers.getUnchecked (dstBufferNum)
@@ -36326,10 +36314,6 @@ public:
audioChannelsToUse.add (0);
}

~ProcessBufferOp()
{
}

void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int numSamples)
{
for (int i = totalChans; --i >= 0;)
@@ -37576,10 +37560,10 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa
{
const float* const inL = playingSound->data->getSampleData (0, 0);
const float* const inR = playingSound->data->getNumChannels() > 1
? playingSound->data->getSampleData (1, 0) : 0;
? playingSound->data->getSampleData (1, 0) : nullptr;

float* outL = outputBuffer.getSampleData (0, startSample);
float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : 0;
float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : nullptr;

while (--numSamples >= 0)
{
@@ -38771,7 +38755,7 @@ void MessageManager::runDispatchLoop()

void MessageManager::stopDispatchLoop()
{
postMessageToQueue (new Message (quitMessageId, 0, 0, 0));
postMessageToQueue (new Message (quitMessageId, 0, 0, nullptr));
quitMessagePosted = true;
}

@@ -38876,13 +38860,13 @@ private:
MessageManagerLock::MessageManagerLock (Thread* const threadToCheck)
: locked (false)
{
init (threadToCheck, 0);
init (threadToCheck, nullptr);
}

MessageManagerLock::MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal)
: locked (false)
{
init (0, jobToCheckForExitSignal);
init (nullptr, jobToCheckForExitSignal);
}

void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const job)
@@ -41484,7 +41468,7 @@ void Component::getVisibleArea (RectangleList& result, const bool includeSibling
c->getLocalBounds(), this);
}

ComponentHelpers::subtractObscuredRegions (*this, result, Point<int>(), unclipped, 0);
ComponentHelpers::subtractObscuredRegions (*this, result, Point<int>(), unclipped, nullptr);
result.consolidate();
}
}
@@ -51699,7 +51683,7 @@ public:

if (comp != nullptr && columnId != (int) comp->getProperties() [columnProperty])
{
columnComponents.set (i, 0);
columnComponents.set (i, nullptr);
comp = nullptr;
}

@@ -51864,7 +51848,7 @@ private:
};

TableListBox::TableListBox (const String& name, TableListBoxModel* const model_)
: ListBox (name, 0),
: ListBox (name, nullptr),
header (nullptr),
model (model_),
autoSizeOptionsShown (true)
@@ -55169,7 +55153,7 @@ void Toolbar::buttonClicked (Button*)
{
PopupMenu m;
m.addCustomItem (1, new MissingItemsComponent (*this, getThickness()));
m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), 0);
m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), nullptr);
}
}

@@ -58380,12 +58364,12 @@ bool FileChooser::browseForMultipleFilesOrDirectories (FilePreviewComponent* pre

bool FileChooser::browseForFileToSave (const bool warnAboutOverwritingExistingFiles)
{
return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, 0);
return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, nullptr);
}

bool FileChooser::browseForDirectory()
{
return showDialog (true, false, false, false, false, 0);
return showDialog (true, false, false, false, false, nullptr);
}

bool FileChooser::showDialog (const bool selectsDirectories,
@@ -58403,13 +58387,13 @@ bool FileChooser::showDialog (const bool selectsDirectories,
jassert (previewComponent == nullptr || (previewComponent->getWidth() > 10
&& previewComponent->getHeight() > 10));

#if JUCE_WINDOWS
#if JUCE_WINDOWS
if (useNativeDialogBox && ! (selectsFiles && selectsDirectories))
#elif JUCE_MAC
#elif JUCE_MAC
if (useNativeDialogBox && (previewComponent == nullptr))
#else
#else
if (false)
#endif
#endif
{
showPlatformDialog (results, title, startingFile, filters,
selectsDirectories, selectsFiles, isSave,
@@ -58770,7 +58754,7 @@ BEGIN_JUCE_NAMESPACE
const Image juce_createIconForFile (const File& file);

FileListComponent::FileListComponent (DirectoryContentsList& listToShow)
: ListBox (String::empty, 0),
: ListBox (String::empty, nullptr),
DirectoryContentsDisplayComponent (listToShow)
{
setModel (this);
@@ -58966,7 +58950,7 @@ Component* FileListComponent::refreshComponentForRow (int row, bool isSelected,
if (fileList.getFileInfo (row, fileInfo))
comp->update (fileList.getDirectory(), &fileInfo, row, isSelected);
else
comp->update (fileList.getDirectory(), 0, row, isSelected);
comp->update (fileList.getDirectory(), nullptr, row, isSelected);

return comp;
}
@@ -61605,7 +61589,7 @@ Component* ComponentBuilder::createComponent()
TypeHandler* const type = getHandlerForState (state);
jassert (type != nullptr); // trying to create a component from an unknown type of ValueTree

return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, 0) : 0;
return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, nullptr) : nullptr;
}

void ComponentBuilder::registerTypeHandler (ComponentBuilder::TypeHandler* const type)
@@ -67518,7 +67502,7 @@ Button* LookAndFeel::createTabBarExtrasButton()
overImage.addAndMakeVisible (dp.createCopy());

DrawableButton* db = new DrawableButton ("tabs", DrawableButton::ImageFitted);
db->setImages (&normalImage, &overImage, 0);
db->setImages (&normalImage, &overImage, nullptr);
return db;
}

@@ -67821,7 +67805,7 @@ Drawable* LookAndFeel::loadDrawableFromData (const void* data, size_t numBytes)
MemoryInputStream m (data, numBytes, false);
GZIPDecompressorInputStream gz (m);
ValueTree drawable (ValueTree::readFromStream (gz));
return Drawable::createFromValueTree (drawable.getChild (0), 0);
return Drawable::createFromValueTree (drawable.getChild (0), nullptr);
}

const Drawable* LookAndFeel::getDefaultFolderImage()
@@ -72979,7 +72963,7 @@ public:
const String& noItemsMessage_,
const int minNumber_,
const int maxNumber_)
: ListBox (String::empty, 0),
: ListBox (String::empty, nullptr),
deviceManager (deviceManager_),
noItemsMessage (noItemsMessage_),
minNumber (minNumber_),
@@ -73538,7 +73522,7 @@ public:
ChannelSelectorListBox (const AudioIODeviceType::DeviceSetupDetails& setup_,
const BoxType type_,
const String& noItemsMessage_)
: ListBox (String::empty, 0),
: ListBox (String::empty, nullptr),
setup (setup_),
type (type_),
noItemsMessage (noItemsMessage_)
@@ -79740,8 +79724,8 @@ void MarkerList::ValueTreeWrapper::setMarker (const MarkerList::Marker& m, UndoM
else
{
marker = ValueTree (markerTag);
marker.setProperty (nameProperty, m.name, 0);
marker.setProperty (posProperty, m.position.toString(), 0);
marker.setProperty (nameProperty, m.name, nullptr);
marker.setProperty (posProperty, m.position.toString(), nullptr);
state.addChild (marker, -1, undoManager);
}
}
@@ -80379,7 +80363,7 @@ RelativePointPath::StartSubPath::StartSubPath (const RelativePoint& pos)
const ValueTree RelativePointPath::StartSubPath::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::startSubPathElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), nullptr);
return v;
}

@@ -80433,7 +80417,7 @@ RelativePointPath::LineTo::LineTo (const RelativePoint& endPoint_)
const ValueTree RelativePointPath::LineTo::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::lineToElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), nullptr);
return v;
}

@@ -80463,8 +80447,8 @@ RelativePointPath::QuadraticTo::QuadraticTo (const RelativePoint& controlPoint,
const ValueTree RelativePointPath::QuadraticTo::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::quadraticToElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr);
return v;
}

@@ -80496,9 +80480,9 @@ RelativePointPath::CubicTo::CubicTo (const RelativePoint& controlPoint1, const R
const ValueTree RelativePointPath::CubicTo::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::cubicToElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr);
v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), nullptr);
return v;
}

@@ -86737,9 +86721,9 @@ const String Drawable::ValueTreeWrapperBase::getID() const
void Drawable::ValueTreeWrapperBase::setID (const String& newID)
{
if (newID.isEmpty())
state.removeProperty (ComponentBuilder::idProperty, 0);
state.removeProperty (ComponentBuilder::idProperty, nullptr);
else
state.setProperty (ComponentBuilder::idProperty, newID, 0);
state.setProperty (ComponentBuilder::idProperty, newID, nullptr);
}

END_JUCE_NAMESPACE
@@ -87141,7 +87125,7 @@ ValueTree DrawableShape::FillAndStrokeState::getFillState (const Identifier& fil
if (v.isValid())
return v;

setFill (fillOrStrokeType, FillType (Colours::black), 0, 0);
setFill (fillOrStrokeType, FillType (Colours::black), nullptr, nullptr);
return getFillState (fillOrStrokeType);
}

@@ -87436,8 +87420,8 @@ const RelativeRectangle DrawableComposite::ValueTreeWrapper::getContentArea() co

void DrawableComposite::ValueTreeWrapper::setContentArea (const RelativeRectangle& newArea, UndoManager* undoManager)
{
MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, 0));
MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, 0));
MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, nullptr));
MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, nullptr));

markersX.setMarker (MarkerList::Marker (contentLeftMarkerName, newArea.left), undoManager);
markersX.setMarker (MarkerList::Marker (contentRightMarkerName, newArea.right), undoManager);
@@ -87474,7 +87458,7 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi
ValueTreeWrapper v (tree);

v.setID (getComponentID());
v.setBoundingBox (bounds, 0);
v.setBoundingBox (bounds, nullptr);

ValueTree childList (v.getChildListCreating (nullptr));

@@ -87483,11 +87467,11 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi
const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i));
jassert (d != nullptr); // You can't save a mix of Drawables and normal components!

childList.addChild (d->createValueTree (imageProvider), -1, 0);
childList.addChild (d->createValueTree (imageProvider), -1, nullptr);
}

v.getMarkerListCreating (true, 0).readFrom (markersX, 0);
v.getMarkerListCreating (false, 0).readFrom (markersY, 0);
v.getMarkerListCreating (true, nullptr).readFrom (markersX, nullptr);
v.getMarkerListCreating (false, nullptr).readFrom (markersY, nullptr);

return tree;
}
@@ -87741,16 +87725,16 @@ const ValueTree DrawableImage::createValueTree (ComponentBuilder::ImageProvider*
ValueTreeWrapper v (tree);

v.setID (getComponentID());
v.setOpacity (opacity, 0);
v.setOverlayColour (overlayColour, 0);
v.setBoundingBox (bounds, 0);
v.setOpacity (opacity, nullptr);
v.setOverlayColour (overlayColour, nullptr);
v.setBoundingBox (bounds, nullptr);

if (image.isValid())
{
jassert (imageProvider != nullptr); // if you're using images, you need to provide something that can load and save them!

if (imageProvider != nullptr)
v.setImageIdentifier (imageProvider->getIdentifierForImage (image), 0);
v.setImageIdentifier (imageProvider->getIdentifierForImage (image), nullptr);
}

return tree;
@@ -87878,7 +87862,7 @@ void DrawablePath::setPath (const RelativePointPath& newRelativePath)
else
{
relativePath = nullptr;
applyRelativePath (newRelativePath, 0);
applyRelativePath (newRelativePath, nullptr);
}
}

@@ -87897,7 +87881,7 @@ DrawablePath::ValueTreeWrapper::ValueTreeWrapper (const ValueTree& state_)

ValueTree DrawablePath::ValueTreeWrapper::getPathState()
{
return state.getOrCreateChildWithName (path, 0);
return state.getOrCreateChildWithName (path, nullptr);
}

bool DrawablePath::ValueTreeWrapper::usesNonZeroWinding() const
@@ -88223,9 +88207,9 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point<floa
setModeOfEndPoint (roundedMode, undoManager);

Element newElement (newTree = ValueTree (cubicToElement));
newElement.setControlPoint (0, newCp2, 0);
newElement.setControlPoint (1, mid3, 0);
newElement.setControlPoint (2, rp4, 0);
newElement.setControlPoint (0, newCp2, nullptr);
newElement.setControlPoint (1, mid3, nullptr);
newElement.setControlPoint (2, rp4, nullptr);

state.getParent().addChild (newTree, state.getParent().indexOf (state) + 1, undoManager);
}
@@ -88246,8 +88230,8 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point<floa
setModeOfEndPoint (roundedMode, undoManager);

Element newElement (newTree = ValueTree (quadraticToElement));
newElement.setControlPoint (0, mid2, 0);
newElement.setControlPoint (1, rp3, 0);
newElement.setControlPoint (0, mid2, nullptr);
newElement.setControlPoint (1, rp3, nullptr);

state.getParent().addChild (newTree, state.getParent().indexOf (state) + 1, undoManager);
}
@@ -88260,7 +88244,7 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point<floa
setControlPoint (0, newPoint, undoManager);

Element newElement (newTree = ValueTree (lineToElement));
newElement.setControlPoint (0, rp2, 0);
newElement.setControlPoint (0, rp2, nullptr);

state.getParent().addChild (newTree, state.getParent().indexOf (state) + 1, undoManager);
}
@@ -88295,12 +88279,12 @@ const ValueTree DrawablePath::createValueTree (ComponentBuilder::ImageProvider*
ValueTreeWrapper v (tree);

v.setID (getComponentID());
writeTo (v, imageProvider, 0);
writeTo (v, imageProvider, nullptr);

if (relativePath != nullptr)
v.readFrom (*relativePath, 0);
v.readFrom (*relativePath, nullptr);
else
v.readFrom (RelativePointPath (path), 0);
v.readFrom (RelativePointPath (path), nullptr);

return tree;
}
@@ -88460,9 +88444,9 @@ const ValueTree DrawableRectangle::createValueTree (ComponentBuilder::ImageProvi
ValueTreeWrapper v (tree);

v.setID (getComponentID());
writeTo (v, imageProvider, 0);
v.setRectangle (bounds, 0);
v.setCornerSize (cornerSize, 0);
writeTo (v, imageProvider, nullptr);
v.setRectangle (bounds, nullptr);
v.setCornerSize (cornerSize, nullptr);

return tree;
}
@@ -88750,12 +88734,12 @@ const ValueTree DrawableText::createValueTree (ComponentBuilder::ImageProvider*)
ValueTreeWrapper v (tree);

v.setID (getComponentID());
v.setText (text, 0);
v.setFont (font, 0);
v.setJustification (justification, 0);
v.setColour (colour, 0);
v.setBoundingBox (bounds, 0);
v.setFontSizeControlPoint (fontSizeControlPoint, 0);
v.setText (text, nullptr);
v.setFont (font, nullptr);
v.setJustification (justification, nullptr);
v.setColour (colour, nullptr);
v.setBoundingBox (bounds, nullptr);
v.setFontSizeControlPoint (fontSizeControlPoint, nullptr);

return tree;
}
@@ -91819,6 +91803,38 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GlyphInfo);
};

namespace CustomTypefaceHelpers
{
juce_wchar readChar (InputStream& in)
{
uint32 n = (uint32) (uint16) in.readShort();

if (n >= 0xd800 && n <= 0xdfff)
{
const uint32 nextWord = (uint32) (uint16) in.readShort();
jassert (nextWord >= 0xdc00); // illegal unicode character!

n = 0x10000 + (((n - 0xd800) << 10) | (nextWord - 0xdc00));
}

return (juce_wchar) n;
}

void writeChar (OutputStream& out, juce_wchar charToWrite)
{
if (charToWrite >= 0x10000)
{
charToWrite -= 0x10000;
out.writeShort ((short) (uint16) (0xd800 + (charToWrite >> 10)));
out.writeShort ((short) (uint16) (0xdc00 + (charToWrite & 0x3ff)));
}
else
{
out.writeShort ((short) (uint16) charToWrite);
}
}
}

CustomTypeface::CustomTypeface()
: Typeface (String::empty)
{
@@ -91837,13 +91853,13 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream)
isBold = in.readBool();
isItalic = in.readBool();
ascent = in.readFloat();
defaultCharacter = (juce_wchar) in.readShort();
defaultCharacter = CustomTypefaceHelpers::readChar (in);

int i, numChars = in.readInt();

for (i = 0; i < numChars; ++i)
{
const juce_wchar c = (juce_wchar) in.readShort();
const juce_wchar c = CustomTypefaceHelpers::readChar (in);
const float width = in.readFloat();

Path p;
@@ -91855,8 +91871,8 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream)

for (i = 0; i < numKerningPairs; ++i)
{
const juce_wchar char1 = (juce_wchar) in.readShort();
const juce_wchar char2 = (juce_wchar) in.readShort();
const juce_wchar char1 = CustomTypefaceHelpers::readChar (in);
const juce_wchar char2 = CustomTypefaceHelpers::readChar (in);

addKerningPair (char1, char2, in.readFloat());
}
@@ -92004,7 +92020,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream)
out.writeBool (isBold);
out.writeBool (isItalic);
out.writeFloat (ascent);
out.writeShort ((short) (unsigned short) defaultCharacter);
CustomTypefaceHelpers::writeChar (out, defaultCharacter);
out.writeInt (glyphs.size());

int i, numKerningPairs = 0;
@@ -92012,7 +92028,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream)
for (i = 0; i < glyphs.size(); ++i)
{
const GlyphInfo* const g = glyphs.getUnchecked (i);
out.writeShort ((short) (unsigned short) g->character);
CustomTypefaceHelpers::writeChar (out, g->character);
out.writeFloat (g->width);
g->path.writePathToStream (out);

@@ -92028,8 +92044,8 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream)
for (int j = 0; j < g->kerningPairs.size(); ++j)
{
const GlyphInfo::KerningPair& p = g->kerningPairs.getReference (j);
out.writeShort ((short) (unsigned short) g->character);
out.writeShort ((short) (unsigned short) p.character2);
CustomTypefaceHelpers::writeChar (out, g->character);
CustomTypefaceHelpers::writeChar (out, p.character2);
out.writeFloat (p.kerningAmount);
}
}


+ 4
- 4
juce_amalgamated.h View File

@@ -10691,7 +10691,7 @@ public:
HashMap (const int numberOfSlots = defaultHashTableSize)
: totalNumItems (0)
{
slots.insertMultiple (0, 0, numberOfSlots);
slots.insertMultiple (0, nullptr, numberOfSlots);
}

/** Destructor. */
@@ -10718,7 +10718,7 @@ public:
h = h->nextEntry;
}

slots.set (i, 0);
slots.set (i, nullptr);
}

totalNumItems = 0;
@@ -55966,7 +55966,7 @@ private:

void mouseDrag (const MouseEvent& e)
{
myDragger.dragComponent (this, e, 0);
myDragger.dragComponent (this, e, nullptr);
}
};
@endcode
@@ -64326,7 +64326,7 @@ private:
MyContentComponent content;
content.setSize (300, 300);

CallOutBox callOut (content, *this, 0);
CallOutBox callOut (content, *this, nullptr);
callOut.runModalLoop();
}
@endcode


+ 0
- 16
src/audio/processors/juce_AudioProcessorGraph.cpp View File

@@ -359,8 +359,6 @@ public:
: channelNum (channelNum_)
{}
~ClearChannelOp() {}
void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>&, const int numSamples)
{
sharedBufferChans.clear (channelNum, 0, numSamples);
@@ -381,8 +379,6 @@ public:
dstChannelNum (dstChannelNum_)
{}
~CopyChannelOp() {}
void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>&, const int numSamples)
{
sharedBufferChans.copyFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples);
@@ -403,8 +399,6 @@ public:
dstChannelNum (dstChannelNum_)
{}
~AddChannelOp() {}
void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>&, const int numSamples)
{
sharedBufferChans.addFrom (dstChannelNum, 0, sharedBufferChans, srcChannelNum, 0, numSamples);
@@ -424,8 +418,6 @@ public:
: bufferNum (bufferNum_)
{}
~ClearMidiBufferOp() {}
void perform (AudioSampleBuffer&, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int)
{
sharedMidiBuffers.getUnchecked (bufferNum)->clear();
@@ -446,8 +438,6 @@ public:
dstBufferNum (dstBufferNum_)
{}
~CopyMidiBufferOp() {}
void perform (AudioSampleBuffer&, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int)
{
*sharedMidiBuffers.getUnchecked (dstBufferNum) = *sharedMidiBuffers.getUnchecked (srcBufferNum);
@@ -468,8 +458,6 @@ public:
dstBufferNum (dstBufferNum_)
{}
~AddMidiBufferOp() {}
void perform (AudioSampleBuffer&, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int numSamples)
{
sharedMidiBuffers.getUnchecked (dstBufferNum)
@@ -502,10 +490,6 @@ public:
audioChannelsToUse.add (0);
}
~ProcessBufferOp()
{
}
void perform (AudioSampleBuffer& sharedBufferChans, const OwnedArray <MidiBuffer>& sharedMidiBuffers, const int numSamples)
{
for (int i = totalChans; --i >= 0;)


+ 2
- 2
src/audio/synthesisers/juce_Sampler.cpp View File

@@ -176,10 +176,10 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa
{
const float* const inL = playingSound->data->getSampleData (0, 0);
const float* const inR = playingSound->data->getNumChannels() > 1
? playingSound->data->getSampleData (1, 0) : 0;
? playingSound->data->getSampleData (1, 0) : nullptr;
float* outL = outputBuffer.getSampleData (0, startSample);
float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : 0;
float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getSampleData (1, startSample) : nullptr;
while (--numSamples >= 0)
{


+ 2
- 2
src/containers/juce_HashMap.h View File

@@ -111,7 +111,7 @@ public:
HashMap (const int numberOfSlots = defaultHashTableSize)
: totalNumItems (0)
{
slots.insertMultiple (0, 0, numberOfSlots);
slots.insertMultiple (0, nullptr, numberOfSlots);
}
/** Destructor. */
@@ -139,7 +139,7 @@ public:
h = h->nextEntry;
}
slots.set (i, 0);
slots.set (i, nullptr);
}
totalNumItems = 0;


+ 3
- 3
src/events/juce_MessageManager.cpp View File

@@ -130,7 +130,7 @@ void MessageManager::runDispatchLoop()
void MessageManager::stopDispatchLoop()
{
postMessageToQueue (new Message (quitMessageId, 0, 0, 0));
postMessageToQueue (new Message (quitMessageId, 0, 0, nullptr));
quitMessagePosted = true;
}
@@ -240,13 +240,13 @@ private:
MessageManagerLock::MessageManagerLock (Thread* const threadToCheck)
: locked (false)
{
init (threadToCheck, 0);
init (threadToCheck, nullptr);
}
MessageManagerLock::MessageManagerLock (ThreadPoolJob* const jobToCheckForExitSignal)
: locked (false)
{
init (0, jobToCheckForExitSignal);
init (nullptr, jobToCheckForExitSignal);
}
void MessageManagerLock::init (Thread* const threadToCheck, ThreadPoolJob* const job)


+ 2
- 2
src/gui/components/controls/juce_TableListBox.cpp View File

@@ -98,7 +98,7 @@ public:
if (comp != nullptr && columnId != (int) comp->getProperties() [columnProperty])
{
columnComponents.set (i, 0);
columnComponents.set (i, nullptr);
comp = nullptr;
}
@@ -267,7 +267,7 @@ private:
//==============================================================================
TableListBox::TableListBox (const String& name, TableListBoxModel* const model_)
: ListBox (name, 0),
: ListBox (name, nullptr),
header (nullptr),
model (model_),
autoSizeOptionsShown (true)


+ 1
- 1
src/gui/components/controls/juce_Toolbar.cpp View File

@@ -558,7 +558,7 @@ void Toolbar::buttonClicked (Button*)
{
PopupMenu m;
m.addCustomItem (1, new MissingItemsComponent (*this, getThickness()));
m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), 0);
m.showMenuAsync (PopupMenu::Options().withTargetComponent (missingItemsButton), nullptr);
}
}


+ 6
- 6
src/gui/components/filebrowser/juce_FileChooser.cpp View File

@@ -74,12 +74,12 @@ bool FileChooser::browseForMultipleFilesOrDirectories (FilePreviewComponent* pre
bool FileChooser::browseForFileToSave (const bool warnAboutOverwritingExistingFiles)
{
return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, 0);
return showDialog (false, true, true, warnAboutOverwritingExistingFiles, false, nullptr);
}
bool FileChooser::browseForDirectory()
{
return showDialog (true, false, false, false, false, 0);
return showDialog (true, false, false, false, false, nullptr);
}
bool FileChooser::showDialog (const bool selectsDirectories,
@@ -97,13 +97,13 @@ bool FileChooser::showDialog (const bool selectsDirectories,
jassert (previewComponent == nullptr || (previewComponent->getWidth() > 10
&& previewComponent->getHeight() > 10));
#if JUCE_WINDOWS
#if JUCE_WINDOWS
if (useNativeDialogBox && ! (selectsFiles && selectsDirectories))
#elif JUCE_MAC
#elif JUCE_MAC
if (useNativeDialogBox && (previewComponent == nullptr))
#else
#else
if (false)
#endif
#endif
{
showPlatformDialog (results, title, startingFile, filters,
selectsDirectories, selectsFiles, isSave,


+ 2
- 2
src/gui/components/filebrowser/juce_FileListComponent.cpp View File

@@ -37,7 +37,7 @@ const Image juce_createIconForFile (const File& file);
//==============================================================================
FileListComponent::FileListComponent (DirectoryContentsList& listToShow)
: ListBox (String::empty, 0),
: ListBox (String::empty, nullptr),
DirectoryContentsDisplayComponent (listToShow)
{
setModel (this);
@@ -237,7 +237,7 @@ Component* FileListComponent::refreshComponentForRow (int row, bool isSelected,
if (fileList.getFileInfo (row, fileInfo))
comp->update (fileList.getDirectory(), &fileInfo, row, isSelected);
else
comp->update (fileList.getDirectory(), 0, row, isSelected);
comp->update (fileList.getDirectory(), nullptr, row, isSelected);
return comp;
}


+ 1
- 1
src/gui/components/juce_Component.cpp View File

@@ -2137,7 +2137,7 @@ void Component::getVisibleArea (RectangleList& result, const bool includeSibling
c->getLocalBounds(), this);
}
ComponentHelpers::subtractObscuredRegions (*this, result, Point<int>(), unclipped, 0);
ComponentHelpers::subtractObscuredRegions (*this, result, Point<int>(), unclipped, nullptr);
result.consolidate();
}
}


+ 1
- 1
src/gui/components/layout/juce_ComponentBuilder.cpp View File

@@ -146,7 +146,7 @@ Component* ComponentBuilder::createComponent()
TypeHandler* const type = getHandlerForState (state);
jassert (type != nullptr); // trying to create a component from an unknown type of ValueTree
return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, 0) : 0;
return type != nullptr ? ComponentBuilderHelpers::createNewComponent (*type, state, nullptr) : nullptr;
}
void ComponentBuilder::registerTypeHandler (ComponentBuilder::TypeHandler* const type)


+ 2
- 2
src/gui/components/lookandfeel/juce_LookAndFeel.cpp View File

@@ -2479,7 +2479,7 @@ Button* LookAndFeel::createTabBarExtrasButton()
overImage.addAndMakeVisible (dp.createCopy());
DrawableButton* db = new DrawableButton ("tabs", DrawableButton::ImageFitted);
db->setImages (&normalImage, &overImage, 0);
db->setImages (&normalImage, &overImage, nullptr);
return db;
}
@@ -2790,7 +2790,7 @@ Drawable* LookAndFeel::loadDrawableFromData (const void* data, size_t numBytes)
MemoryInputStream m (data, numBytes, false);
GZIPDecompressorInputStream gz (m);
ValueTree drawable (ValueTree::readFromStream (gz));
return Drawable::createFromValueTree (drawable.getChild (0), 0);
return Drawable::createFromValueTree (drawable.getChild (0), nullptr);
}
const Drawable* LookAndFeel::getDefaultFolderImage()


+ 1
- 1
src/gui/components/mouse/juce_ComponentDragger.h View File

@@ -52,7 +52,7 @@
void mouseDrag (const MouseEvent& e)
{
myDragger.dragComponent (this, e, 0);
myDragger.dragComponent (this, e, nullptr);
}
};
@endcode


+ 2
- 2
src/gui/components/positioning/juce_MarkerList.cpp View File

@@ -237,8 +237,8 @@ void MarkerList::ValueTreeWrapper::setMarker (const MarkerList::Marker& m, UndoM
else
{
marker = ValueTree (markerTag);
marker.setProperty (nameProperty, m.name, 0);
marker.setProperty (posProperty, m.position.toString(), 0);
marker.setProperty (nameProperty, m.name, nullptr);
marker.setProperty (posProperty, m.position.toString(), nullptr);
state.addChild (marker, -1, undoManager);
}
}


+ 7
- 7
src/gui/components/positioning/juce_RelativePointPath.cpp View File

@@ -155,7 +155,7 @@ RelativePointPath::StartSubPath::StartSubPath (const RelativePoint& pos)
const ValueTree RelativePointPath::StartSubPath::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::startSubPathElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, startPos.toString(), nullptr);
return v;
}
@@ -211,7 +211,7 @@ RelativePointPath::LineTo::LineTo (const RelativePoint& endPoint_)
const ValueTree RelativePointPath::LineTo::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::lineToElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, endPoint.toString(), nullptr);
return v;
}
@@ -242,8 +242,8 @@ RelativePointPath::QuadraticTo::QuadraticTo (const RelativePoint& controlPoint,
const ValueTree RelativePointPath::QuadraticTo::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::quadraticToElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr);
return v;
}
@@ -277,9 +277,9 @@ RelativePointPath::CubicTo::CubicTo (const RelativePoint& controlPoint1, const R
const ValueTree RelativePointPath::CubicTo::createTree() const
{
ValueTree v (DrawablePath::ValueTreeWrapper::Element::cubicToElement);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), 0);
v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr);
v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr);
v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), nullptr);
return v;
}


+ 2
- 2
src/gui/components/special/juce_AudioDeviceSelectorComponent.cpp View File

@@ -88,7 +88,7 @@ public:
const String& noItemsMessage_,
const int minNumber_,
const int maxNumber_)
: ListBox (String::empty, 0),
: ListBox (String::empty, nullptr),
deviceManager (deviceManager_),
noItemsMessage (noItemsMessage_),
minNumber (minNumber_),
@@ -650,7 +650,7 @@ public:
ChannelSelectorListBox (const AudioIODeviceType::DeviceSetupDetails& setup_,
const BoxType type_,
const String& noItemsMessage_)
: ListBox (String::empty, 0),
: ListBox (String::empty, nullptr),
setup (setup_),
type (type_),
noItemsMessage (noItemsMessage_)


+ 1
- 1
src/gui/components/windows/juce_CallOutBox.h View File

@@ -46,7 +46,7 @@
MyContentComponent content;
content.setSize (300, 300);
CallOutBox callOut (content, *this, 0);
CallOutBox callOut (content, *this, nullptr);
callOut.runModalLoop();
}
@endcode


+ 2
- 2
src/gui/graphics/drawables/juce_Drawable.cpp View File

@@ -238,9 +238,9 @@ const String Drawable::ValueTreeWrapperBase::getID() const
void Drawable::ValueTreeWrapperBase::setID (const String& newID)
{
if (newID.isEmpty())
state.removeProperty (ComponentBuilder::idProperty, 0);
state.removeProperty (ComponentBuilder::idProperty, nullptr);
else
state.setProperty (ComponentBuilder::idProperty, newID, 0);
state.setProperty (ComponentBuilder::idProperty, newID, nullptr);
}


+ 6
- 6
src/gui/graphics/drawables/juce_DrawableComposite.cpp View File

@@ -290,8 +290,8 @@ const RelativeRectangle DrawableComposite::ValueTreeWrapper::getContentArea() co
void DrawableComposite::ValueTreeWrapper::setContentArea (const RelativeRectangle& newArea, UndoManager* undoManager)
{
MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, 0));
MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, 0));
MarkerList::ValueTreeWrapper markersX (getMarkerListCreating (true, nullptr));
MarkerList::ValueTreeWrapper markersY (getMarkerListCreating (false, nullptr));
markersX.setMarker (MarkerList::Marker (contentLeftMarkerName, newArea.left), undoManager);
markersX.setMarker (MarkerList::Marker (contentRightMarkerName, newArea.right), undoManager);
@@ -329,7 +329,7 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi
ValueTreeWrapper v (tree);
v.setID (getComponentID());
v.setBoundingBox (bounds, 0);
v.setBoundingBox (bounds, nullptr);
ValueTree childList (v.getChildListCreating (nullptr));
@@ -338,11 +338,11 @@ const ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvi
const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i));
jassert (d != nullptr); // You can't save a mix of Drawables and normal components!
childList.addChild (d->createValueTree (imageProvider), -1, 0);
childList.addChild (d->createValueTree (imageProvider), -1, nullptr);
}
v.getMarkerListCreating (true, 0).readFrom (markersX, 0);
v.getMarkerListCreating (false, 0).readFrom (markersY, 0);
v.getMarkerListCreating (true, nullptr).readFrom (markersX, nullptr);
v.getMarkerListCreating (false, nullptr).readFrom (markersY, nullptr);
return tree;
}


+ 4
- 4
src/gui/graphics/drawables/juce_DrawableImage.cpp View File

@@ -283,16 +283,16 @@ const ValueTree DrawableImage::createValueTree (ComponentBuilder::ImageProvider*
ValueTreeWrapper v (tree);
v.setID (getComponentID());
v.setOpacity (opacity, 0);
v.setOverlayColour (overlayColour, 0);
v.setBoundingBox (bounds, 0);
v.setOpacity (opacity, nullptr);
v.setOverlayColour (overlayColour, nullptr);
v.setBoundingBox (bounds, nullptr);
if (image.isValid())
{
jassert (imageProvider != nullptr); // if you're using images, you need to provide something that can load and save them!
if (imageProvider != nullptr)
v.setImageIdentifier (imageProvider->getIdentifierForImage (image), 0);
v.setImageIdentifier (imageProvider->getIdentifierForImage (image), nullptr);
}
return tree;


+ 11
- 11
src/gui/graphics/drawables/juce_DrawablePath.cpp View File

@@ -150,7 +150,7 @@ void DrawablePath::setPath (const RelativePointPath& newRelativePath)
else
{
relativePath = nullptr;
applyRelativePath (newRelativePath, 0);
applyRelativePath (newRelativePath, nullptr);
}
}
@@ -171,7 +171,7 @@ DrawablePath::ValueTreeWrapper::ValueTreeWrapper (const ValueTree& state_)
ValueTree DrawablePath::ValueTreeWrapper::getPathState()
{
return state.getOrCreateChildWithName (path, 0);
return state.getOrCreateChildWithName (path, nullptr);
}
bool DrawablePath::ValueTreeWrapper::usesNonZeroWinding() const
@@ -498,9 +498,9 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point<floa
setModeOfEndPoint (roundedMode, undoManager);
Element newElement (newTree = ValueTree (cubicToElement));
newElement.setControlPoint (0, newCp2, 0);
newElement.setControlPoint (1, mid3, 0);
newElement.setControlPoint (2, rp4, 0);
newElement.setControlPoint (0, newCp2, nullptr);
newElement.setControlPoint (1, mid3, nullptr);
newElement.setControlPoint (2, rp4, nullptr);
state.getParent().addChild (newTree, state.getParent().indexOf (state) + 1, undoManager);
}
@@ -521,8 +521,8 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point<floa
setModeOfEndPoint (roundedMode, undoManager);
Element newElement (newTree = ValueTree (quadraticToElement));
newElement.setControlPoint (0, mid2, 0);
newElement.setControlPoint (1, rp3, 0);
newElement.setControlPoint (0, mid2, nullptr);
newElement.setControlPoint (1, rp3, nullptr);
state.getParent().addChild (newTree, state.getParent().indexOf (state) + 1, undoManager);
}
@@ -535,7 +535,7 @@ ValueTree DrawablePath::ValueTreeWrapper::Element::insertPoint (const Point<floa
setControlPoint (0, newPoint, undoManager);
Element newElement (newTree = ValueTree (lineToElement));
newElement.setControlPoint (0, rp2, 0);
newElement.setControlPoint (0, rp2, nullptr);
state.getParent().addChild (newTree, state.getParent().indexOf (state) + 1, undoManager);
}
@@ -571,12 +571,12 @@ const ValueTree DrawablePath::createValueTree (ComponentBuilder::ImageProvider*
ValueTreeWrapper v (tree);
v.setID (getComponentID());
writeTo (v, imageProvider, 0);
writeTo (v, imageProvider, nullptr);
if (relativePath != nullptr)
v.readFrom (*relativePath, 0);
v.readFrom (*relativePath, nullptr);
else
v.readFrom (RelativePointPath (path), 0);
v.readFrom (RelativePointPath (path), nullptr);
return tree;
}


+ 3
- 3
src/gui/graphics/drawables/juce_DrawableRectangle.cpp View File

@@ -185,9 +185,9 @@ const ValueTree DrawableRectangle::createValueTree (ComponentBuilder::ImageProvi
ValueTreeWrapper v (tree);
v.setID (getComponentID());
writeTo (v, imageProvider, 0);
v.setRectangle (bounds, 0);
v.setCornerSize (cornerSize, 0);
writeTo (v, imageProvider, nullptr);
v.setRectangle (bounds, nullptr);
v.setCornerSize (cornerSize, nullptr);
return tree;
}


+ 1
- 1
src/gui/graphics/drawables/juce_DrawableShape.cpp View File

@@ -428,7 +428,7 @@ ValueTree DrawableShape::FillAndStrokeState::getFillState (const Identifier& fil
if (v.isValid())
return v;
setFill (fillOrStrokeType, FillType (Colours::black), 0, 0);
setFill (fillOrStrokeType, FillType (Colours::black), nullptr, nullptr);
return getFillState (fillOrStrokeType);
}


+ 6
- 6
src/gui/graphics/drawables/juce_DrawableText.cpp View File

@@ -313,12 +313,12 @@ const ValueTree DrawableText::createValueTree (ComponentBuilder::ImageProvider*)
ValueTreeWrapper v (tree);
v.setID (getComponentID());
v.setText (text, 0);
v.setFont (font, 0);
v.setJustification (justification, 0);
v.setColour (colour, 0);
v.setBoundingBox (bounds, 0);
v.setFontSizeControlPoint (fontSizeControlPoint, 0);
v.setText (text, nullptr);
v.setFont (font, nullptr);
v.setJustification (justification, nullptr);
v.setColour (colour, nullptr);
v.setBoundingBox (bounds, nullptr);
v.setFontSizeControlPoint (fontSizeControlPoint, nullptr);
return tree;
}


+ 41
- 8
src/gui/graphics/fonts/juce_Typeface.cpp View File

@@ -99,6 +99,39 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (GlyphInfo);
};
//==============================================================================
namespace CustomTypefaceHelpers
{
juce_wchar readChar (InputStream& in)
{
uint32 n = (uint32) (uint16) in.readShort();
if (n >= 0xd800 && n <= 0xdfff)
{
const uint32 nextWord = (uint32) (uint16) in.readShort();
jassert (nextWord >= 0xdc00); // illegal unicode character!
n = 0x10000 + (((n - 0xd800) << 10) | (nextWord - 0xdc00));
}
return (juce_wchar) n;
}
void writeChar (OutputStream& out, juce_wchar charToWrite)
{
if (charToWrite >= 0x10000)
{
charToWrite -= 0x10000;
out.writeShort ((short) (uint16) (0xd800 + (charToWrite >> 10)));
out.writeShort ((short) (uint16) (0xdc00 + (charToWrite & 0x3ff)));
}
else
{
out.writeShort ((short) (uint16) charToWrite);
}
}
}
//==============================================================================
CustomTypeface::CustomTypeface()
: Typeface (String::empty)
@@ -118,13 +151,13 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream)
isBold = in.readBool();
isItalic = in.readBool();
ascent = in.readFloat();
defaultCharacter = (juce_wchar) in.readShort();
defaultCharacter = CustomTypefaceHelpers::readChar (in);
int i, numChars = in.readInt();
for (i = 0; i < numChars; ++i)
{
const juce_wchar c = (juce_wchar) in.readShort();
const juce_wchar c = CustomTypefaceHelpers::readChar (in);
const float width = in.readFloat();
Path p;
@@ -136,8 +169,8 @@ CustomTypeface::CustomTypeface (InputStream& serialisedTypefaceStream)
for (i = 0; i < numKerningPairs; ++i)
{
const juce_wchar char1 = (juce_wchar) in.readShort();
const juce_wchar char2 = (juce_wchar) in.readShort();
const juce_wchar char1 = CustomTypefaceHelpers::readChar (in);
const juce_wchar char2 = CustomTypefaceHelpers::readChar (in);
addKerningPair (char1, char2, in.readFloat());
}
@@ -286,7 +319,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream)
out.writeBool (isBold);
out.writeBool (isItalic);
out.writeFloat (ascent);
out.writeShort ((short) (unsigned short) defaultCharacter);
CustomTypefaceHelpers::writeChar (out, defaultCharacter);
out.writeInt (glyphs.size());
int i, numKerningPairs = 0;
@@ -294,7 +327,7 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream)
for (i = 0; i < glyphs.size(); ++i)
{
const GlyphInfo* const g = glyphs.getUnchecked (i);
out.writeShort ((short) (unsigned short) g->character);
CustomTypefaceHelpers::writeChar (out, g->character);
out.writeFloat (g->width);
g->path.writePathToStream (out);
@@ -310,8 +343,8 @@ bool CustomTypeface::writeToStream (OutputStream& outputStream)
for (int j = 0; j < g->kerningPairs.size(); ++j)
{
const GlyphInfo::KerningPair& p = g->kerningPairs.getReference (j);
out.writeShort ((short) (unsigned short) g->character);
out.writeShort ((short) (unsigned short) p.character2);
CustomTypefaceHelpers::writeChar (out, g->character);
CustomTypefaceHelpers::writeChar (out, p.character2);
out.writeFloat (p.kerningAmount);
}
}


+ 1
- 1
src/maths/juce_Expression.cpp View File

@@ -272,7 +272,7 @@ public:
}
else
{
result = scope.evaluateFunction (functionName, 0, 0);
result = scope.evaluateFunction (functionName, nullptr, 0);
}
return new Constant (result, false);


Loading…
Cancel
Save