浏览代码

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

pull/5629/head
JoeStrout 1周前
committed by GitHub
父节点
当前提交
c8d1f3e750
找不到此签名对应的密钥 GPG 密钥 ID: B5690EEEBB952194
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. +4
    -2
      src/rtext.c

+ 4
- 2
src/rtext.c 查看文件

@ -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;

正在加载...
取消
保存