mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[kandinsky] Fix Font::signedCharAsIndex
This commit is contained in:
@@ -40,7 +40,13 @@ private:
|
||||
return static_cast<uint8_t>(c) - k_magicCharOffsetValue;
|
||||
}
|
||||
int signedCharAsIndex(char c) const {
|
||||
return static_cast<int>(c) - k_magicCharOffsetValue;
|
||||
int cInt = c;
|
||||
if (cInt < 0) {
|
||||
/* A char casted as int takes its value between -127 and +128, but we want
|
||||
* a positive value. -127 is thus 129, -126 is 130, etc. */
|
||||
cInt+=128+(cInt-(-127)+1);
|
||||
}
|
||||
return cInt - k_magicCharOffsetValue;
|
||||
}
|
||||
|
||||
KDSize m_glyphSize;
|
||||
|
||||
Reference in New Issue
Block a user