| 12 | namespace snap::drawing { |
| 13 | |
| 14 | static size_t computeHash(FontId fontId, |
| 15 | Scalar letterSpacing, |
| 16 | TextScript script, |
| 17 | bool isRightToLeft, |
| 18 | const Character* characters, |
| 19 | size_t length) { |
| 20 | auto stringView = std::u32string_view(reinterpret_cast<const char32_t*>(characters), length); |
| 21 | |
| 22 | auto hash = static_cast<size_t>(fontId); |
| 23 | boost::hash_combine(hash, std::hash<float>()(letterSpacing)); |
| 24 | boost::hash_combine(hash, std::hash<uint32_t>()(script.code)); |
| 25 | boost::hash_combine(hash, std::hash<bool>()(isRightToLeft)); |
| 26 | boost::hash_combine(hash, std::hash<std::u32string_view>()(stringView)); |
| 27 | |
| 28 | return hash; |
| 29 | } |
| 30 | |
| 31 | TextShaperCacheKey::TextShaperCacheKey(FontId fontId, |
| 32 | Scalar letterSpacing, |
no test coverage detected