Why is it that the Unicode left three-eighths block and right three-eighths block characters have different heights and widths? I've tested this in a few fonts:
🮈▍🮈▍🮈▍
I'm trying to find full vertical left and right bars that line up with the 2x3 characters in Symbols for Legacy Computing Unicode block. For example, the characters below should form a perfect rectangle:
🮈🬰▍
And here is the same shape in an image:
I wrote some simple code to generate images of these three characters with no fallback:
#!/usr/bin/env python3
# https://stackoverflow.com/questions/57781469/
from PIL import Image, ImageDraw, ImageFont
width=500
height=100
back_ground_color=(255,255,255)
font_size=80
font_color=(0,0,0)
unicode_text = '🮈🬰▍'
fonts = {
'lastresort': 'LastResort-Regular.ttf',
'unifont': 'unifont-15.1.04.otf',
'unifont_upper': 'unifont_upper-15.1.04.otf',
'noto': 'NotoSans-Regular.ttf',
'2001': 'CODE2001.TTF'
}
for name, font in fonts.items():
im = Image.new("RGB", (width,height), back_ground_color)
draw = ImageDraw.Draw(im)
unicode_font = ImageFont.truetype(font, font_size)
draw.text((10,10), unicode_text, font=unicode_font, fill=font_color)
im.save(f"text_{name}.jpg")
text_lastresort.jpg
text_unifont.jpg
text_unifont_upper.jpg
text_noto.jpg
text_2001.jpg
Unicode does not define the visual layout of glyphs. That's defined by the font. I agree that it's surprising for a font to choose to make these different heights, but it isn't related to Unicode. You'd need to use a different font if this is causing a problem.
Which fonts have you tested this with? These are not particularly common characters in fonts. It's very possible that the fonts you've tested with do not have these character and your layout system is using the same fallback font (called a "cascade") for all of your tests. On my system (macOS), the left block is available in my default fonts, but not the right block. You may be picking the right block up from a different font, which would explain the different appearance.
I suspect you need to reorder your font cascade so that all the glyphs are selected from the same font. How to do that depends on what you're using to display this.