How to Optimize Font Memory Usage in Qt for MCUs 2.7.1 (fontcompiler-args not supported)
-
wrote 8 days ago last edited by
Hi everyone,
I'm working on a project using Qt for MCUs 2.7.1, and I'm currently facing a memory optimization issue related to fonts.Setup Details:
- Qt version: 2.7.1 (mandatory due to customer constraint)
- Toolchain: IAR
- Fonts used: TTF
- .qmlproject is exported using a .bat file that calls qmlprojectexporter.exe
The generated file qul_font_engines.cpp alone is taking up around 3636 KB of memory, which is too large for our current memory constraints.
My goal is to bring this down under 1000 KB if possible.What I've Already Tried (Please Don't Suggest These Again š):
- --fontcompiler-args option in the .bat file:
- I tried using --fontcompiler-args "--chars=0123456789"
- Result: Not supported in Qt for MCUs 2.7.1 ā shows Unknown options: fontcompiler-args, chars
- Verified fontcompiler.exe is present in 2.7.1, but CLI option is still not supported.
- Cannot upgrade to Qt 2.8.0 or later due to customer-mandated toolchain freeze.
- Tried setting font size lower in QML (font.pixelSize: 16) and limited font styles (font.bold/italic: false) ā helped marginally but not enough.
- Started reviewing QML files to eliminate unused text/glyphs.
What I'm Looking For:
- Are there any other ways in Qt for MCUs 2.7.1 to reduce the font memory footprint without relying on unsupported CLI arguments?
- Is there a way to use fontCompilerOptions inside .qmlproject or .qmlprojectconfig that can limit the character set?
- Can I manually run fontcompiler.exe to generate .qulfnt files and use them directly in my .qmlproject?
- Any other suggestions to significantly reduce qul_font_engines.cpp size?
Any advice or experience you can share would be greatly appreciated!
Thanks in advance
ā Sayali -
Hi and welcome to devnet,
First thing, sorry, I don't have experience with Qt for MCU. That said I was wondering: is just replacing qmlprojectexporter from 2.7.1 by the one from 2.8.2 an option ? The rest stays the same.
-
wrote 6 days ago last edited by
Hi,
Thank you so much for taking the time to respond ā I really appreciate it.
Yes, I have previously tried using the qmlprojectexporter from Qt for MCUs 2.8.2 while keeping the rest of the toolchain and setup on 2.7.1. The project compiles successfully with that approach.
However, even with the 2.8.2 exporter, I did not observe any noticeable reduction in the generated font file size. The memory usage for qul_font_engines.cpp remains almost the same, which is the core issue I'm trying to address.
Thanks again for your input ā happy to hear any further ideas you might have! -
wrote 3 days ago last edited by
As a continuation of my earlier post regarding memory optimization, I switched the font engine from Static to Spark in my Qt for MCUs project to reduce memory footprint.
I would like to understand the following:
What specific library files are required when using the Spark font engine on an embedded environment?
How should these libraries be linked or added to the build process to avoid runtime errors?
Is there any documentation or steps specific to ensuring the Spark engine works properly during integration with an application?
The build works fine on my side, but once integrated into the larger system, it fails unless the missing library is resolved.
Any help or direction on resolving this and properly setting up Spark would be appreciated.
-
As a continuation of my earlier post regarding memory optimization, I switched the font engine from Static to Spark in my Qt for MCUs project to reduce memory footprint.
I would like to understand the following:
What specific library files are required when using the Spark font engine on an embedded environment?
How should these libraries be linked or added to the build process to avoid runtime errors?
Is there any documentation or steps specific to ensuring the Spark engine works properly during integration with an application?
The build works fine on my side, but once integrated into the larger system, it fails unless the missing library is resolved.
Any help or direction on resolving this and properly setting up Spark would be appreciated.
@say_1 said in How to Optimize Font Memory Usage in Qt for MCUs 2.7.1 (fontcompiler-args not supported):
What specific library files are required when using the Spark font engine on an embedded environment?
You can check the direct dependencies of a library by using the ldd tool.
"How should these libraries be linked or added to the build process to avoid runtime errors?" - not at all. You just need to make sure these libs are installed on the target machine.
3/5