openshot-audio  0.1.6
juce_Typeface.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_TYPEFACE_H_INCLUDED
26 #define JUCE_TYPEFACE_H_INCLUDED
27 
28 
29 //==============================================================================
45 {
46 public:
47  //==============================================================================
50 
51  //==============================================================================
55  const String& getName() const noexcept { return name; }
56 
57  //==============================================================================
61  const String& getStyle() const noexcept { return style; }
62 
63  //==============================================================================
65  static Ptr createSystemTypefaceFor (const Font& font);
66 
71  static Ptr createSystemTypefaceFor (const void* fontFileData, size_t fontFileDataSize);
72 
73  //==============================================================================
75  virtual ~Typeface();
76 
81  virtual bool isSuitableForFont (const Font&) const { return true; }
82 
88  virtual float getAscent() const = 0;
89 
95  virtual float getDescent() const = 0;
96 
100  virtual float getHeightToPointsFactor() const = 0;
101 
106  virtual float getStringWidth (const String& text) = 0;
107 
112  virtual void getGlyphPositions (const String& text, Array <int>& glyphs, Array<float>& xOffsets) = 0;
113 
117  virtual bool getOutlineForGlyph (int glyphNumber, Path& path) = 0;
118 
120  virtual EdgeTable* getEdgeTableForGlyph (int glyphNumber, const AffineTransform& transform, float fontHeight);
121 
123  virtual bool isHinted() const { return false; }
124 
125  //==============================================================================
127  static void setTypefaceCacheSize (int numFontsToCache);
128 
130  static void clearTypefaceCache();
131 
135  static void scanFolderForFonts (const File& folder);
136 
141  void applyVerticalHintingTransform (float fontHeight, Path& path);
142 
143 protected:
144  //==============================================================================
145  String name, style;
146 
147  Typeface (const String& name, const String& style) noexcept;
148 
149  static Ptr getFallbackTypeface();
150 
151 private:
153  friend struct ContainerDeletePolicy<HintingParams>;
154  ScopedPointer<HintingParams> hintingParams;
155  CriticalSection hintingLock;
156 
158 };
159 
160 
161 #endif // JUCE_TYPEFACE_H_INCLUDED
ReferenceCountedObjectPtr< Typeface > Ptr
Definition: juce_Typeface.h:49
Definition: juce_EdgeTable.h:35
Definition: juce_Font.h:39
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_String.h:43
virtual bool isHinted() const
Definition: juce_Typeface.h:123
#define JUCE_API
Definition: juce_StandardHeader.h:139
#define const
Definition: juce_ReferenceCountedObject.h:65
Definition: juce_CriticalSection.h:47
Definition: juce_Typeface.h:44
Definition: juce_Path.h:62
const String & getName() const noexcept
Definition: juce_Typeface.h:55
const String & getStyle() const noexcept
Definition: juce_Typeface.h:61
Definition: juce_ScopedPointer.h:70
Definition: juce_ContainerDeletePolicy.h:44
String style
Definition: juce_Typeface.h:145
Definition: juce_Array.h:60
virtual bool isSuitableForFont(const Font &) const
Definition: juce_Typeface.h:81
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_AffineTransform.h:40
Definition: juce_Typeface.cpp:135
Definition: juce_File.h:45