* Returns the dimensions of a particular character in the font. * @param c Font character. * @return Width and Height dimensions (X and Y are ignored). */
| 224 | * @return Width and Height dimensions (X and Y are ignored). |
| 225 | */ |
| 226 | SDL_Rect Font::getCharSize(wchar_t c) |
| 227 | { |
| 228 | SDL_Rect size = { 0, 0, 0, 0 }; |
| 229 | if (c != 1 && !isLinebreak(c) && !isSpace(c)) |
| 230 | { |
| 231 | size.w = _chars[c].w + _spacing; |
| 232 | size.h = _chars[c].h + _spacing; |
| 233 | } |
| 234 | else |
| 235 | { |
| 236 | if (_monospace) |
| 237 | size.w = _width + _spacing; |
| 238 | else if (isNonBreakableSpace(c)) |
| 239 | size.w = _width / 4; |
| 240 | else |
| 241 | size.w = _width / 2; |
| 242 | size.h = _height + _spacing; |
| 243 | } |
| 244 | // In case anyone mixes them up |
| 245 | size.x = size.w; |
| 246 | size.y = size.h; |
| 247 | return size; |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * Returns the surface stored within the font. Used for loading the |
no outgoing calls
no test coverage detected