45 kerningPairs.add ({ subsequentCharacter, extraKerningAmount });
50 if (subsequentCharacter != 0)
52 if (kp.character2 == subsequentCharacter)
53 return width + kp.kerningAmount;
74 if (
n >= 0xd800 &&
n <= 0xdfff)
79 n = 0x10000 + (((
n - 0xd800) << 10) | (nextWord - 0xdc00));
87 if (charToWrite >= 0x10000)
89 charToWrite -= 0x10000;
90 out.writeShort ((
short) (
uint16) (0xd800 + (charToWrite >> 10)));
91 out.writeShort ((
short) (
uint16) (0xdc00 + (charToWrite & 0x3ff)));
95 out.writeShort ((
short) (
uint16) charToWrite);
117 const bool isBold =
in.readBool();
118 const bool isItalic =
in.readBool();
124 auto numChars =
in.readInt();
126 for (
int i = 0;
i < numChars; ++
i)
132 p.loadPathFromStream (
in);
136 auto numKerningPairs =
in.readInt();
138 for (
int i = 0;
i < numKerningPairs; ++
i)
162 bool isItalic,
juce_wchar newDefaultCharacter)
noexcept
171 float newAscent,
juce_wchar newDefaultCharacter)
noexcept
192 if (extraAmount != 0.0f)
195 g->addKerningPair (char2, extraAmount);
207 if (
g->character == character)
225 for (
int i = 0;
i < numCharacters; ++
i)
233 const int glyphIndex = glyphIndexes.
getFirst();
235 if (glyphIndex >= 0 && glyphIndexes.
size() > 0)
237 auto glyphWidth = offsets[1];
240 typefaceToCopy.getOutlineForGlyph (glyphIndex,
p);
244 for (
int j =
glyphs.size() - 1; --
j >= 0;)
246 auto char2 =
glyphs.getUnchecked (
j)->character;
251 if (offsets.
size() > 1)
269 int numKerningPairs = 0;
274 out.writeFloat (
g->width);
275 g->path.writePathToStream (
out);
277 numKerningPairs +=
g->kerningPairs.size();
280 out.writeInt (numKerningPairs);
284 for (
auto&
p :
g->kerningPairs)
288 out.writeFloat (
p.kerningAmount);
304 for (
auto t =
text.getCharPointer(); !
t.isEmpty();)
306 auto c =
t.getAndAdvance();
310 x += glyph->getHorizontalSpacing (*
t);
315 if (fallbackTypeface.get() !=
this)
328 for (
auto t =
text.getCharPointer(); !
t.isEmpty();)
333 auto c =
t.getAndAdvance();
337 width = glyph->getHorizontalSpacing (*
t);
338 glyphChar = (
int) glyph->character;
344 if (fallbackTypeface !=
nullptr && fallbackTypeface.get() !=
this)
350 if (subGlyphs.
size() > 0)
353 width = subOffsets[1];
359 resultGlyphs.
add (glyphChar);
373 if (fallbackTypeface.get() !=
this)
374 return fallbackTypeface->getOutlineForGlyph (glyphNumber, path);
383 if (! glyph->path.isEmpty())
384 return new EdgeTable (glyph->path.getBoundsTransformed (transform)
385 .getSmallestIntegerContainer().expanded (1, 0),
386 glyph->path, transform);
391 if (fallbackTypeface.get() !=
this)
392 return fallbackTypeface->getEdgeTableForGlyph (glyphNumber, transform, fontHeight);
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_Array.h:56
void clearQuick()
Definition juce_Array.h:198
int size() const noexcept
Definition juce_Array.h:215
ElementType getFirst() const noexcept
Definition juce_Array.h:290
void add(const ElementType &newElement)
Definition juce_Array.h:418
Definition juce_CustomTypeface.cpp:30
float width
Definition juce_CustomTypeface.cpp:60
Array< KerningPair > kerningPairs
Definition juce_CustomTypeface.cpp:61
float getHorizontalSpacing(juce_wchar subsequentCharacter) const noexcept
Definition juce_CustomTypeface.cpp:48
const juce_wchar character
Definition juce_CustomTypeface.cpp:58
void addKerningPair(juce_wchar subsequentCharacter, float extraKerningAmount) noexcept
Definition juce_CustomTypeface.cpp:43
GlyphInfo(juce_wchar c, const Path &p, float w) noexcept
Definition juce_CustomTypeface.cpp:32
const Path path
Definition juce_CustomTypeface.cpp:59
GlyphInfo * findGlyph(const juce_wchar character, bool loadIfNeeded) noexcept
Definition juce_CustomTypeface.cpp:201
void clear()
Definition juce_CustomTypeface.cpp:152
float ascent
Definition juce_CustomTypeface.h:143
float getHeightToPointsFactor() const override
Definition juce_CustomTypeface.cpp:298
juce_wchar defaultCharacter
Definition juce_CustomTypeface.h:142
CustomTypeface()
Definition juce_CustomTypeface.cpp:101
float getAscent() const override
Definition juce_CustomTypeface.cpp:296
float getDescent() const override
Definition juce_CustomTypeface.cpp:297
virtual bool loadGlyphIfPossible(juce_wchar characterNeeded)
Definition juce_CustomTypeface.cpp:216
void addKerningPair(juce_wchar char1, juce_wchar char2, float extraAmount) noexcept
Definition juce_CustomTypeface.cpp:190
void addGlyphsFromOtherTypeface(Typeface &typefaceToCopy, juce_wchar characterStartIndex, int numCharacters) noexcept
Definition juce_CustomTypeface.cpp:221
void setCharacteristics(const String &fontFamily, float ascent, bool isBold, bool isItalic, juce_wchar defaultCharacter) noexcept
Definition juce_CustomTypeface.cpp:161
OwnedArray< GlyphInfo > glyphs
Definition juce_CustomTypeface.h:157
void getGlyphPositions(const String &, Array< int > &glyphs, Array< float > &xOffsets) override
Definition juce_CustomTypeface.cpp:323
float getStringWidth(const String &) override
Definition juce_CustomTypeface.cpp:300
~CustomTypeface() override
Definition juce_CustomTypeface.cpp:147
bool getOutlineForGlyph(int glyphNumber, Path &) override
Definition juce_CustomTypeface.cpp:364
short lookupTable[128]
Definition juce_CustomTypeface.h:158
EdgeTable * getEdgeTableForGlyph(int glyphNumber, const AffineTransform &, float fontHeight) override
Definition juce_CustomTypeface.cpp:379
void addGlyph(juce_wchar character, const Path &path, float width) noexcept
Definition juce_CustomTypeface.cpp:179
bool writeToStream(OutputStream &outputStream)
Definition juce_CustomTypeface.cpp:258
Definition juce_EdgeTable.h:38
Definition juce_GZIPCompressorOutputStream.h:39
Definition juce_OutputStream.h:38
Definition juce_Path.h:65
Definition juce_String.h:53
static String charToString(juce_wchar character)
Definition juce_String.cpp:359
static Ptr getFallbackTypeface()
Definition juce_Typeface.cpp:115
String style
Definition juce_Typeface.h:147
Typeface(const String &name, const String &style) noexcept
Definition juce_Typeface.cpp:108
String name
Definition juce_Typeface.h:147
UINT_D64 w
Definition inflate.c:942
struct huft * t
Definition inflate.c:943
register unsigned j
Definition inflate.c:1576
int g
Definition inflate.c:1573
register unsigned i
Definition inflate.c:1575
unsigned x[BMAX+1]
Definition inflate.c:1586
static int width
Definition pugl.h:1593
float in
Definition lilv_test.c:1460
float out
Definition lilv_test.c:1461
Definition juce_CustomTypeface.cpp:69
static juce_wchar readChar(InputStream &in)
Definition juce_CustomTypeface.cpp:70
static void writeChar(OutputStream &out, juce_wchar charToWrite)
Definition juce_CustomTypeface.cpp:85
Definition carla_juce.cpp:31
unsigned short uint16
Definition juce_MathsFunctions.h:41
unsigned int uint32
Definition juce_MathsFunctions.h:45
wchar_t juce_wchar
Definition juce_CharacterFunctions.h:42
bool isPositiveAndBelow(Type1 valueToTest, Type2 upperLimit) noexcept
Definition juce_MathsFunctions.h:279
constexpr int numElementsInArray(Type(&)[N]) noexcept
Definition juce_MathsFunctions.h:344
void zeromem(void *memory, size_t numBytes) noexcept
Definition juce_Memory.h:28
Definition juce_CustomTypeface.cpp:38
juce_wchar character2
Definition juce_CustomTypeface.cpp:39
float kerningAmount
Definition juce_CustomTypeface.cpp:40
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
const char * text
Definition swell-functions.h:167
int n
Definition crypt.c:458
uch * p
Definition crypt.c:594
return c
Definition crypt.c:175
typedef int(UZ_EXP MsgFn)()