MCPcopy Create free account
hub / github.com/christophhart/HISE / loadFontAs

Method loadFontAs

hi_scripting/scripting/api/ScriptingApi.cpp:1543–1579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1541}
1542
1543void 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
1581void ScriptingApi::Engine::setGlobalFont(String fontName)
1582{

Callers 1

LabelCode.jsFile · 0.80

Calls 9

getProcessorFunction · 0.85
ignoreUnusedFunction · 0.85
readIntoMemoryBlockMethod · 0.80
loadTypeFaceMethod · 0.80
getMainControllerMethod · 0.45
getFilePathMethod · 0.45
createInputStreamMethod · 0.45
getDataMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected