lvgl/lv_font_conv

Allow setting the font name as command line argument

Viatorus opened this issue · 7 comments

Currently, the font name is the derivated from the output file path:

const ext = path.extname(options.output);
this.font_name = path.basename(options.output, ext);

Would be nice to set the font name via command line (e.g. like lv_image_conv does).

I see no reasons and tend to decline changes.

It wouldn't be a breaking change.

It would be an additional, optional option. If the name is not provided per cmd, it fallsback to the default behavior.

Should I submit a PR?

I do not like to accept changes "just for fun". Please, explain the reasons first, why this is not opinion-based and could be useful for all. As far as I remember - it's possible to define a custom output name now.

As far as I remember - it's possible to define a custom output name now.

Based on the code, it does not appear that it is currently possible to define a custom output name without changing the output file name as well. This means you would need a wrapper script to then rename the file if you didn't want the names to be matching.

Personally, I don't see any issue with adding this feature.

https://github.com/puzrin/dispenser/blob/master/support/build_fonts.js#L28

Output is not related to input, custom names are ok.

@embeddedt Thank you for your help here.

@puzrin

Output is not related to input, custom names are ok.

That is not the problem I was talking about. Your output file my_font_roboto_14.c has the same name as the output variable my_font_roboto_14 and this cannot be changed via CMD in lv_font_conv. So you would have to rename files manual. In lv_img_conv I don't need to do this manual, since it is part of the tool itself:

https://github.com/lvgl/lv_img_conv/blob/master/lib/cli.ts#L21-L25

What we (in our project) have, is folder structure like: <project>/resources/fonts/ and <project>/resources/images/

I want to instrument lv_font_conv to output the font my_font.ttf to <project>/resources/font/my_font_18.c but also name the font variable <project>_resources_fonts_my_font_18 instead of just my_font_18. We do the same with images (and all other resources) because we don't want to pollute the global naming scope in C with short, unrelated names.

Ah, ok. Now understand. May be reasonable.

But note, that's lvgl-writer specific. Binary output has no such need. Could you suggest an argument name, "lvgl-specific"?