Wilhelm Brasch
Wilhelm Brasch
So I had a look around on the internet and found different ways to do that: @staticmethod def get_np_array0(bitmap, num_bytes): # 34.625 / 36.874 return np.fromiter(bitmap.buffer, dtype=np.uint8) @staticmethod def get_np_array1(bitmap,...
Here's another explanation of the pitch: https://www.freetype.org/freetype2/docs/glyphs/glyphs-7.html The way I understand it is that for just reading the buffer into a numpy array, num_bytes = rows * abs(pitch) should work...
> Sigh. You guys don't understand what 'pitch' is. ? As I wrote above, the pitch is the number of bytes per row. According to the documentation, "FreeType functions normally...
It says so in the documentation: >The pitch's absolute value is the number of bytes taken by one bitmap row [...] I never suggested not to test for pitch !=...
In general, how should the buffer be handed to the user? As a raw buffer, numpy (dependency) or python array, with or without padding, bits unpacked to bytes?
That doesn't seem to work, glyph is freed properly anyway (at least with `destroy=True`) but maybe blyph is not, since the `__del__` is commented out? If I uncomment it it...
No need to "Sigh". Feel free to modify my code sample according to what you think should work.
I found another [python wrapper](https://github.com/ldo/python_freetype) for freetype which seems to have better memory management. It releases the bitmaps with FT_Bitmap_Done and only casts the Glyph to BitmapGlyph when needed, which...
Hidden prompts in the code are surprising, given the philosophy in the documentation: > What we intentionally DON'T do[¶](https://python.useinstructor.com/concepts/philosophy/#what-we-intentionally-dont-do) > No prompt engineering[¶](https://python.useinstructor.com/concepts/philosophy/#no-prompt-engineering) > We don't write prompts for you....
@rougier No, but if anyone wants to make a PR I would suggest option 4 or 5, or maybe something using a python array (which I haven't tested so far).