cgiesche / streamdeck-homeassistant

Control your Home Assistant devices from StreamDeck
MIT License
768 stars 38 forks source link

Font Fidelity on Mac #281

Open theruffus opened 1 week ago

theruffus commented 1 week ago

TLDR: Just bought Elgato Stream Deck Neo, fonts look weird on a Mac, but normal on PC.

I use a Mac Mini M1 for work and a PC for gaming, after buying the Elgato Stream Deck Neo (the new white one with 8 buttons) I connected it via USB Switcher to be able to use it on both machines.

When configuring some home automation buttons I noticed fonts in home assistant Plugin on a Mac look like "the printer is running out of ink". Example below, both buttons configured the same way in the same spot:

Mac: mac_neo PC: pc_neo

Perhaps expectedly they look in the same "printer out of ink" way on the preview in the Stream Deck app.

Zrzut ekranu 2024-06-23 o 22 36 38

Maybe offering a font choice / size setting or some smoothing settings would fix this?

theruffus commented 1 week ago

I did some searching, the culprit seems to be the black stroke (strokeWidth:4) in the plugin-780664f7.js file. Once I changed strokeWidth to 0 and the stroke to #FFF the text became crystal clear on the Mac

class J3{constructor(V={width:144,height:144}){this.buttonRes=V,this.halfRes={width:this.buttonRes.width/2,height:this.buttonRes.height/2},this.fontSize=24,this.lineAttr={fill:"#FFF","font-family":"sans-serif","font-weight":"bold","font-size":${this.fontSize}px,"text-anchor":"middle",stroke:"#FFF",strokeWidth:0}

Result: IMG_1855

Preview: Zrzut ekranu 2024-06-23 o 23 20 45

Cheers

cgiesche commented 1 week ago

Hi and thank you for this finding. I am currently (slowly but surely) working on a refresh of the rendering logic. I will add your changes to make the font more readable :)