LMMS
Loading...
Searching...
No Matches
juce_Font.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29namespace FontValues
30{
31 static float limitFontHeight (const float height) noexcept
32 {
33 return jlimit (0.1f, 10000.0f, height);
34 }
35
36 const float defaultFontHeight = 14.0f;
40}
41
44
47
48//==============================================================================
50{
51public:
53 {
54 setSize (10);
55 }
56
58 {
59 clearSingletonInstance();
60 }
61
63
64 void setSize (const int numToCache)
65 {
66 const ScopedWriteLock sl (lock);
67
68 faces.clear();
69 faces.insertMultiple (-1, CachedFace(), numToCache);
70 }
71
72 void clear()
73 {
74 const ScopedWriteLock sl (lock);
75
76 setSize (faces.size());
77 defaultFace = nullptr;
78 }
79
81 {
82 const auto faceName = font.getTypefaceName();
83 const auto faceStyle = font.getTypefaceStyle();
84
85 jassert (faceName.isNotEmpty());
86
87 {
88 const ScopedReadLock slr (lock);
89
90 for (int i = faces.size(); --i >= 0;)
91 {
92 CachedFace& face = faces.getReference(i);
93
94 if (face.typefaceName == faceName
95 && face.typefaceStyle == faceStyle
96 && face.typeface != nullptr
97 && face.typeface->isSuitableForFont (font))
98 {
99 face.lastUsageCount = ++counter;
100 return face.typeface;
101 }
102 }
103 }
104
105 const ScopedWriteLock slw (lock);
106 int replaceIndex = 0;
107 auto bestLastUsageCount = std::numeric_limits<size_t>::max();
108
109 for (int i = faces.size(); --i >= 0;)
110 {
111 auto lu = faces.getReference(i).lastUsageCount;
112
113 if (bestLastUsageCount > lu)
114 {
115 bestLastUsageCount = lu;
116 replaceIndex = i;
117 }
118 }
119
120 auto& face = faces.getReference (replaceIndex);
121 face.typefaceName = faceName;
122 face.typefaceStyle = faceStyle;
123 face.lastUsageCount = ++counter;
124
125 if (juce_getTypefaceForFont == nullptr)
126 face.typeface = Font::getDefaultTypefaceForFont (font);
127 else
128 face.typeface = juce_getTypefaceForFont (font);
129
130 jassert (face.typeface != nullptr); // the look and feel must return a typeface!
131
132 if (defaultFace == nullptr && font == Font())
133 defaultFace = face.typeface;
134
135 return face.typeface;
136 }
137
139 {
140 const ScopedReadLock slr (lock);
141 return defaultFace;
142 }
143
144private:
146 {
148
149 // Although it seems a bit wacky to store the name here, it's because it may be a
150 // placeholder rather than a real one, e.g. "<Sans-Serif>" vs the actual typeface name.
151 // Since the typeface itself doesn't know that it may have this alias, the name under
152 // which it was fetched needs to be stored separately.
154 size_t lastUsageCount = 0;
156 };
157
161 size_t counter = 0;
162
164};
165
167
168void Typeface::setTypefaceCacheSize (int numFontsToCache)
169{
170 TypefaceCache::getInstance()->setSize (numFontsToCache);
171}
172
174
176{
177 TypefaceCache::getInstance()->clear();
178
180
181 if (clearOpenGLGlyphCache != nullptr)
183}
184
185//==============================================================================
187{
188public:
190 : typeface (TypefaceCache::getInstance()->getDefaultFace()),
193 height (FontValues::defaultFontHeight)
194 {
195 }
196
197 SharedFontInternal (int styleFlags, float fontHeight) noexcept
200 height (fontHeight),
201 underline ((styleFlags & underlined) != 0)
202 {
203 if (styleFlags == plain)
204 typeface = TypefaceCache::getInstance()->getDefaultFace();
205 }
206
207 SharedFontInternal (const String& name, int styleFlags, float fontHeight) noexcept
208 : typefaceName (name),
210 height (fontHeight),
211 underline ((styleFlags & underlined) != 0)
212 {
213 if (styleFlags == plain && typefaceName.isEmpty())
214 typeface = TypefaceCache::getInstance()->getDefaultFace();
215 }
216
217 SharedFontInternal (const String& name, const String& style, float fontHeight) noexcept
218 : typefaceName (name), typefaceStyle (style), height (fontHeight)
219 {
220 if (typefaceName.isEmpty())
222 }
223
225 : typeface (face),
226 typefaceName (face->getName()),
227 typefaceStyle (face->getStyle()),
229 {
230 jassert (typefaceName.isNotEmpty());
231 }
232
235 typeface (other.typeface),
236 typefaceName (other.typefaceName),
237 typefaceStyle (other.typefaceStyle),
238 height (other.height),
239 horizontalScale (other.horizontalScale),
240 kerning (other.kerning),
241 ascent (other.ascent),
242 underline (other.underline)
243 {
244 }
245
246 auto tie() const
247 {
249 }
250
251 bool operator== (const SharedFontInternal& other) const noexcept
252 {
253 return tie() == other.tie();
254 }
255
256 bool operator< (const SharedFontInternal& other) const noexcept
257 {
258 return tie() < other.tie();
259 }
260
261 /* The typeface and ascent data members may be read/set from multiple threads
262 simultaneously, e.g. in the case that two Font instances reference the same
263 SharedFontInternal and call getTypefacePtr() simultaneously.
264
265 We lock in functions that modify the typeface or ascent in order to
266 ensure thread safety.
267 */
268
270 {
271 const ScopedLock lock (mutex);
272
273 if (typeface == nullptr)
274 {
275 typeface = TypefaceCache::getInstance()->findTypefaceFor (f);
276 jassert (typeface != nullptr);
277 }
278
279 return typeface;
280 }
281
283 {
284 const ScopedLock lock (mutex);
285
286 if (typeface != nullptr && ! typeface->isSuitableForFont (f))
287 typeface = nullptr;
288 }
289
290 float getAscent (const Font& f)
291 {
292 const ScopedLock lock (mutex);
293
294 if (ascent == 0.0f)
295 ascent = getTypefacePtr (f)->getAscent();
296
297 return height * ascent;
298 }
299
300 /* We do not need to lock in these functions, as it's guaranteed
301 that these data members can only change if there is a single Font
302 instance referencing the shared state.
303 */
304
307 float getHeight() const { return height; }
308 float getHorizontalScale() const { return horizontalScale; }
309 float getKerning() const { return kerning; }
310 bool getUnderline() const { return underline; }
311
312 /* This shared state may be shared between two or more Font instances that are being
313 read/modified from multiple threads.
314 Before modifying a shared instance you *must* call dupeInternalIfShared to
315 ensure that only one Font instance is pointing to the SharedFontInternal instance
316 during the modification.
317 */
318
320 {
321 jassert (getReferenceCount() == 1);
322 typeface = std::move (x);
323 }
324
326 {
327 jassert (getReferenceCount() == 1);
328 typefaceName = std::move (x);
329 }
330
332 {
333 jassert (getReferenceCount() == 1);
334 typefaceStyle = std::move (x);
335 }
336
337 void setHeight (float x)
338 {
339 jassert (getReferenceCount() == 1);
340 height = x;
341 }
342
344 {
345 jassert (getReferenceCount() == 1);
347 }
348
349 void setKerning (float x)
350 {
351 jassert (getReferenceCount() == 1);
352 kerning = x;
353 }
354
355 void setAscent (float x)
356 {
357 jassert (getReferenceCount() == 1);
358 ascent = x;
359 }
360
361 void setUnderline (bool x)
362 {
363 jassert (getReferenceCount() == 1);
364 underline = x;
365 }
366
367private:
370 float height = 0.0f, horizontalScale = 1.0f, kerning = 0.0f, ascent = 0.0f;
371 bool underline = false;
372
374};
375
376//==============================================================================
378Font::Font (const Typeface::Ptr& typeface) : font (new SharedFontInternal (typeface)) {}
379Font::Font (const Font& other) noexcept : font (other.font) {}
380
381Font::Font (float fontHeight, int styleFlags)
382 : font (new SharedFontInternal (styleFlags, FontValues::limitFontHeight (fontHeight)))
383{
384}
385
386Font::Font (const String& typefaceName, float fontHeight, int styleFlags)
387 : font (new SharedFontInternal (typefaceName, styleFlags, FontValues::limitFontHeight (fontHeight)))
388{
389}
390
391Font::Font (const String& typefaceName, const String& typefaceStyle, float fontHeight)
392 : font (new SharedFontInternal (typefaceName, typefaceStyle, FontValues::limitFontHeight (fontHeight)))
393{
394}
395
396Font& Font::operator= (const Font& other) noexcept
397{
398 font = other.font;
399 return *this;
400}
401
403 : font (std::move (other.font))
404{
405}
406
407Font& Font::operator= (Font&& other) noexcept
408{
409 font = std::move (other.font);
410 return *this;
411}
412
413Font::~Font() noexcept = default;
414
415bool Font::operator== (const Font& other) const noexcept
416{
417 return font == other.font
418 || *font == *other.font;
419}
420
421bool Font::operator!= (const Font& other) const noexcept
422{
423 return ! operator== (other);
424}
425
426bool Font::compare (const Font& a, const Font& b) noexcept
427{
428 return *a.font < *b.font;
429}
430
432{
433 if (font->getReferenceCount() > 1)
434 font = *new SharedFontInternal (*font);
435}
436
438{
439 font->checkTypefaceSuitability (*this);
440}
441
442//==============================================================================
444{
445 String sans { "<Sans-Serif>" },
446 serif { "<Serif>" },
447 mono { "<Monospaced>" },
448 regular { "<Regular>" };
449};
450
452{
453 static FontPlaceholderNames names;
454 return names;
455}
456
457#if JUCE_MSVC
458// This is a workaround for the lack of thread-safety in MSVC's handling of function-local
459// statics - if multiple threads all try to create the first Font object at the same time,
460// it can cause a race-condition in creating these placeholder strings.
461struct FontNamePreloader { FontNamePreloader() { getFontPlaceholderNames(); } };
462static FontNamePreloader fnp;
463#endif
464
469
470String Font::getTypefaceName() const noexcept { return font->getTypefaceName(); }
471String Font::getTypefaceStyle() const noexcept { return font->getTypefaceStyle(); }
472
473void Font::setTypefaceName (const String& faceName)
474{
475 if (faceName != font->getTypefaceName())
476 {
477 jassert (faceName.isNotEmpty());
478
480 font->setTypefaceName (faceName);
481 font->setTypeface (nullptr);
482 font->setAscent (0);
483 }
484}
485
486void Font::setTypefaceStyle (const String& typefaceStyle)
487{
488 if (typefaceStyle != font->getTypefaceStyle())
489 {
491 font->setTypefaceStyle (typefaceStyle);
492 font->setTypeface (nullptr);
493 font->setAscent (0);
494 }
495}
496
497Font Font::withTypefaceStyle (const String& newStyle) const
498{
499 Font f (*this);
500 f.setTypefaceStyle (newStyle);
501 return f;
502}
503
508
510{
511 return font->getTypefacePtr (*this);
512}
513
515{
516 return getTypefacePtr().get();
517}
518
519//==============================================================================
524
526{
528
529 #if JUCE_MAC || JUCE_IOS
530 jassertfalse; // Note that use of a fallback font isn't currently implemented in OSX..
531 #endif
532}
533
538
540{
542
543 #if JUCE_MAC || JUCE_IOS
544 jassertfalse; // Note that use of a fallback font isn't currently implemented in OSX..
545 #endif
546}
547
548//==============================================================================
549Font Font::withHeight (const float newHeight) const
550{
551 Font f (*this);
552 f.setHeight (newHeight);
553 return f;
554}
555
557{
558 return getTypefacePtr()->getHeightToPointsFactor();
559}
560
561Font Font::withPointHeight (float heightInPoints) const
562{
563 Font f (*this);
564 f.setHeight (heightInPoints / getHeightToPointsFactor());
565 return f;
566}
567
568void Font::setHeight (float newHeight)
569{
570 newHeight = FontValues::limitFontHeight (newHeight);
571
572 if (font->getHeight() != newHeight)
573 {
575 font->setHeight (newHeight);
577 }
578}
579
581{
582 newHeight = FontValues::limitFontHeight (newHeight);
583
584 if (font->getHeight() != newHeight)
585 {
587 font->setHorizontalScale (font->getHorizontalScale() * (font->getHeight() / newHeight));
588 font->setHeight (newHeight);
590 }
591}
592
594{
595 int styleFlags = font->getUnderline() ? underlined : plain;
596
597 if (isBold()) styleFlags |= bold;
598 if (isItalic()) styleFlags |= italic;
599
600 return styleFlags;
601}
602
603Font Font::withStyle (const int newFlags) const
604{
605 Font f (*this);
606 f.setStyleFlags (newFlags);
607 return f;
608}
609
610void Font::setStyleFlags (const int newFlags)
611{
612 if (getStyleFlags() != newFlags)
613 {
615 font->setTypeface (nullptr);
616 font->setTypefaceStyle (FontStyleHelpers::getStyleName (newFlags));
617 font->setUnderline ((newFlags & underlined) != 0);
618 font->setAscent (0);
619 }
620}
621
622void Font::setSizeAndStyle (float newHeight,
623 const int newStyleFlags,
624 const float newHorizontalScale,
625 const float newKerningAmount)
626{
627 newHeight = FontValues::limitFontHeight (newHeight);
628
629 if (font->getHeight() != newHeight
630 || font->getHorizontalScale() != newHorizontalScale
631 || font->getKerning() != newKerningAmount)
632 {
634 font->setHeight (newHeight);
635 font->setHorizontalScale (newHorizontalScale);
636 font->setKerning (newKerningAmount);
638 }
639
640 setStyleFlags (newStyleFlags);
641}
642
643void Font::setSizeAndStyle (float newHeight,
644 const String& newStyle,
645 const float newHorizontalScale,
646 const float newKerningAmount)
647{
648 newHeight = FontValues::limitFontHeight (newHeight);
649
650 if (font->getHeight() != newHeight
651 || font->getHorizontalScale() != newHorizontalScale
652 || font->getKerning() != newKerningAmount)
653 {
655 font->setHeight (newHeight);
656 font->setHorizontalScale (newHorizontalScale);
657 font->setKerning (newKerningAmount);
659 }
660
661 setTypefaceStyle (newStyle);
662}
663
664Font Font::withHorizontalScale (const float newHorizontalScale) const
665{
666 Font f (*this);
667 f.setHorizontalScale (newHorizontalScale);
668 return f;
669}
670
671void Font::setHorizontalScale (const float scaleFactor)
672{
674 font->setHorizontalScale (scaleFactor);
676}
677
679{
680 return font->getHorizontalScale();
681}
682
684{
685 return font->getKerning();
686}
687
688Font Font::withExtraKerningFactor (const float extraKerning) const
689{
690 Font f (*this);
691 f.setExtraKerningFactor (extraKerning);
692 return f;
693}
694
695void Font::setExtraKerningFactor (const float extraKerning)
696{
698 font->setKerning (extraKerning);
700}
701
704
705bool Font::isBold() const noexcept { return FontStyleHelpers::isBold (font->getTypefaceStyle()); }
706bool Font::isItalic() const noexcept { return FontStyleHelpers::isItalic (font->getTypefaceStyle()); }
707bool Font::isUnderlined() const noexcept { return font->getUnderline(); }
708
709void Font::setBold (const bool shouldBeBold)
710{
711 auto flags = getStyleFlags();
712 setStyleFlags (shouldBeBold ? (flags | bold)
713 : (flags & ~bold));
714}
715
716void Font::setItalic (const bool shouldBeItalic)
717{
718 auto flags = getStyleFlags();
719 setStyleFlags (shouldBeItalic ? (flags | italic)
720 : (flags & ~italic));
721}
722
723void Font::setUnderline (const bool shouldBeUnderlined)
724{
726 font->setUnderline (shouldBeUnderlined);
728}
729
730float Font::getAscent() const
731{
732 return font->getAscent (*this);
733}
734
735float Font::getHeight() const noexcept { return font->getHeight(); }
736float Font::getDescent() const { return font->getHeight() - getAscent(); }
737
741
743{
744 return (int) std::ceil (getStringWidthFloat (text));
745}
746
748{
749 auto w = getTypefacePtr()->getStringWidth (text);
750
751 if (font->getKerning() != 0.0f)
752 w += font->getKerning() * (float) text.length();
753
754 return w * font->getHeight() * font->getHorizontalScale();
755}
756
757void Font::getGlyphPositions (const String& text, Array<int>& glyphs, Array<float>& xOffsets) const
758{
759 getTypefacePtr()->getGlyphPositions (text, glyphs, xOffsets);
760
761 if (auto num = xOffsets.size())
762 {
763 auto scale = font->getHeight() * font->getHorizontalScale();
764 auto* x = xOffsets.getRawDataPointer();
765
766 if (font->getKerning() != 0.0f)
767 {
768 for (int i = 0; i < num; ++i)
769 x[i] = (x[i] + (float) i * font->getKerning()) * scale;
770 }
771 else
772 {
773 for (int i = 0; i < num; ++i)
774 x[i] *= scale;
775 }
776 }
777}
778
780{
781 for (auto& name : findAllTypefaceNames())
782 {
783 auto styles = findAllTypefaceStyles (name);
784
785 String style ("Regular");
786
787 if (! styles.contains (style, true))
788 style = styles[0];
789
791 }
792}
793
794//==============================================================================
796{
797 String s;
798
800 s << getTypefaceName() << "; ";
801
802 s << String (getHeight(), 1);
803
805 s << ' ' << getTypefaceStyle();
806
807 return s;
808}
809
810Font Font::fromString (const String& fontDescription)
811{
812 const int separator = fontDescription.indexOfChar (';');
813 String name;
814
815 if (separator > 0)
816 name = fontDescription.substring (0, separator).trim();
817
818 if (name.isEmpty())
820
821 String sizeAndStyle (fontDescription.substring (separator + 1).trimStart());
822
823 float height = sizeAndStyle.getFloatValue();
824 if (height <= 0)
825 height = 10.0f;
826
827 const String style (sizeAndStyle.fromFirstOccurrenceOf (" ", false, false));
828
829 return Font (name, style, height);
830}
831
832} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
uint8_t a
Definition Spc_Cpu.h:141
Definition juce_Array.h:56
int size() const noexcept
Definition juce_Array.h:215
ElementType * getRawDataPointer() noexcept
Definition juce_Array.h:310
void add(const ElementType &newElement)
Definition juce_Array.h:418
Definition juce_CriticalSection.h:43
DeletedAtShutdown()
Definition juce_DeletedAtShutdown.cpp:34
Definition juce_Font.cpp:187
void setHorizontalScale(float x)
Definition juce_Font.cpp:343
float height
Definition juce_Font.cpp:370
SharedFontInternal() noexcept
Definition juce_Font.cpp:189
SharedFontInternal(const String &name, const String &style, float fontHeight) noexcept
Definition juce_Font.cpp:217
float getKerning() const
Definition juce_Font.cpp:309
bool getUnderline() const
Definition juce_Font.cpp:310
void setHeight(float x)
Definition juce_Font.cpp:337
float kerning
Definition juce_Font.cpp:370
float getHeight() const
Definition juce_Font.cpp:307
String typefaceStyle
Definition juce_Font.cpp:369
void setUnderline(bool x)
Definition juce_Font.cpp:361
Typeface::Ptr getTypefacePtr(const Font &f)
Definition juce_Font.cpp:269
float ascent
Definition juce_Font.cpp:370
void setTypefaceStyle(String x)
Definition juce_Font.cpp:331
SharedFontInternal(const String &name, int styleFlags, float fontHeight) noexcept
Definition juce_Font.cpp:207
bool underline
Definition juce_Font.cpp:371
void checkTypefaceSuitability(const Font &f)
Definition juce_Font.cpp:282
String getTypefaceName() const
Definition juce_Font.cpp:305
SharedFontInternal(const SharedFontInternal &other) noexcept
Definition juce_Font.cpp:233
SharedFontInternal(int styleFlags, float fontHeight) noexcept
Definition juce_Font.cpp:197
void setAscent(float x)
Definition juce_Font.cpp:355
Typeface::Ptr typeface
Definition juce_Font.cpp:368
String getTypefaceStyle() const
Definition juce_Font.cpp:306
String typefaceName
Definition juce_Font.cpp:369
void setTypeface(Typeface::Ptr x)
Definition juce_Font.cpp:319
float getHorizontalScale() const
Definition juce_Font.cpp:308
auto tie() const
Definition juce_Font.cpp:246
CriticalSection mutex
Definition juce_Font.cpp:373
float getAscent(const Font &f)
Definition juce_Font.cpp:290
void setTypefaceName(String x)
Definition juce_Font.cpp:325
SharedFontInternal(const Typeface::Ptr &face) noexcept
Definition juce_Font.cpp:224
void setKerning(float x)
Definition juce_Font.cpp:349
float horizontalScale
Definition juce_Font.cpp:370
Definition juce_Font.h:42
JUCE_NODISCARD Font withExtraKerningFactor(float extraKerning) const
Definition juce_Font.cpp:688
void setExtraKerningFactor(float extraKerning)
Definition juce_Font.cpp:695
static const String & getFallbackFontStyle()
Definition juce_Font.cpp:534
JUCE_NODISCARD Font withHeight(float height) const
Definition juce_Font.cpp:549
int getStyleFlags() const noexcept
Definition juce_Font.cpp:593
float getHeightInPoints() const
Definition juce_Font.cpp:738
static const String & getDefaultStyle()
Definition juce_Font.cpp:468
static const String & getFallbackFontName()
Definition juce_Font.cpp:520
void getGlyphPositions(const String &text, Array< int > &glyphs, Array< float > &xOffsets) const
Definition juce_Font.cpp:757
void setUnderline(bool shouldBeUnderlined)
Definition juce_Font.cpp:723
static float getDefaultMinimumHorizontalScaleFactor() noexcept
Definition juce_Font.cpp:45
Font(float fontHeight, int styleFlags=plain)
Definition juce_Font.cpp:381
static Typeface::Ptr getDefaultTypefaceForFont(const Font &font)
Definition juce_linux_Fonts.cpp:215
void setSizeAndStyle(float newHeight, int newStyleFlags, float newHorizontalScale, float newKerningAmount)
Definition juce_Font.cpp:622
static const String & getDefaultSansSerifFontName()
Definition juce_Font.cpp:465
static Font fromString(const String &fontDescription)
Definition juce_Font.cpp:810
float getDescent() const
Definition juce_Font.cpp:736
Typeface::Ptr getTypefacePtr() const
Definition juce_Font.cpp:509
float getHeight() const noexcept
Definition juce_Font.cpp:735
String getTypefaceName() const noexcept
Definition juce_Font.cpp:470
static const String & getDefaultMonospacedFontName()
Definition juce_Font.cpp:467
void setStyleFlags(int newFlags)
Definition juce_Font.cpp:610
String getTypefaceStyle() const noexcept
Definition juce_Font.cpp:471
String toString() const
Definition juce_Font.cpp:795
bool isItalic() const noexcept
Definition juce_Font.cpp:706
static StringArray findAllTypefaceStyles(const String &family)
Definition juce_linux_Fonts.cpp:103
float getStringWidthFloat(const String &text) const
Definition juce_Font.cpp:747
void dupeInternalIfShared()
Definition juce_Font.cpp:431
void setItalic(bool shouldBeItalic)
Definition juce_Font.cpp:716
void setBold(bool shouldBeBold)
Definition juce_Font.cpp:709
int getStringWidth(const String &text) const
Definition juce_Font.cpp:742
StringArray getAvailableStyles() const
Definition juce_Font.cpp:504
void setTypefaceStyle(const String &newStyle)
Definition juce_Font.cpp:486
void setHorizontalScale(float scaleFactor)
Definition juce_Font.cpp:671
void setTypefaceName(const String &faceName)
Definition juce_Font.cpp:473
float getAscent() const
Definition juce_Font.cpp:730
static bool compare(const Font &, const Font &) noexcept
Definition juce_Font.cpp:426
~Font() noexcept
static StringArray findAllTypefaceNames()
Definition juce_linux_Fonts.cpp:98
static void findFonts(Array< Font > &results)
Definition juce_Font.cpp:779
JUCE_NODISCARD Font boldened() const
Definition juce_Font.cpp:702
JUCE_NODISCARD Font withTypefaceStyle(const String &newStyle) const
Definition juce_Font.cpp:497
JUCE_NODISCARD Font withStyle(int styleFlags) const
Definition juce_Font.cpp:603
bool isBold() const noexcept
Definition juce_Font.cpp:705
float getExtraKerningFactor() const noexcept
Definition juce_Font.cpp:683
JUCE_NODISCARD Font italicised() const
Definition juce_Font.cpp:703
@ bold
Definition juce_Font.h:51
@ underlined
Definition juce_Font.h:53
@ plain
Definition juce_Font.h:50
@ italic
Definition juce_Font.h:52
bool isUnderlined() const noexcept
Definition juce_Font.cpp:707
float getHeightToPointsFactor() const
Definition juce_Font.cpp:556
float getAscentInPoints() const
Definition juce_Font.cpp:739
float getDescentInPoints() const
Definition juce_Font.cpp:740
static const String & getDefaultSerifFontName()
Definition juce_Font.cpp:466
void setHeightWithoutChangingWidth(float newHeight)
Definition juce_Font.cpp:580
ReferenceCountedObjectPtr< SharedFontInternal > font
Definition juce_Font.h:483
void setHeight(float newHeight)
Definition juce_Font.cpp:568
JUCE_NODISCARD Font withHorizontalScale(float scaleFactor) const
Definition juce_Font.cpp:664
static void setDefaultMinimumHorizontalScaleFactor(float newMinimumScaleFactor) noexcept
Definition juce_Font.cpp:46
float getHorizontalScale() const noexcept
Definition juce_Font.cpp:678
Typeface * getTypeface() const
Definition juce_Font.cpp:514
JUCE_NODISCARD Font withPointHeight(float heightInPoints) const
Definition juce_Font.cpp:561
static void setFallbackFontName(const String &name)
Definition juce_Font.cpp:525
static void setFallbackFontStyle(const String &style)
Definition juce_Font.cpp:539
void checkTypefaceSuitability()
Definition juce_Font.cpp:437
Definition juce_ReadWriteLock.h:48
int getReferenceCount() const noexcept
Definition juce_ReferenceCountedObject.h:101
static void clearGlyphCache()
Definition juce_RenderingHelpers.h:2529
Definition juce_ScopedReadLock.h:52
Definition juce_ScopedWriteLock.h:52
Definition juce_StringArray.h:35
Definition juce_String.h:53
int indexOfChar(juce_wchar characterToLookFor) const noexcept
Definition juce_String.cpp:874
String trim() const
Definition juce_String.cpp:1656
float getFloatValue() const noexcept
Definition juce_String.cpp:1873
String trimStart() const
Definition juce_String.cpp:1674
String substring(int startIndex, int endIndex) const
Definition juce_String.cpp:1498
bool isNotEmpty() const noexcept
Definition juce_String.h:316
String fromFirstOccurrenceOf(StringRef substringToStartFrom, bool includeSubStringInResult, bool ignoreCase) const
Definition juce_String.cpp:1565
Definition juce_Font.cpp:50
size_t counter
Definition juce_Font.cpp:161
~TypefaceCache()
Definition juce_Font.cpp:57
void clear()
Definition juce_Font.cpp:72
Array< CachedFace > faces
Definition juce_Font.cpp:160
Typeface::Ptr getDefaultFace() const noexcept
Definition juce_Font.cpp:138
ReadWriteLock lock
Definition juce_Font.cpp:159
TypefaceCache()
Definition juce_Font.cpp:52
Typeface::Ptr defaultFace
Definition juce_Font.cpp:158
void setSize(const int numToCache)
Definition juce_Font.cpp:64
Typeface::Ptr findTypefaceFor(const Font &font)
Definition juce_Font.cpp:80
Definition juce_Typeface.h:47
virtual bool isSuitableForFont(const Font &) const
Definition juce_Typeface.h:83
Typeface(const String &name, const String &style) noexcept
Definition juce_Typeface.cpp:108
ReferenceCountedObjectPtr< Typeface > Ptr
Definition juce_Typeface.h:51
static void clearTypefaceCache()
Definition juce_Font.cpp:175
static void setTypefaceCacheSize(int numFontsToCache)
Definition juce_Font.cpp:168
UINT_D64 w
Definition inflate.c:942
register unsigned i
Definition inflate.c:1575
unsigned s
Definition inflate.c:1555
unsigned x[BMAX+1]
Definition inflate.c:1586
unsigned f
Definition inflate.c:1572
static const char * name
Definition pugl.h:1582
static int int height
Definition pugl.h:1594
#define jassert(expression)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define jassertfalse
#define JUCE_IMPLEMENT_SINGLETON(Classname)
Definition juce_Singleton.h:201
#define JUCE_DECLARE_SINGLETON(Classname, doNotRecreateAfterDeletion)
Definition juce_Singleton.h:184
static const SerdStyle style
Definition sratom.c:36
Definition juce_Font.cpp:30
static float limitFontHeight(const float height) noexcept
Definition juce_Font.cpp:31
const float defaultFontHeight
Definition juce_Font.cpp:36
float minimumHorizontalScale
Definition juce_Font.cpp:37
String fallbackFontStyle
Definition juce_Font.cpp:39
String fallbackFont
Definition juce_Font.cpp:38
Definition carla_juce.cpp:31
CriticalSection::ScopedLockType ScopedLock
Definition juce_CriticalSection.h:186
void(* clearOpenGLGlyphCache)()
Definition juce_Font.cpp:173
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Definition juce_MathsFunctions.h:262
static const FontPlaceholderNames & getFontPlaceholderNames()
Definition juce_Font.cpp:451
GetTypefaceForFont juce_getTypefaceForFont
Definition juce_Font.cpp:43
Typeface::Ptr(*)(const Font &) GetTypefaceForFont
Definition juce_Font.cpp:42
jack_client_t client jack_client_t client jack_client_t client jack_client_t JackInfoShutdownCallback void arg jack_client_t jack_port_t port void func jack_client_t const char const char unsigned long flags
Definition juce_linux_JackAudio.cpp:69
Definition juce_Font.cpp:444
String serif
Definition juce_Font.cpp:446
String sans
Definition juce_Font.cpp:445
String mono
Definition juce_Font.cpp:447
String regular
Definition juce_Font.cpp:448
static bool isItalic(const String &style) noexcept
Definition juce_Typeface.cpp:51
static bool isBold(const String &style) noexcept
Definition juce_Typeface.cpp:46
static const char * getStyleName(const bool bold, const bool italic) noexcept
Definition juce_Typeface.cpp:31
Definition juce_Font.cpp:146
String typefaceStyle
Definition juce_Font.cpp:153
String typefaceName
Definition juce_Font.cpp:153
CachedFace() noexcept
Definition juce_Font.cpp:147
size_t lastUsageCount
Definition juce_Font.cpp:154
Typeface::Ptr typeface
Definition juce_Font.cpp:155
const char * text
Definition swell-functions.h:167
b
Definition crypt.c:628
#define void
Definition unzip.h:396
#define const
Definition zconf.h:137