bk1285 / rpi_wordclock

Software to create a Raspberry Pi based wordclock
GNU General Public License v3.0
214 stars 107 forks source link

Grid not centered vertically #132

Open SvenFackert opened 4 years ago

SvenFackert commented 4 years ago

I just wanted to point out that the character grid is not perfectly centered vertically. It is a bit too far to the bottom. Maybe the problem origins from the vertical alignment of font characters inside the SVG text elements. But I didn't have any time to dig deeper into that yet.

A quick and dirty fix that I just used would be to just offset each character by 4 pixels which will output an almost perfectly centered grid.

create_layout.py (only added the -4)

...
if mode == 'stencil':
    # Write only characters
    text_layout.add(layout.text((content[y].decode('utf-8')[x]),
                                insert=(coords[0], coords[1] + (float(font_size) / 2.0) - 4)))
...

Big thanks to all of you guys working on this awesome project and especially to @bk1285 !

bk1285 commented 4 years ago

Hi @SvenFackert

thanks for reporting. Can you detail, which viewer you were using? I'll check, if I can reproduce that.

Best, Bernd

SvenFackert commented 4 years ago

Hi Bernd,

I checked it using Google Chrome as well as Adobe Illustrator. The offset appeared in both of them. You can also see the offset in the exported png files within the wordclock_layout folders.

Kind regards, Sven