mirror of
https://github.com/SeedSigner/seedsigner.git
synced 2026-10-05 15:08:25 +00:00
add getmetrics to add descent heigh to PSBT Maths and FormattedAddress
This commit is contained in:
@@ -22,6 +22,7 @@ class GUIConstants:
|
||||
EDGE_PADDING = 8
|
||||
COMPONENT_PADDING = 8
|
||||
LIST_ITEM_PADDING = 4
|
||||
FIXED_FONT_HEIGHT_PADDING = 6
|
||||
|
||||
BACKGROUND_COLOR = "black"
|
||||
WARNING_COLOR = "#FFD60A"
|
||||
@@ -616,7 +617,8 @@ class FormattedAddress(BaseComponent):
|
||||
|
||||
# Fixed width font means we only have to measure one max-height character
|
||||
left, top, right, bottom = self.font.getbbox("Q")
|
||||
char_width, char_height = right - left, bottom - top
|
||||
ascent, descent = self.font.getmetrics()
|
||||
char_width, char_height = right - left, bottom - top + descent
|
||||
|
||||
n = 7
|
||||
display_str = f"{self.address[:n]} {self.address[n:-1*n]} {self.address[-1*n:]}"
|
||||
|
||||
@@ -511,8 +511,9 @@ class PSBTMathScreen(ButtonListScreen):
|
||||
|
||||
body_font = Fonts.get_font(GUIConstants.BODY_FONT_NAME, (GUIConstants.BODY_FONT_SIZE)*ssf)
|
||||
fixed_width_font = Fonts.get_font(GUIConstants.FIXED_WIDTH_FONT_NAME, (GUIConstants.BODY_FONT_SIZE + 6)*ssf)
|
||||
left, top, right, bottom = fixed_width_font.getbbox(self.input_amount + "+")
|
||||
digits_width, digits_height = right - left, bottom - top
|
||||
left, top, right, bottom = fixed_width_font.getbbox(self.input_amount + "Q")
|
||||
ascent, descent = fixed_width_font.getmetrics()
|
||||
digits_width, digits_height = right - left, bottom - top + descent
|
||||
|
||||
# Draw each line of the equation
|
||||
cur_y = 0
|
||||
|
||||
Reference in New Issue
Block a user