Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

634 lines
22KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. /* This is some quick-and-dirty code to extract the typeface name from a lump of TTF file data.
  21. It's needed because although win32 will happily load a TTF file from in-memory data, it won't
  22. tell you the name of the damned font that it just loaded.. and in order to actually use the font,
  23. you need to know its name!! Anyway, this awful hack seems to work for most fonts.
  24. */
  25. namespace TTFNameExtractor
  26. {
  27. struct OffsetTable
  28. {
  29. uint32 version;
  30. uint16 numTables, searchRange, entrySelector, rangeShift;
  31. };
  32. struct TableDirectory
  33. {
  34. char tag[4];
  35. uint32 checkSum, offset, length;
  36. };
  37. struct NamingTable
  38. {
  39. uint16 formatSelector;
  40. uint16 numberOfNameRecords;
  41. uint16 offsetStartOfStringStorage;
  42. };
  43. struct NameRecord
  44. {
  45. uint16 platformID, encodingID, languageID;
  46. uint16 nameID, stringLength, offsetFromStorageArea;
  47. };
  48. static String parseNameRecord (MemoryInputStream& input, const NameRecord& nameRecord,
  49. const int64 directoryOffset, const int64 offsetOfStringStorage)
  50. {
  51. String result;
  52. auto oldPos = input.getPosition();
  53. input.setPosition (directoryOffset + offsetOfStringStorage + ByteOrder::swapIfLittleEndian (nameRecord.offsetFromStorageArea));
  54. auto stringLength = (int) ByteOrder::swapIfLittleEndian (nameRecord.stringLength);
  55. auto platformID = ByteOrder::swapIfLittleEndian (nameRecord.platformID);
  56. if (platformID == 0 || platformID == 3)
  57. {
  58. auto numChars = stringLength / 2 + 1;
  59. HeapBlock<uint16> buffer;
  60. buffer.calloc (numChars + 1);
  61. input.read (buffer, stringLength);
  62. for (int i = 0; i < numChars; ++i)
  63. buffer[i] = ByteOrder::swapIfLittleEndian (buffer[i]);
  64. static_assert (sizeof (CharPointer_UTF16::CharType) == sizeof (uint16), "Sanity check UTF-16 type");
  65. result = CharPointer_UTF16 ((CharPointer_UTF16::CharType*) buffer.getData());
  66. }
  67. else
  68. {
  69. HeapBlock<char> buffer;
  70. buffer.calloc (stringLength + 1);
  71. input.read (buffer, stringLength);
  72. result = CharPointer_UTF8 (buffer.getData());
  73. }
  74. input.setPosition (oldPos);
  75. return result;
  76. }
  77. static String parseNameTable (MemoryInputStream& input, int64 directoryOffset)
  78. {
  79. input.setPosition (directoryOffset);
  80. NamingTable namingTable = {};
  81. input.read (&namingTable, sizeof (namingTable));
  82. for (int i = 0; i < (int) ByteOrder::swapIfLittleEndian (namingTable.numberOfNameRecords); ++i)
  83. {
  84. NameRecord nameRecord = {};
  85. input.read (&nameRecord, sizeof (nameRecord));
  86. if (ByteOrder::swapIfLittleEndian (nameRecord.nameID) == 4)
  87. {
  88. const String result (parseNameRecord (input, nameRecord, directoryOffset,
  89. ByteOrder::swapIfLittleEndian (namingTable.offsetStartOfStringStorage)));
  90. if (result.isNotEmpty())
  91. return result;
  92. }
  93. }
  94. return {};
  95. }
  96. static String getTypefaceNameFromFile (MemoryInputStream& input)
  97. {
  98. OffsetTable offsetTable = {};
  99. input.read (&offsetTable, sizeof (offsetTable));
  100. for (int i = 0; i < (int) ByteOrder::swapIfLittleEndian (offsetTable.numTables); ++i)
  101. {
  102. TableDirectory tableDirectory;
  103. zerostruct (tableDirectory);
  104. input.read (&tableDirectory, sizeof (tableDirectory));
  105. if (String (tableDirectory.tag, sizeof (tableDirectory.tag)).equalsIgnoreCase ("name"))
  106. return parseNameTable (input, ByteOrder::swapIfLittleEndian (tableDirectory.offset));
  107. }
  108. return {};
  109. }
  110. }
  111. namespace FontEnumerators
  112. {
  113. static int CALLBACK fontEnum2 (ENUMLOGFONTEXW* lpelfe, NEWTEXTMETRICEXW*, int type, LPARAM lParam)
  114. {
  115. if (lpelfe != nullptr && (type & RASTER_FONTTYPE) == 0)
  116. {
  117. const String fontName (lpelfe->elfLogFont.lfFaceName);
  118. ((StringArray*) lParam)->addIfNotAlreadyThere (fontName.removeCharacters ("@"));
  119. }
  120. return 1;
  121. }
  122. static int CALLBACK fontEnum1 (ENUMLOGFONTEXW* lpelfe, NEWTEXTMETRICEXW*, int type, LPARAM lParam)
  123. {
  124. if (lpelfe != nullptr && (type & RASTER_FONTTYPE) == 0)
  125. {
  126. LOGFONTW lf = {};
  127. lf.lfWeight = FW_DONTCARE;
  128. lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
  129. lf.lfQuality = DEFAULT_QUALITY;
  130. lf.lfCharSet = DEFAULT_CHARSET;
  131. lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
  132. lf.lfPitchAndFamily = FF_DONTCARE;
  133. const String fontName (lpelfe->elfLogFont.lfFaceName);
  134. fontName.copyToUTF16 (lf.lfFaceName, sizeof (lf.lfFaceName));
  135. auto dc = CreateCompatibleDC (nullptr);
  136. EnumFontFamiliesEx (dc, &lf, (FONTENUMPROCW) &fontEnum2, lParam, 0);
  137. DeleteDC (dc);
  138. }
  139. return 1;
  140. }
  141. }
  142. StringArray Font::findAllTypefaceNames()
  143. {
  144. StringArray results;
  145. #if JUCE_USE_DIRECTWRITE
  146. SharedResourcePointer<Direct2DFactories> factories;
  147. if (factories->systemFonts != nullptr)
  148. {
  149. ComSmartPtr<IDWriteFontFamily> fontFamily;
  150. uint32 fontFamilyCount = 0;
  151. fontFamilyCount = factories->systemFonts->GetFontFamilyCount();
  152. for (uint32 i = 0; i < fontFamilyCount; ++i)
  153. {
  154. auto hr = factories->systemFonts->GetFontFamily (i, fontFamily.resetAndGetPointerAddress());
  155. if (SUCCEEDED (hr))
  156. results.addIfNotAlreadyThere (getFontFamilyName (fontFamily));
  157. }
  158. }
  159. else
  160. #endif
  161. {
  162. auto dc = CreateCompatibleDC (nullptr);
  163. {
  164. LOGFONTW lf = {};
  165. lf.lfWeight = FW_DONTCARE;
  166. lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
  167. lf.lfQuality = DEFAULT_QUALITY;
  168. lf.lfCharSet = DEFAULT_CHARSET;
  169. lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
  170. lf.lfPitchAndFamily = FF_DONTCARE;
  171. EnumFontFamiliesEx (dc, &lf,
  172. (FONTENUMPROCW) &FontEnumerators::fontEnum1,
  173. (LPARAM) &results, 0);
  174. }
  175. DeleteDC (dc);
  176. }
  177. results.sort (true);
  178. return results;
  179. }
  180. StringArray Font::findAllTypefaceStyles (const String& family)
  181. {
  182. if (FontStyleHelpers::isPlaceholderFamilyName (family))
  183. return findAllTypefaceStyles (FontStyleHelpers::getConcreteFamilyNameFromPlaceholder (family));
  184. StringArray results;
  185. #if JUCE_USE_DIRECTWRITE
  186. SharedResourcePointer<Direct2DFactories> factories;
  187. if (factories->systemFonts != nullptr)
  188. {
  189. BOOL fontFound = false;
  190. uint32 fontIndex = 0;
  191. auto hr = factories->systemFonts->FindFamilyName (family.toWideCharPointer(), &fontIndex, &fontFound);
  192. if (! fontFound)
  193. fontIndex = 0;
  194. // Get the font family using the search results
  195. // Fonts like: Times New Roman, Times New Roman Bold, Times New Roman Italic are all in the same font family
  196. ComSmartPtr<IDWriteFontFamily> fontFamily;
  197. hr = factories->systemFonts->GetFontFamily (fontIndex, fontFamily.resetAndGetPointerAddress());
  198. // Get the font faces
  199. ComSmartPtr<IDWriteFont> dwFont;
  200. uint32 fontFacesCount = 0;
  201. fontFacesCount = fontFamily->GetFontCount();
  202. for (uint32 i = 0; i < fontFacesCount; ++i)
  203. {
  204. hr = fontFamily->GetFont (i, dwFont.resetAndGetPointerAddress());
  205. // Ignore any algorithmically generated bold and oblique styles..
  206. if (dwFont->GetSimulations() == DWRITE_FONT_SIMULATIONS_NONE)
  207. results.addIfNotAlreadyThere (getFontFaceName (dwFont));
  208. }
  209. }
  210. else
  211. #endif
  212. {
  213. results.add ("Regular");
  214. results.add ("Italic");
  215. results.add ("Bold");
  216. results.add ("Bold Italic");
  217. }
  218. return results;
  219. }
  220. extern bool juce_isRunningInWine();
  221. struct DefaultFontNames
  222. {
  223. DefaultFontNames()
  224. {
  225. if (juce_isRunningInWine())
  226. {
  227. // If we're running in Wine, then use fonts that might be available on Linux..
  228. defaultSans = "Bitstream Vera Sans";
  229. defaultSerif = "Bitstream Vera Serif";
  230. defaultFixed = "Bitstream Vera Sans Mono";
  231. }
  232. else
  233. {
  234. defaultSans = "Verdana";
  235. defaultSerif = "Times New Roman";
  236. defaultFixed = "Lucida Console";
  237. defaultFallback = "Tahoma"; // (contains plenty of unicode characters)
  238. }
  239. }
  240. String defaultSans, defaultSerif, defaultFixed, defaultFallback;
  241. };
  242. Typeface::Ptr Font::getDefaultTypefaceForFont (const Font& font)
  243. {
  244. static DefaultFontNames defaultNames;
  245. Font newFont (font);
  246. auto& faceName = font.getTypefaceName();
  247. if (faceName == getDefaultSansSerifFontName()) newFont.setTypefaceName (defaultNames.defaultSans);
  248. else if (faceName == getDefaultSerifFontName()) newFont.setTypefaceName (defaultNames.defaultSerif);
  249. else if (faceName == getDefaultMonospacedFontName()) newFont.setTypefaceName (defaultNames.defaultFixed);
  250. if (font.getTypefaceStyle() == getDefaultStyle())
  251. newFont.setTypefaceStyle ("Regular");
  252. return Typeface::createSystemTypefaceFor (newFont);
  253. }
  254. //==============================================================================
  255. class WindowsTypeface : public Typeface
  256. {
  257. public:
  258. WindowsTypeface (const Font& font) : Typeface (font.getTypefaceName(),
  259. font.getTypefaceStyle())
  260. {
  261. loadFont();
  262. }
  263. WindowsTypeface (const void* data, size_t dataSize)
  264. : Typeface (String(), String())
  265. {
  266. DWORD numInstalled = 0;
  267. memoryFont = AddFontMemResourceEx (const_cast<void*> (data), (DWORD) dataSize,
  268. nullptr, &numInstalled);
  269. MemoryInputStream m (data, dataSize, false);
  270. name = TTFNameExtractor::getTypefaceNameFromFile (m);
  271. loadFont();
  272. }
  273. ~WindowsTypeface()
  274. {
  275. SelectObject (dc, previousFontH); // Replacing the previous font before deleting the DC avoids a warning in BoundsChecker
  276. DeleteDC (dc);
  277. if (fontH != nullptr)
  278. DeleteObject (fontH);
  279. if (memoryFont != nullptr)
  280. RemoveFontMemResourceEx (memoryFont);
  281. }
  282. float getAscent() const { return ascent; }
  283. float getDescent() const { return 1.0f - ascent; }
  284. float getHeightToPointsFactor() const { return heightToPointsFactor; }
  285. float getStringWidth (const String& text)
  286. {
  287. auto utf16 = text.toUTF16();
  288. auto numChars = utf16.length();
  289. HeapBlock<uint16> results (numChars);
  290. float x = 0;
  291. if (GetGlyphIndices (dc, utf16, (int) numChars, reinterpret_cast<WORD*> (results.getData()),
  292. GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
  293. {
  294. for (size_t i = 0; i < numChars; ++i)
  295. x += getKerning (dc, results[i], (i + 1) < numChars ? results[i + 1] : -1);
  296. }
  297. return x;
  298. }
  299. void getGlyphPositions (const String& text, Array<int>& resultGlyphs, Array<float>& xOffsets)
  300. {
  301. auto utf16 = text.toUTF16();
  302. auto numChars = utf16.length();
  303. HeapBlock<uint16> results (numChars);
  304. float x = 0;
  305. if (GetGlyphIndices (dc, utf16, (int) numChars, reinterpret_cast<WORD*> (results.getData()),
  306. GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR)
  307. {
  308. resultGlyphs.ensureStorageAllocated ((int) numChars);
  309. xOffsets.ensureStorageAllocated ((int) numChars + 1);
  310. for (size_t i = 0; i < numChars; ++i)
  311. {
  312. resultGlyphs.add (results[i]);
  313. xOffsets.add (x);
  314. x += getKerning (dc, results[i], (i + 1) < numChars ? results[i + 1] : -1);
  315. }
  316. }
  317. xOffsets.add (x);
  318. }
  319. bool getOutlineForGlyph (int glyphNumber, Path& glyphPath)
  320. {
  321. if (glyphNumber < 0)
  322. glyphNumber = defaultGlyph;
  323. GLYPHMETRICS gm;
  324. // (although GetGlyphOutline returns a DWORD, it may be -1 on failure, so treat it as signed int..)
  325. auto bufSize = (int) GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX,
  326. &gm, 0, nullptr, &identityMatrix);
  327. if (bufSize > 0)
  328. {
  329. HeapBlock<char> data (bufSize);
  330. GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, &gm,
  331. (DWORD) bufSize, data, &identityMatrix);
  332. auto pheader = reinterpret_cast<const TTPOLYGONHEADER*> (data.getData());
  333. auto scaleX = 1.0f / tm.tmHeight;
  334. auto scaleY = -scaleX;
  335. while ((char*) pheader < data + bufSize)
  336. {
  337. glyphPath.startNewSubPath (scaleX * pheader->pfxStart.x.value,
  338. scaleY * pheader->pfxStart.y.value);
  339. auto curve = (const TTPOLYCURVE*) ((const char*) pheader + sizeof (TTPOLYGONHEADER));
  340. auto curveEnd = ((const char*) pheader) + pheader->cb;
  341. while ((const char*) curve < curveEnd)
  342. {
  343. if (curve->wType == TT_PRIM_LINE)
  344. {
  345. for (int i = 0; i < curve->cpfx; ++i)
  346. glyphPath.lineTo (scaleX * curve->apfx[i].x.value,
  347. scaleY * curve->apfx[i].y.value);
  348. }
  349. else if (curve->wType == TT_PRIM_QSPLINE)
  350. {
  351. for (int i = 0; i < curve->cpfx - 1; ++i)
  352. {
  353. auto x2 = scaleX * curve->apfx[i].x.value;
  354. auto y2 = scaleY * curve->apfx[i].y.value;
  355. auto x3 = scaleX * curve->apfx[i + 1].x.value;
  356. auto y3 = scaleY * curve->apfx[i + 1].y.value;
  357. if (i < curve->cpfx - 2)
  358. {
  359. x3 = 0.5f * (x2 + x3);
  360. y3 = 0.5f * (y2 + y3);
  361. }
  362. glyphPath.quadraticTo (x2, y2, x3, y3);
  363. }
  364. }
  365. curve = (const TTPOLYCURVE*) &(curve->apfx [curve->cpfx]);
  366. }
  367. pheader = (const TTPOLYGONHEADER*) curve;
  368. glyphPath.closeSubPath();
  369. }
  370. }
  371. return true;
  372. }
  373. private:
  374. static const MAT2 identityMatrix;
  375. HFONT fontH = {};
  376. HGDIOBJ previousFontH = {};
  377. HDC dc { CreateCompatibleDC (nullptr) };
  378. TEXTMETRIC tm;
  379. HANDLE memoryFont = {};
  380. float ascent = 1.0f, heightToPointsFactor = 1.0f;
  381. int defaultGlyph = -1, heightInPoints = 0;
  382. std::unordered_map<uint64, float> kerningPairs;
  383. static uint64 kerningPairIndex (int glyph1, int glyph2)
  384. {
  385. return (((uint64) (uint32) glyph1) << 32) | (uint64) (uint32) glyph2;
  386. }
  387. void loadFont()
  388. {
  389. SetMapperFlags (dc, 0);
  390. SetMapMode (dc, MM_TEXT);
  391. LOGFONTW lf = {};
  392. lf.lfCharSet = DEFAULT_CHARSET;
  393. lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
  394. lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
  395. lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
  396. lf.lfQuality = PROOF_QUALITY;
  397. lf.lfItalic = (BYTE) (style.contains ("Italic") ? TRUE : FALSE);
  398. lf.lfWeight = style.contains ("Bold") ? FW_BOLD : FW_NORMAL;
  399. lf.lfHeight = -256;
  400. name.copyToUTF16 (lf.lfFaceName, sizeof (lf.lfFaceName));
  401. auto standardSizedFont = CreateFontIndirect (&lf);
  402. if (standardSizedFont != nullptr)
  403. {
  404. if ((previousFontH = SelectObject (dc, standardSizedFont)) != nullptr)
  405. {
  406. fontH = standardSizedFont;
  407. OUTLINETEXTMETRIC otm;
  408. if (GetOutlineTextMetrics (dc, sizeof (otm), &otm) != 0)
  409. {
  410. heightInPoints = (int) otm.otmEMSquare;
  411. lf.lfHeight = -heightInPoints;
  412. fontH = CreateFontIndirect (&lf);
  413. SelectObject (dc, fontH);
  414. DeleteObject (standardSizedFont);
  415. }
  416. }
  417. }
  418. if (GetTextMetrics (dc, &tm))
  419. {
  420. auto dpi = (GetDeviceCaps (dc, LOGPIXELSX) + GetDeviceCaps (dc, LOGPIXELSY)) / 2.0f;
  421. heightToPointsFactor = (dpi / GetDeviceCaps (dc, LOGPIXELSY)) * heightInPoints / (float) tm.tmHeight;
  422. ascent = tm.tmAscent / (float) tm.tmHeight;
  423. std::unordered_map<int, int> glyphsForChars;
  424. defaultGlyph = getGlyphForChar (dc, glyphsForChars, tm.tmDefaultChar);
  425. createKerningPairs (dc, glyphsForChars, (float) tm.tmHeight);
  426. }
  427. }
  428. void createKerningPairs (HDC hdc, std::unordered_map<int, int>& glyphsForChars, float height)
  429. {
  430. HeapBlock<KERNINGPAIR> rawKerning;
  431. auto numKPs = GetKerningPairs (hdc, 0, nullptr);
  432. rawKerning.calloc (numKPs);
  433. GetKerningPairs (hdc, numKPs, rawKerning);
  434. std::unordered_map<int, int> widthsForGlyphs;
  435. for (DWORD i = 0; i < numKPs; ++i)
  436. {
  437. auto glyph1 = getGlyphForChar (hdc, glyphsForChars, rawKerning[i].wFirst);
  438. auto glyph2 = getGlyphForChar (hdc, glyphsForChars, rawKerning[i].wSecond);
  439. auto standardWidth = getGlyphWidth (hdc, widthsForGlyphs, glyph1);
  440. kerningPairs[kerningPairIndex (glyph1, glyph2)] = (standardWidth + rawKerning[i].iKernAmount) / height;
  441. kerningPairs[kerningPairIndex (glyph1, -1)] = standardWidth / height;
  442. }
  443. }
  444. static int getGlyphForChar (HDC dc, std::unordered_map<int, int>& cache, juce_wchar character)
  445. {
  446. auto existing = cache.find ((int) character);
  447. if (existing != cache.end())
  448. return existing->second;
  449. const WCHAR charToTest[] = { (WCHAR) character, 0 };
  450. WORD index = 0;
  451. if (GetGlyphIndices (dc, charToTest, 1, &index, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR
  452. || index == 0xffff)
  453. return -1;
  454. cache[(int) character] = index;
  455. return index;
  456. }
  457. static int getGlyphWidth (HDC dc, std::unordered_map<int, int>& cache, int glyphNumber)
  458. {
  459. auto existing = cache.find (glyphNumber);
  460. if (existing != cache.end())
  461. return existing->second;
  462. auto width = getGlyphWidth (dc, glyphNumber);
  463. cache[glyphNumber] = width;
  464. return width;
  465. }
  466. static int getGlyphWidth (HDC dc, int glyphNumber)
  467. {
  468. GLYPHMETRICS gm;
  469. gm.gmCellIncX = 0;
  470. GetGlyphOutline (dc, (UINT) glyphNumber, GGO_NATIVE | GGO_GLYPH_INDEX, &gm, 0, nullptr, &identityMatrix);
  471. return gm.gmCellIncX;
  472. }
  473. float getKerning (HDC hdc, int glyph1, int glyph2)
  474. {
  475. auto pair = kerningPairs.find (kerningPairIndex (glyph1, glyph2));
  476. if (pair != kerningPairs.end())
  477. return pair->second;
  478. auto single = kerningPairs.find (kerningPairIndex (glyph1, -1));
  479. if (single != kerningPairs.end())
  480. return single->second;
  481. auto width = getGlyphWidth (hdc, glyph1) / (float) tm.tmHeight;
  482. kerningPairs[kerningPairIndex (glyph1, -1)] = width;
  483. return width;
  484. }
  485. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WindowsTypeface)
  486. };
  487. const MAT2 WindowsTypeface::identityMatrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
  488. Typeface::Ptr Typeface::createSystemTypefaceFor (const Font& font)
  489. {
  490. #if JUCE_USE_DIRECTWRITE
  491. SharedResourcePointer<Direct2DFactories> factories;
  492. if (factories->systemFonts != nullptr)
  493. {
  494. std::unique_ptr<WindowsDirectWriteTypeface> wtf (new WindowsDirectWriteTypeface (font, factories->systemFonts));
  495. if (wtf->loadedOk())
  496. return wtf.release();
  497. }
  498. #endif
  499. return new WindowsTypeface (font);
  500. }
  501. Typeface::Ptr Typeface::createSystemTypefaceFor (const void* data, size_t dataSize)
  502. {
  503. return new WindowsTypeface (data, dataSize);
  504. }
  505. void Typeface::scanFolderForFonts (const File&)
  506. {
  507. jassertfalse; // not implemented on this platform
  508. }
  509. } // namespace juce