Open Lash-L opened 9 months ago
pos_x
, pos_y
are coordinates of desired center of a label.
You can use pos_x = (x0 + x1)/2
and pos_y = (y0 + y1)/2
Are you sure you want to draw room names on the map? Have you figured out if there are any available fonts?
Why would i not want to out of curiosity? This is what I currently have
Which font do you use?
Which font do you use?
I did not set a font - so I guess the default?
The last time I have checked default font didn't support any special characters and it wasn't scalable. Your font seems to look much better though, maybe I'd need to check it again if there have been any upgrades in this field.
Interesting - I'll look into the scaling issue later. I was just trying to see proof of concept how it worked. Will be a few days before I actually fully implement it as it will need a PR in your repo as well to not access the private attributes.
Can you check if special characters are supported? ĄąÈÉóÔŁź
etc
Ah - nope they are not
Yeah, because of that I wouldn't add this feature to the official integration
Is the limitation in a underlying package or home assistant? I could perhaps try to find if I could access home assistants fonts if that would help
This is a limitation of a default font built into Pillow library. It is possible to use system fonts, but last time I checked HA image didn't contain any built-in fonts.
Retrieving fonts:
fc-list | grep ttf | sed "s/.*\///"| sed "s/ttf.*/ttf/"
https://github.com/PiotrMachowski/Python-package-vacuum-map-parser-roborock/blob/e64108c71db888b1208786181084b63478acc914/src/vacuum_map_parser_roborock/map_data_parser.py#L222
Hey @PiotrMachowski - today I've been spending some time trying to get the names on the map.
I do this:
But the issue is that draw_room_names expects room to have a pos_x and pos_y - instead it just has a x0,x1,y0,y1. How can I get that/ calculate that?