| 1541 | } |
| 1542 | |
| 1543 | void ScriptingApi::Engine::loadFontAs(String fileName, String fontId) |
| 1544 | { |
| 1545 | |
| 1546 | #if USE_BACKEND |
| 1547 | |
| 1548 | if (FullInstrumentExpansion::isEnabled(getProcessor()->getMainController())) |
| 1549 | { |
| 1550 | // Already loaded??? |
| 1551 | if (auto e = FullInstrumentExpansion::getCurrentFullExpansion(getProcessor()->getMainController())) |
| 1552 | return; |
| 1553 | } |
| 1554 | |
| 1555 | const String absolutePath = GET_PROJECT_HANDLER(getProcessor()).getFilePath(fileName, ProjectHandler::SubDirectories::Images); |
| 1556 | File f(absolutePath); |
| 1557 | auto fis = f.createInputStream(); |
| 1558 | |
| 1559 | if (fis == nullptr) |
| 1560 | { |
| 1561 | reportScriptError("File not found"); |
| 1562 | return; |
| 1563 | } |
| 1564 | else |
| 1565 | { |
| 1566 | MemoryBlock mb; |
| 1567 | |
| 1568 | fis->readIntoMemoryBlock(mb); |
| 1569 | getProcessor()->getMainController()->loadTypeFace(fileName, mb.getData(), mb.getSize(), fontId); |
| 1570 | } |
| 1571 | |
| 1572 | #else |
| 1573 | |
| 1574 | // Nothing to do here, it will be loaded on startup... |
| 1575 | |
| 1576 | ignoreUnused(fileName); |
| 1577 | |
| 1578 | #endif |
| 1579 | } |
| 1580 | |
| 1581 | void ScriptingApi::Engine::setGlobalFont(String fontName) |
| 1582 | { |
no test coverage detected