From 7d9b068a4988ee331a8d4ae1588037a4dfa58968 Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Fri, 12 Feb 2010 18:07:28 +0000 Subject: [PATCH] Changed Font::findFonts() to use an Array instead of an OwnedArray. --- .../src/properties/jucer_FontPropertyComponent.cpp | 4 ++-- juce_amalgamated.cpp | 4 ++-- juce_amalgamated.h | 7 ++++++- src/containers/juce_Range.h | 6 ++++++ src/gui/graphics/fonts/juce_Font.cpp | 4 ++-- src/gui/graphics/fonts/juce_Font.h | 2 +- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/extras/the jucer/src/properties/jucer_FontPropertyComponent.cpp b/extras/the jucer/src/properties/jucer_FontPropertyComponent.cpp index 6e6791a832..6899947aed 100644 --- a/extras/the jucer/src/properties/jucer_FontPropertyComponent.cpp +++ b/extras/the jucer/src/properties/jucer_FontPropertyComponent.cpp @@ -33,11 +33,11 @@ class FontList : public DeletedAtShutdown public: FontList() { - OwnedArray fonts; + Array fonts; Font::findFonts (fonts); for (int i = 0; i < fonts.size(); ++i) - fontNames.add (fonts[i]->getTypefaceName()); + fontNames.add (fonts[i].getTypefaceName()); } ~FontList() diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index fae841a9ac..506f7e33d0 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -85823,12 +85823,12 @@ void Font::getGlyphPositions (const String& text, Array & glyphs, Array & destArray) throw() +void Font::findFonts (Array& destArray) throw() { const StringArray names (findAllTypefaceNames()); for (int i = 0; i < names.size(); ++i) - destArray.add (new Font (names[i], defaultFontHeight, Font::plain)); + destArray.add (Font (names[i], defaultFontHeight, Font::plain)); } class TypefaceCache : public DeletedAtShutdown diff --git a/juce_amalgamated.h b/juce_amalgamated.h index cb7c3815d3..db786554ff 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -4947,6 +4947,11 @@ public: return position >= start && position < end; } + ValueType clipValue (const ValueType value) const throw() + { + return jlimit (start, end, value); + } + bool intersects (const Range& other) const throw() { return other.start < end && other.end > start; @@ -10689,7 +10694,7 @@ public: Typeface* getTypeface() const throw(); - static void findFonts (OwnedArray& results) throw(); + static void findFonts (Array& results) throw(); static const StringArray findAllTypefaceNames() throw(); diff --git a/src/containers/juce_Range.h b/src/containers/juce_Range.h index 5435bad885..ca949a6c16 100644 --- a/src/containers/juce_Range.h +++ b/src/containers/juce_Range.h @@ -166,6 +166,12 @@ public: return position >= start && position < end; } + /** Returns the nearest value to the one supplied, which lies within the range. */ + ValueType clipValue (const ValueType value) const throw() + { + return jlimit (start, end, value); + } + /** Returns true if the given range intersects this one. */ bool intersects (const Range& other) const throw() { diff --git a/src/gui/graphics/fonts/juce_Font.cpp b/src/gui/graphics/fonts/juce_Font.cpp index 4ef4a5b06e..24549c48f7 100644 --- a/src/gui/graphics/fonts/juce_Font.cpp +++ b/src/gui/graphics/fonts/juce_Font.cpp @@ -327,12 +327,12 @@ void Font::getGlyphPositions (const String& text, Array & glyphs, Array & destArray) throw() +void Font::findFonts (Array& destArray) throw() { const StringArray names (findAllTypefaceNames()); for (int i = 0; i < names.size(); ++i) - destArray.add (new Font (names[i], defaultFontHeight, Font::plain)); + destArray.add (Font (names[i], defaultFontHeight, Font::plain)); } diff --git a/src/gui/graphics/fonts/juce_Font.h b/src/gui/graphics/fonts/juce_Font.h index 81c6585497..22db2f7209 100644 --- a/src/gui/graphics/fonts/juce_Font.h +++ b/src/gui/graphics/fonts/juce_Font.h @@ -322,7 +322,7 @@ public: @param results the array to which new Font objects will be added. */ - static void findFonts (OwnedArray& results) throw(); + static void findFonts (Array& results) throw(); /** Returns a list of all the available typeface names.