Coder Social home page Coder Social logo

Comments (8)

takkaO avatar takkaO commented on June 1, 2024 1

I'm glad it worked out. 🎉

OpenFontRender is currently undergoing an update process in the develop branch to make it more functional and less Arduino-dependent. (The reduction of Arduino dependencies includes moving away from Serial.)

The main code update has already been completed, and I am adding sample code and fixing documentation.
New OpenFontRender will be released soon.
If you can, please try the develop branch at ESP-IDF and give us your feedback, it would be greatly appreciated.

Finally, in your question Is not possible to make it smaller reducing the size of the Glyph? do you mean the drawing font size?
If so, you can change the font size with setFontSize method.

Thank you.

from openfontrender.

takkaO avatar takkaO commented on June 1, 2024

Hi @martinberlin

Thank you for using this library! 😊

Answer to the question: it is possible but a bit difficult.

I usually use a small ttf font regenerated from a ttf font with only the characters I need.
To create this small ttf font, I use a software program called Subset Font Maker.

The reason I put "a bit difficult" in the answer to your question is that this software localized Japanese.
I think it would probably work with Chinese fonts as well, but I have not tested it.
I looked for other software with similar functionality but I could not find it.

In the future, I would like to create my own scripts and bundle them with this library, but it will take some time yet.

Thank you.

from openfontrender.

martinberlin avatar martinberlin commented on June 1, 2024

Thanks!
The problem is that I use Linux and that program is only for Windows or Macintosh.

But I found this one called FontForge
Screenshot from 2022-10-10 16-23-19

Will try to check if it's possible to extract a subset of Fonts. One question: Is not possible to make it smaller reducing the size of the Glyph?

I will try to use this font: Noto
On other GFX tools like Adafruit GFX you can pass the size to the font convert command.

from openfontrender.

martinberlin avatar martinberlin commented on June 1, 2024

Update this Font Forge seems to work correctly in Linux. Now I just need to understand how I will write one of that characters in unicode and it will automatically find it with your library.
Made a fork of the library and added support for Espressif IDF framework:

https://github.com/martinberlin/OpenFontRender-idf

Needed to remove some Serial.prints (Those are supported only in Arduino)
Excluded Arduino.h when a LINUX define is set. The rest where minimal touches and added a CMakeLists file that is needed by IDF components.

from openfontrender.

martinberlin avatar martinberlin commented on June 1, 2024

Great!
Feel free to grab the CMakeList files from my fork. Arduino will ignore it, but CMake based compilers like Espressif IDF will use it to build the component.
I will try the develop branch when it’s ready.

one more question that I still don’t know how it goes:
How does open font render matches a Chinese glyph ex temperature

So temperature today here is:

21.9 温度 C. 76.3 % 湿度

How it finds the glyph in that big array?
Or should I organize them like :
1 = 温
2 = second glyph, etc.

I hope my question is understandable. Basically what I mean is:
How I need to organize the subset of the font in order that is possible to use and that the Asian glyph is matched?

from openfontrender.

martinberlin avatar martinberlin commented on June 1, 2024

Quick question is there a way to invert the background/foreground color?
UPDATE I can set the Font color but the background area where the render is drawing is always black.

FA70A42A-825C-45A3-A907-6AD92DB76645
I still didn’t get how to get the same gray color I’m using in LovyanGFX GFX with
Display.color888(255,255,255) that should be white in RGB but is an uint32 so maybe is getting lost when converter to uint16 in render.setFontColor

Got it you need to use this:

        // For this render to work correctly we need to set both foreground and background color:
        //                 FG RGB,  BK RGB
        render.setFontColor(255,255,255, 0,0,0);

from openfontrender.

martinberlin avatar martinberlin commented on June 1, 2024

Hi @takkaO
I tried to build develop branch in IDF v5. and this is the first error I found:

1.
../components/OpenFontRender/upstream/src/OpenFontRender.cpp:496:44: error: 'unicode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  496 |         if (detect_control_char && unicode == '\n') {
      |                                    ~~~~~~~~^~~~~~~
//1 simply solved adding an initializer value: uint16_t unicode = 0; // Line 277

Fixing that it build and works as expected in Espressif IDF provided the CMakeFiles is present.

from openfontrender.

martinberlin avatar martinberlin commented on June 1, 2024

Thanks for the help on this one. Closing since the IDF fix is being handled in the commit comments

from openfontrender.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.