HarfBuzz font objects are linked to a specific FreeType face and a specific character size If we need to shape text using another font or another character size we will have to create a new shaper
| 197 | // If we need to shape text using another font or another |
| 198 | // character size we will have to create a new shaper |
| 199 | ShaperImpl(void* fontHandle, std::uint64_t theFontId, unsigned int theCharacterSize) : |
| 200 | fontId(theFontId), |
| 201 | characterSize(theCharacterSize), |
| 202 | shaper(hb_ft_font_create(static_cast<FT_Face>(fontHandle), nullptr)), |
| 203 | shapingBuffer(hb_buffer_create()) |
| 204 | { |
| 205 | // Make HarfBuzz use FreeType font functions |
| 206 | hb_ft_font_set_funcs(shaper.get()); |
| 207 | } |
| 208 | |
| 209 | // To save on memory, instead of every sf::Text object having |
| 210 | // its own shaper, we try to share shapers among multiple |