pgaskin/NickelMenu

Formatting of the cmd_output for Cyrilic symbols

degiz opened this issue · 14 comments

degiz commented

Hey @pgaskin

When I use cmd_output to run a command that returns Cyrillic symbols, the formatting looks different than for Latin ones (attached photo). To me, it looks like there's a space inserted after every letter.

My use case is to print translations received from DeepL, and all the available screen real estate matters 😅

Is it possible to display the Cyrillic symbols without offsets?

IMG_8952

UTF-16 shenanigans?

degiz commented

You can reproduce that using a UTF-8 encoded config file

menu_item :selection_search :Test Cyrillic :cmd_output :9999:echo 'Привет'

If that's a shenanigan issue, then I'm not sure what to do with it.

Can you upload (i.e., drag and drop into the attachment area) the syslog showing the execution of that item? Also, run the command manually, redirecting (not copy-pasting) the output into a file, and upload that too.

degiz commented

Hey @pgaskin

My config:

menu_item :main :Test russian :cmd_output :9999:echo 'Привет'
menu_item :main :Dump Syslog :cmd_spawn :logread > /mnt/onboard/.adds/syslog_bug.log

What I did:

  • Modified the config (as stated above)
  • Launched kobo
  • In the NickelMenu, pressed Test russian

Attaching the syslog_bug.log, I only stripped the first lines with book names.

Thanks a lot for looking into this!

syslog_bug.log

This looks very similar to problems we've seen before when Cyrillic is used as part of the GUI. I think it's caused when the GUI is trying to use Cyrillic in a widget which is expecting to use the built-in default sans-serif font, Avenir.

I'm not sure whether it's because the Cyrillic glyphs in Kobo's version of Avenir are useless or whether it's because the Kobo can't find any Cyrillic glyphs and uses a fallback font instead, which will probably by one of the built-in CJK fonts.

Whatever the reason, one way it can be "fixed" is by replacing the default system 'Avenir Next' with a font better suited to Cyrillic. On my own devices I've replaced Avenir with a copy of Calibri masquerading as 'Avenir Next'. I didn't do this because I need Cyrillic but I have just tested
menu_item :main :Test russian :cmd_output :9999:echo 'Привет'
in NickelMenu and the output looks fine to me, i.e. no "double spacing" effect.

ETA: If NickelMenu could (optionally???) force the cmd_output widget to use Georgia instead, that might also work.

n3w6i3 commented

Hey @pgaskin

When I use cmd_output to run a command that returns Cyrillic symbols, the formatting looks different than for Latin ones (attached photo). To me, it looks like there's a space inserted after every letter.

My use case is to print translations received from DeepL, and all the available screen real estate matters 😅

Is it possible to display the Cyrillic symbols without offsets?

IMG_8952

Hi, would you be so kind and share the line you used to get this output of translation. Are you using KOreader or anything similar or is this a device native reader?

degiz commented

Hey @n3w6i3 I'm using the following command:

menu_item :selection_search :DeepL Translation :cmd_output :9999:/usr/bin/wget --header='Authorization: DeepL-Auth-Key $MY_KEY' --post-data='target_lang=RU&text={1|S|%}' -qO - https://api-free.deepl.com/v2/translate | jq '.translations[0].text' | fold -s -w 55

No KOreader, pure Kobo + nickelmenu

n3w6i3 commented

Hey @n3w6i3 I'm using the following command:

menu_item :selection_search :DeepL Translation :cmd_output :9999:/usr/bin/wget --header='Authorization: DeepL-Auth-Key $MY_KEY' --post-data='target_lang=RU&text={1|S|%}' -qO - https://api-free.deepl.com/v2/translate | jq '.translations[0].text' | fold -s -w 55

No KOreader, pure Kobo + nickelmenu

I tried it (used my api key) but i get the following message instead of translation: /bin/sh: jq: not found... any idea how to solve it?

NiLuJe commented

I ship it as part of my KoboStuff bundle of tools, so I imagine @degiz has that installed ;).

n3w6i3 commented

I ship it as part of my KoboStuff bundle of tools, so I imagine @degiz has that installed ;).

Thank you all, it works like a charm 😁

I ship it as part of my KoboStuff bundle of tools, so I imagine @degiz has that installed ;).

Thank you all, it works like a charm 😁

Wait, so how did you fix it?

n3w6i3 commented

I ship it as part of my KoboStuff bundle of tools, so I imagine @degiz has that installed ;).

Thank you all, it works like a charm 😁

Wait, so how did you fix it?

By installing the whole package from NiLuJe.

By installing the whole package from NiLuJe.

Ahhh I get it, rookie mistake. Now it works, this is very cool! Thanks :D