| 56 | } |
| 57 | |
| 58 | HFont FontLoadFromMemory(const char* path, void* data, uint32_t data_size, bool allocate) |
| 59 | { |
| 60 | Font* font = 0; |
| 61 | |
| 62 | FontType type = GetFontType(path); |
| 63 | switch(type) |
| 64 | { |
| 65 | case FONT_TYPE_STBTTF: |
| 66 | case FONT_TYPE_STBOTF: font = FontLoadFromMemoryTTF(path, data, data_size, allocate); break; |
| 67 | default: |
| 68 | { |
| 69 | const char* ext = strrchr(path, '.'); |
| 70 | dmLogError("Unsupported file type: '%s'", ext?ext:""); |
| 71 | return 0; |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | if (font) |
| 76 | { |
| 77 | font->m_Type = type; |
| 78 | font->m_Path = strdup(path); |
| 79 | font->m_PathHash= dmHashString32(path); |
| 80 | } |
| 81 | |
| 82 | return font; |
| 83 | } |
| 84 | |
| 85 | HFont FontLoadFromPath(const char* path) |
| 86 | { |
no test coverage detected