elgerg
September 24, 2019, 7:03pm
1
Hi,
Ive looked at:
and
247
but I’m still not sure what to do here.
I’ve enabled #define LV_FONT_ROBOTO_28 1 in lv_config.h and added the following into my code:
` static lv_style_t st;
lv_style_copy( &st, &lv_style_plain );
st.text.color = LV_COLOR_WHITE;
st.text.font = &lv_font_roboto_28;
lv_label_set_text(label, "22:30");
lv_obj_set_style( label, &st );
`
but my font size is still tiny. See attached photo.
Is there any way to scale these up so they are 5x to 10x bigger?
Thanks in advance
Alex
Hi Alex,
I need to generate a new font.
The most simple way is to use the Online converter . You can find the required instructions are on the converter’s site.
elgerg
September 30, 2019, 7:21pm
3
Thanks for the info.
I downloaded the Roboto font from:
and tried to convert it but got the error:
TypeError: Cannot read property ‘source_path’ of undefined
Any idea what i am doing wrong?
Thanks
A;ex
Please provide a screenshot with the settings you passed to the converter.
You haven’t filled the range. Try 0x20-0x7F
for the ASCII range.
elgerg
October 3, 2019, 7:08pm
7
Yay, that worked!
You may want to put some validation on that field to prevent anyone else falling into the same trap thinking it would default to ASCI.
For anyone else using the converter and get the following:
sketch\Roboto_80.c:1:23: fatal error: lvgl/lvgl.h: No such file or directory
Chnage:
#include “lvgl/lvgl.h”
to:
#include “lvgl.h”
in the c file produced.
Thanks!
Alex
The more correct way to do it (which does not involve modifying an autogenerated file) is to add the parent directory of the lvgl
folder to your include path.
Good idea. I can add it (if I remember).
elgerg
October 4, 2019, 10:45pm
10
Unfortunately the Arduino implementation (on Windows at least) doesnt have a lvgl folder.
C:\Users\x\Documents\Arduino\libraries\LittlevGL\src
Good point. I didn’t know you were using Arduino.
puzrin
October 5, 2019, 3:14pm
12
I’d suggest instead of manual operations use CLI and add to your script sed
call to make replacement:
{
"private": true,
"scripts": {
"build:fonts": "npm run build:font12 && npm run build:font14 && npm run build:font16",
"build:font12": "lv_font_conv --bpp 4 --size 12 --font ./node_modules/roboto-fontface/fonts/roboto/Roboto-Regular.woff --range 0x20-0x7F --symbols ³½¼ --format lvgl --no-compress --force-fast-kern-format -o ./src/fonts/my_font_roboto_12.c && sed -i 's/lvgl\\/lvgl[.]h/lvgl.h/g' ./src/fonts/my_font_roboto_12.c",
"build:font14": "lv_font_conv --bpp 4 --size 14 --font ./node_modules/roboto-fontface/fonts/roboto/Roboto-Regular.woff --range 0x20-0x7F --symbols ³½¼ --format lvgl --no-compress --force-fast-kern-format -o ./src/fonts/my_font_roboto_14.c && sed -i 's/lvgl\\/lvgl[.]h/lvgl.h/g' ./src/fonts/my_font_roboto_14.c",
"build:font16": "lv_font_conv --bpp 4 --size 16 --font ./node_modules/roboto-fontface/fonts/roboto/Roboto-Regular.woff --range 0x20-0x7F --symbols ³½¼ --format lvgl --no-compress --force-fast-kern-format -o ./src/fonts/my_font_roboto_16.c && sed -i 's/lvgl\\/lvgl[.]h/lvgl.h/g' ./src/fonts/my_font_roboto_16.c"
},
"license": "MIT",
"devDependencies": {
"lv_font_conv": "^0.2.0",
"roboto-fontface": "^0.10.0"
}
}
That simplifies reproduction and helps to avoid errors next time.
I use the lv_font_roboto_28 font style, but exxeption occurred
Why does the Chinese font can’t download from the GoogleFonts