AriZuu / ttf2ugui

Simple utility to convert TTF fonts into uGUI bitmap fonts.
111 stars 53 forks source link

question for code #10

Closed joyhope closed 2 years ago

joyhope commented 2 years ago

uint8_t b = bits[(i*bpp_mul+i_idx) * face->glyph->bitmap.pitch + ((j*bpp_mul+j_idx) / 8)]; The logic is hard to understand. i_idx, j_idx is possible in the range [0, 16), the first part i_idx* pitch, the second part j_idx/8 , I feel it is strange.

Is it possible to explain the meaning of the code? I feel it tries to change the pixel pitch from 16bit to 8bit bpp. the i_idx, j_idx is [0, 16) loop, the b value got from the buffer is not understandable.

AriZuu commented 2 years ago

That is not my original code, it comes from pull request #2 so I cannot help much with that.

joyhope commented 2 years ago

ok, i check the #2, it keeps the same. I try to dig for the answer.