Skip to content

Commit

Permalink
fix an edge case where text could be measured incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbarker committed Dec 5, 2024
1 parent efec6ab commit 0ef877e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions clay.h
Original file line number Diff line number Diff line change
Expand Up @@ -1541,8 +1541,23 @@ uint32_t Clay__HashTextWithConfig(Clay_String *text, Clay_TextElementConfig *con
hash += (hash << 10);
hash ^= (hash >> 6);

uint64_t configPointerAsNumber = (uint64_t)config;
hash += configPointerAsNumber;
hash += config->fontId;
hash += (hash << 10);
hash ^= (hash >> 6);

hash += config->fontSize;
hash += (hash << 10);
hash ^= (hash >> 6);

hash += config->lineHeight;
hash += (hash << 10);
hash ^= (hash >> 6);

hash += config->letterSpacing;
hash += (hash << 10);
hash ^= (hash >> 6);

hash += config->wrapMode;
hash += (hash << 10);
hash ^= (hash >> 6);

Expand Down

0 comments on commit 0ef877e

Please sign in to comment.