--------------------------------------------------------------------
| 147 | |
| 148 | //-------------------------------------------------------------------- |
| 149 | void font(const char* font_signature, bool reset_cache = false) |
| 150 | { |
| 151 | int idx = find_font(font_signature); |
| 152 | if (idx >= 0) |
| 153 | { |
| 154 | if (reset_cache) |
| 155 | { |
| 156 | obj_allocator<font_cache>::deallocate(m_fonts[idx]); |
| 157 | m_fonts[idx] = obj_allocator<font_cache>::allocate(); |
| 158 | m_fonts[idx]->signature(font_signature); |
| 159 | } |
| 160 | m_cur_font = m_fonts[idx]; |
| 161 | } |
| 162 | else |
| 163 | { |
| 164 | if (m_num_fonts >= m_max_fonts) |
| 165 | { |
| 166 | obj_allocator<font_cache>::deallocate(m_fonts[0]); |
| 167 | std::memcpy(m_fonts, |
| 168 | m_fonts + 1, |
| 169 | (m_max_fonts - 1) * sizeof(font_cache*)); |
| 170 | m_num_fonts = m_max_fonts - 1; |
| 171 | } |
| 172 | m_fonts[m_num_fonts] = obj_allocator<font_cache>::allocate(); |
| 173 | m_fonts[m_num_fonts]->signature(font_signature); |
| 174 | m_cur_font = m_fonts[m_num_fonts]; |
| 175 | ++m_num_fonts; |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | //-------------------------------------------------------------------- |
| 180 | const font_cache* font() const |
no test coverage detected