Ver código fonte

Make LoadFontFromImage limit its scanning to image dimensions. (#5626)

pull/5629/head
JoeStrout 1 semana atrás
committed by GitHub
pai
commit
c8d1f3e750
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: B5690EEEBB952194
1 arquivos alterados com 4 adições e 2 exclusões
  1. +4
    -2
      src/rtext.c

+ 4
- 2
src/rtext.c Ver arquivo

@ -446,7 +446,8 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
int charHeight = 0;
int j = 0;
while (!COLOR_EQUAL(pixels[(lineSpacing + j)*image.width + charSpacing], key)) j++;
while ((lineSpacing + j) < image.height &&
!COLOR_EQUAL(pixels[(lineSpacing + j)*image.width + charSpacing], key)) j++;
charHeight = j;
@ -469,7 +470,8 @@ Font LoadFontFromImage(Image image, Color key, int firstChar)
int charWidth = 0;
while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
while ((xPosToRead + charWidth) < image.width &&
!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
tempCharRecs[index].width = (float)charWidth;

Carregando…
Cancelar
Salvar