[Enhancement] Support printf formatting of uint16_t[] FONTCHARACTER strings #3

Open
opened 2022-10-24 19:50:25 +02:00 by calamari · 1 comment

It could be printed by ignoring the high byte of each 16-bit character.

If the user specifies %ls instead of %s, if I'm understanding correctly that will set opt.size = sizeof(long). Then src/stdio/printf/format_usual.c, printf_format_s() can access opt->size. Changes would include a new length calculation and a new __printf_out for loop.

It could be printed by ignoring the high byte of each 16-bit character. If the user specifies %ls instead of %s, if I'm understanding correctly that will set `opt.size = sizeof(long)`. Then src/stdio/printf/format_usual.c, printf_format_s() can access `opt->size`. Changes would include a new length calculation and a new `__printf_out` for loop.
Collaborator

Right, %ls enables printing wide characters. I'm quite unsure about how to go with these. On the one hand they feel great to support FONTCHARACTER, on the other hand that wouldn't be compatible with usual PC/Linux behavior.

I'm wondering whether we can define a locale where normal chars are UTF-8 and wide chars are FONTCHARACTER while remaining predictably compatible with C99?

The other option would be a printf() extension like we have for %D.

Regardless of the particular implementation, I am definitely in favor of supporting such a format.

Right, `%ls` enables printing wide characters. I'm quite unsure about how to go with these. On the one hand they feel great to support `FONTCHARACTER`, on the other hand that wouldn't be compatible with usual PC/Linux behavior. I'm wondering whether we can define a locale where normal chars are UTF-8 and wide chars are `FONTCHARACTER` while remaining predictably compatible with C99? The other option would be a `printf()` extension like we have for `%D`. Regardless of the particular implementation, I am definitely in favor of supporting such a format.
calamari changed title from [Enhancement] Support printf formatting of uint16_t[] FONTCHARACTER strings via %ls to [Enhancement] Support printf formatting of uint16_t[] FONTCHARACTER strings 2022-10-24 20:14:27 +02:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Vhex-Kernel-Core/fxlibc#3
No description provided.