question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning: Unable to open font (...)

See original GitHub issue

I cannot add label in Cyrillic, such as “Кухня”:

Traceback (most recent call last):
  File "E:\HassWP\python-3.7.7\lib\site-packages\homeassistant\helpers\entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "E:\HassWP\python-3.7.7\lib\site-packages\homeassistant\helpers\entity.py", line 472, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "E:\HassWP\python-3.7.7\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "E:\HassWP\config\custom_components\xiaomi_cloud_map_extractor\camera.py", line 186, in update
    self._image_config)
  File "E:\HassWP\config\custom_components\xiaomi_cloud_map_extractor\xiaomi_cloud_connector.py", line 105, in get_map
    map_data = MapDataParser.parse(unzipped, colors, drawables, texts, sizes, image_config)
  File "E:\HassWP\config\custom_components\xiaomi_cloud_map_extractor\map_data_parser.py", line 76, in parse
    MapDataParser.draw_elements(colors, drawables, texts, sizes, map_data)
  File "E:\HassWP\config\custom_components\xiaomi_cloud_map_extractor\map_data_parser.py", line 237, in draw_elements
    ImageHandler.draw_texts(map_data.image, texts)
  File "E:\HassWP\config\custom_components\xiaomi_cloud_map_extractor\image_handler.py", line 171, in draw_texts
    text_config[CONF_FONT], text_config[CONF_FONT_SIZE])
  File "E:\HassWP\config\custom_components\xiaomi_cloud_map_extractor\image_handler.py", line 206, in __draw_text__
    w, h = draw.textsize(text, font)
  File "E:\HassWP\config\deps\Python37\site-packages\PIL\ImageDraw.py", line 430, in textsize
    return font.getsize(text, direction, features, language, stroke_width)
  File "E:\HassWP\config\deps\Python37\site-packages\PIL\ImageFont.py", line 128, in getsize
    return self.font.getsize(text)
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-6: ordinal not in range(256)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:22 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
PiotrMachowskicommented, Oct 14, 2020

I will try to find a way to attach a font file

1reaction
PiotrMachowskicommented, Oct 14, 2020

Using TTF stored in a config is much better, as it doesn’t require manual changes after every HA update. I will check if it is possible

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Unable To Import Fonts? Unable to open assets ...
All my fonts are in file types that should be accessible by Unity, so it couldn't be an error with the fonts themselves,...
Read more >
Troubleshoot Font Book problems on Mac
If you try to open a version of the Font Book app that can't be used on your Mac, an alert message is...
Read more >
PHP Could not find/open font
I am trying to write text over an image but i get the error : PHP Warning: imagettftext(): Could not find/open font in ......
Read more >
Errors And Warnings When Installing Fonts On Mac
A font is built up by coordinates and the font validation fails because the font is programmed with too many coordinates. The font,...
Read more >
Does not appear to be a valid font file (can not install font)
Open Fonts by clicking the Start menu, clicking Control Panel, clicking Appearance and Personalization, and then clicking Fonts. Then drag the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found