mirror of
https://github.com/nicbarker/clay.git
synced 2025-05-17 07:48:02 +00:00
Compare commits
3 Commits
f8c3121421
...
23871ca3b1
Author | SHA1 | Date | |
---|---|---|---|
|
23871ca3b1 | ||
|
19a27b39f2 | ||
|
d7e072fe25 |
2
clay.h
2
clay.h
@ -1771,7 +1771,7 @@ bool Clay__MemCmp(const char *s1, const char *s2, int32_t length);
|
||||
uint8x16_t v2 = vld1q_u8((const uint8_t *)s2);
|
||||
|
||||
// Compare vectors
|
||||
if (vminvq_u32(vceqq_u8(v1, v2)) != 0xFFFFFFFF) { // If there's a difference
|
||||
if (vminvq_u32(vreinterpretq_u32_u8(vceqq_u8(v1, v2))) != 0xFFFFFFFF) { // If there's a difference
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -99,16 +99,22 @@ static inline Clay_Dimensions Raylib_MeasureText(Clay_StringSlice text, Clay_Tex
|
||||
|
||||
float scaleFactor = config->fontSize/(float)fontToUse.baseSize;
|
||||
|
||||
for (int i = 0; i < text.length; ++i)
|
||||
{
|
||||
if (text.chars[i] == '\n') {
|
||||
int byte_index = 0;
|
||||
while (byte_index < text.length) {
|
||||
if (text.chars[byte_index] == '\n') {
|
||||
maxTextWidth = fmax(maxTextWidth, lineTextWidth);
|
||||
lineTextWidth = 0;
|
||||
byte_index++;
|
||||
continue;
|
||||
}
|
||||
int index = text.chars[i] - 32;
|
||||
if (fontToUse.glyphs[index].advanceX != 0) lineTextWidth += fontToUse.glyphs[index].advanceX;
|
||||
else lineTextWidth += (fontToUse.recs[index].width + fontToUse.glyphs[index].offsetX);
|
||||
|
||||
int codepoint_bytes = 0;
|
||||
int codepoint = GetCodepoint(&text.chars[byte_index], &codepoint_bytes);
|
||||
int glyph_index = GetGlyphIndex(fontToUse, codepoint);
|
||||
byte_index += codepoint_bytes;
|
||||
|
||||
if (fontToUse.glyphs[glyph_index].advanceX != 0) lineTextWidth += fontToUse.glyphs[glyph_index].advanceX;
|
||||
else lineTextWidth += (fontToUse.recs[glyph_index].width + fontToUse.glyphs[glyph_index].offsetX);
|
||||
}
|
||||
|
||||
maxTextWidth = fmax(maxTextWidth, lineTextWidth);
|
||||
|
Loading…
Reference in New Issue
Block a user