Skip to content

Commit

Permalink
font-patcher: Preserve padding around Braille glyphs
Browse files Browse the repository at this point in the history
[why]
Usually we scale symbols so that they are maximized within one 'cell' of
the font. If we do this for the Braille glyphs the bottom dots from an
upper line will (almost) touch the top dots of the next line. This is
not useful.

[how]
We add padding around the Braille glyphs, to get about the same distance
to the cell borders as the different dots in one glyph have to the
other (~10 %, 5% on each side).

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
  • Loading branch information
Finii committed Oct 13, 2022
1 parent 498b371 commit ec695c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,10 @@ class font_patcher:
0xf0dd: {'align': 'c', 'valign': '', 'stretch': 'pa', 'params': {}},
0xf0de: {'align': 'c', 'valign': '', 'stretch': 'pa', 'params': {}}
}
SYM_ATTR_BRAILLE = {
# 'pa' == preserve aspect ratio
'default': {'align': 'c', 'valign': 'c', 'stretch': 'pa', 'params': {'overlap': -0.05}}
}

CUSTOM_ATTR = {
# 'pa' == preserve aspect ratio
Expand Down Expand Up @@ -810,7 +814,7 @@ class font_patcher:
{'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons.ttf", 'Exact': True, 'SymStart': 0X26A1, 'SymEnd': 0X26A1, 'SrcStart': None, 'ScaleGlyph': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Zap
{'Enabled': self.args.octicons, 'Name': "Octicons", 'Filename': "octicons.ttf", 'Exact': False, 'SymStart': 0xF27C, 'SymEnd': 0xF27C, 'SrcStart': 0xF4A9, 'ScaleGlyph': OCTI_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT}, # Desktop
{'Enabled': self.args.codicons, 'Name': "Codicons", 'Filename': "codicons/codicon.ttf", 'Exact': True, 'SymStart': 0xEA60, 'SymEnd': 0xEBEB, 'SrcStart': None, 'ScaleGlyph': None, 'Attributes': SYM_ATTR_DEFAULT},
{'Enabled': self.args.braille, 'Name': "Braille", 'Filename': "UBraille.ttf", 'Exact': True, 'SymStart': 0x2800, 'SymEnd': 0x28FF, 'SrcStart': None, 'ScaleGlyph': BRAILLE_SCALE_LIST, 'Attributes': SYM_ATTR_DEFAULT},
{'Enabled': self.args.braille, 'Name': "Braille", 'Filename': "UBraille.ttf", 'Exact': True, 'SymStart': 0x2800, 'SymEnd': 0x28FF, 'SrcStart': None, 'ScaleGlyph': BRAILLE_SCALE_LIST, 'Attributes': SYM_ATTR_BRAILLE},
{'Enabled': self.args.custom, 'Name': "Custom", 'Filename': self.args.custom, 'Exact': True, 'SymStart': 0x0000, 'SymEnd': 0x0000, 'SrcStart': None, 'ScaleGlyph': None, 'Attributes': CUSTOM_ATTR}
]

Expand Down

0 comments on commit ec695c7

Please sign in to comment.