Closed Romonaga closed 1 year ago
@Romonaga , thanks for using the library.
X,Y described here
The library expects you to know the font size you want. if you are using Microsoft Word and set the Font size to 1000 and cannot see anything, that is user error, not a Microsoft Word flaw. That's why there are examples to show how to decide what font you want. That's why I have functions to dump the framebuffer to your terminal screen, without even having an OLED screen connected, so you can see how your framebuffer will render on the OLED screen. This is the way to test whether you want Font size 4 or 6 or 8. Auto-detecting the appropriate font size is not useful for a library that aims to be generic.
Font object is only created to render a string, if the font face is not already present in the default fonts, and then freed up after rendering. there is no real speed penalty here. If you are using fonts marked as SSD1306_FONT_CUSTOM
then you are going to be loading a custom font on the fly. That's the expected design. If you are using a pre-defined font that comes default with Linux, you will not incur this at all, since all supported Linux fonts are pre-loaded when the library starts up. It's only when you want to use Microsoft fonts or some Apple font or something, that you will need to load it from a file. It is for that scenario. There is no advantage to keep the font file loaded perpetually, since this library is designed for low memory devices. The I2C OLED screen is much much slower to render the string, than the font library itself which is incredibly fast to load the font files.
Moreover, the font size effectively is meaningless without testing. The font library only gives me a glyph size, so say the size of A
or the size of a
but they are not going to be the same, even if the font size is the same for both.
Thank you very much for your comments and explanations. I understand way more than I intended, and I now understand exactly what you are saying. I also had to overcome "font" issues with my rpiLightSystem project, and at the end just allowed a fixed size font, much like segmented displays are. I had a lofty ambition to wrap your lib and mange framebuffers. However to do this I had to have a good understanding of where things were and size to be expected. I was able to get to about 90% of what I had wanted, and had to punt on allowing font size. I do thank you for your hard effort and your patience with me, I learned a ton from your code, and am now using your lib in my projects.
If you ever need help with ws28XX led's or matrix panels please feel free to reach out.
Thanks @Romonaga . I am closing this issue since you have no further questions.
Sorry, not sure how to send a message without opening a ticket forgive me. I am very pleased with this lib and how fast it is. The work done here is well simply fantastic.
Most of my code is in c++ and as such I take c libs I use and wrap them for my use.
There are a few things I wanted to ask about....
Part of the problem is when using fonts, we do not know what the "true" font size is. This is because the first time we get this info is when we make the call to ssd1306_font_render_string.
This line of code, if I pass in a value less than what the fount size is, I end up with a negative number. FT_Int y_bmap = y - slot->bitmap_top;
As apposed to treating Y as an absolute, is it possible to treat it as a line number for text? This is a bit easier IMHO in being able to use and not have to guess where to write the text. I suspect the the details are somehow in the box information that is returned from creating a frame, to be honest, as of yet have figured out what you are trying to tell is with that data. ** Ok I think I understand the box data now, had to write it out on paper. However, that is very useful and solves an issue.
Well, I am done rambling, thanks for the fantastic code, I have been moving from my code to using your lib. It is very fast!